@@ -262,8 +262,78 @@ macro_rules! or {
262262 } ;
263263}
264264
265- // See `generate_aarch64_outlined_atomics` in build.rs.
266- include ! ( concat!( env!( "OUT_DIR" ) , "/outlined_atomics.rs" ) ) ;
265+ #[ macro_export]
266+ macro_rules! foreach_ordering {
267+ ( $macro: path, $bytes: tt, $name: ident) => {
268+ $macro!( Relaxed , $bytes, ${ concat( $name, _relax) } ) ;
269+ $macro!( Acquire , $bytes, ${ concat( $name, _acq) } ) ;
270+ $macro!( Release , $bytes, ${ concat( $name, _rel) } ) ;
271+ $macro!( AcqRel , $bytes, ${ concat( $name, _acq_rel) } ) ;
272+ } ;
273+ ( $macro: path, $name: ident) => {
274+ $macro!( Relaxed , ${ concat( $name, _relax) } ) ;
275+ $macro!( Acquire , ${ concat( $name, _acq) } ) ;
276+ $macro!( Release , ${ concat( $name, _rel) } ) ;
277+ $macro!( AcqRel , ${ concat( $name, _acq_rel) } ) ;
278+ } ;
279+ }
280+
281+ #[ macro_export]
282+ macro_rules! foreach_bytes {
283+ ( $macro: path, $name: ident) => {
284+ foreach_ordering!( $macro, 1 , ${ concat( __aarch64_, $name, "1" ) } ) ;
285+ foreach_ordering!( $macro, 2 , ${ concat( __aarch64_, $name, "2" ) } ) ;
286+ foreach_ordering!( $macro, 4 , ${ concat( __aarch64_, $name, "4" ) } ) ;
287+ foreach_ordering!( $macro, 8 , ${ concat( __aarch64_, $name, "8" ) } ) ;
288+ } ;
289+ }
290+
291+ /// Generate different macros for cas/swp/add/clr/eor/set so that we can test them separately.
292+ #[ macro_export]
293+ macro_rules! foreach_cas {
294+ ( $macro: path) => {
295+ foreach_bytes!( $macro, cas) ;
296+ } ;
297+ }
298+
299+ /// Only CAS supports 16 bytes, and it has a different implementation that uses a different macro.
300+ #[ macro_export]
301+ macro_rules! foreach_cas16 {
302+ ( $macro: path) => {
303+ foreach_ordering!( $macro, __aarch64_cas16) ;
304+ } ;
305+ }
306+ #[ macro_export]
307+ macro_rules! foreach_swp {
308+ ( $macro: path) => {
309+ foreach_bytes!( $macro, swp) ;
310+ } ;
311+ }
312+ #[ macro_export]
313+ macro_rules! foreach_ldadd {
314+ ( $macro: path) => {
315+ foreach_bytes!( $macro, ldadd) ;
316+ } ;
317+ }
318+ #[ macro_export]
319+ macro_rules! foreach_ldclr {
320+ ( $macro: path) => {
321+ foreach_bytes!( $macro, ldclr) ;
322+ } ;
323+ }
324+ #[ macro_export]
325+ macro_rules! foreach_ldeor {
326+ ( $macro: path) => {
327+ foreach_bytes!( $macro, ldeor) ;
328+ } ;
329+ }
330+ #[ macro_export]
331+ macro_rules! foreach_ldset {
332+ ( $macro: path) => {
333+ foreach_bytes!( $macro, ldset) ;
334+ } ;
335+ }
336+
267337foreach_cas ! ( compare_and_swap) ;
268338foreach_cas16 ! ( compare_and_swap_i128) ;
269339foreach_swp ! ( swap) ;
0 commit comments