1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
// SPDX-License-Identifier: Apache-2.0 OR MIT
/*
Armv8 AArch32
See "Atomic operation overview by architecture" for atomic operations in this architecture:
https://github.com/taiki-e/atomic-maybe-uninit/blob/HEAD/src/arch/README.md#arm
LLVM doesn't emit CLREX for Armv8-M Baseline, but it actually supports CLREX.
https://developer.arm.com/documentation/dui1095/a/The-Cortex-M23-Instruction-Set/Memory-access-instructions
Refs:
- Arm A-profile A32/T32 Instruction Set Architecture
https://developer.arm.com/documentation/ddi0597/latest
- Arm® Architecture Reference Manual for A-profile architecture
https://developer.arm.com/documentation/ddi0487/latest (PDF)
- Arm® Architecture Reference Manual Supplement Armv8, for the Armv8-R AArch32 architecture profile
https://developer.arm.com/documentation/ddi0568/latest (PDF)
- Arm® v8-M Architecture Reference Manual
https://developer.arm.com/documentation/ddi0553/latest (PDF)
- Arm® Cortex®-M33 Devices Generic User Guide
https://developer.arm.com/documentation/100235/0100
- Arm Cortex-M23 Devices Generic User Guide
https://developer.arm.com/documentation/dui1095/a
See tests/asm-test/asm/atomic-maybe-uninit for generated assembly.
*/
delegate_size!(delegate_all);
use core::{
arch::asm,
mem::{self, MaybeUninit},
sync::atomic::Ordering,
};
use crate::raw::{AtomicCompareExchange, AtomicLoad, AtomicStore, AtomicSwap};
#[cfg(not(any(target_feature = "mclass", atomic_maybe_uninit_target_feature = "mclass")))]
use crate::utils::{MaybeUninit64, Pair};
macro_rules! atomic_rmw {
($op:ident, $order:ident) => {
// op(acquire, release)
match $order {
Ordering::Relaxed => $op!("r", "r"),
Ordering::Acquire => $op!("a", "r"),
Ordering::Release => $op!("r", "l"),
// AcqRel and SeqCst RMWs are equivalent.
Ordering::AcqRel | Ordering::SeqCst => $op!("a", "l"),
_ => unreachable!(),
}
};
}
// Adds S suffix if needed. We prefer instruction without S suffix,
// but Armv8-M Baseline doesn't support thumb2 instructions.
cfg_sel!({
#[cfg(any(
not(any(
target_feature = "thumb-mode",
atomic_maybe_uninit_target_feature = "thumb-mode",
)),
any(target_feature = "thumb2", atomic_maybe_uninit_target_feature = "thumb2"),
))]
{
macro_rules! s {
($op:tt, $operand:tt) => {
concat!($op, " ", $operand)
};
}
}
#[cfg(else)]
{
macro_rules! s {
($op:tt, $operand:tt) => {
concat!($op, "s ", $operand)
};
}
}
});
cfg_sel!({
#[cfg(any(target_feature = "thumb-mode", atomic_maybe_uninit_target_feature = "thumb-mode"))]
{
// CB{,N}Z is only supported on Thumb mode.
// $r must be r[0-7] and cannot jump to the label at the back.
// https://developer.arm.com/documentation/ddi0597/2025-12/Base-Instructions/CBNZ--CBZ--Compare-and-Branch-on-Nonzero-or-Zero-
macro_rules! cbz {
($r:tt, $label:tt) => {
concat!("cbz ", $r, ", ", $label)
};
}
}
#[cfg(else)]
{
#[rustfmt::skip]
macro_rules! cbz {
($r:tt, $label:tt) => {
concat!(
"cmp ", $r, ", #0\n",
"beq ", $label,
)
};
}
}
});
// -----------------------------------------------------------------------------
// Register-width or smaller atomics
#[rustfmt::skip]
macro_rules! atomic {
($ty:ident, $suffix:tt) => {
delegate_signed!(delegate_all, $ty);
impl AtomicLoad for $ty {
#[inline]
unsafe fn atomic_load(
src: *const MaybeUninit<Self>,
order: Ordering,
) -> MaybeUninit<Self> {
debug_assert_atomic_unsafe_precondition!(src, $ty);
let out: MaybeUninit<Self>;
// SAFETY: the caller must uphold the safety contract.
unsafe {
macro_rules! atomic_load {
($acquire:tt) => {
asm!(
concat!("ld", $acquire, $suffix, " {out}, [{src}]"), // atomic { out = zero_extend(*src) }
src = in(reg) src,
out = lateout(reg) out,
options(nostack, preserves_flags),
)
};
}
match order {
Ordering::Relaxed => atomic_load!("r"),
// Acquire and SeqCst loads are equivalent.
Ordering::Acquire | Ordering::SeqCst => atomic_load!("a"),
_ => crate::utils::unreachable_unchecked(),
}
}
out
}
}
impl AtomicStore for $ty {
#[inline]
unsafe fn atomic_store(
dst: *mut MaybeUninit<Self>,
val: MaybeUninit<Self>,
order: Ordering,
) {
debug_assert_atomic_unsafe_precondition!(dst, $ty);
// SAFETY: the caller must uphold the safety contract.
unsafe {
macro_rules! atomic_store {
($release:tt) => {
asm!(
concat!("st", $release, $suffix, " {val}, [{dst}]"), // atomic { *dst = val }
dst = in(reg) dst,
val = in(reg) val,
options(nostack, preserves_flags),
)
};
}
match order {
Ordering::Relaxed => atomic_store!("r"),
// Release and SeqCst stores are equivalent.
Ordering::Release | Ordering::SeqCst => atomic_store!("l"),
_ => crate::utils::unreachable_unchecked(),
}
}
}
}
impl AtomicSwap for $ty {
#[inline]
unsafe fn atomic_swap(
dst: *mut MaybeUninit<Self>,
val: MaybeUninit<Self>,
order: Ordering,
) -> MaybeUninit<Self> {
debug_assert_atomic_unsafe_precondition!(dst, $ty);
let mut out: MaybeUninit<Self>;
// SAFETY: the caller must uphold the safety contract.
unsafe {
macro_rules! swap {
($acquire:tt, $release:tt) => {
asm!(
"2:", // 'retry:
concat!("ld", $acquire, "ex", $suffix, " {out}, [{dst}]"), // atomic { out = zero_extend(*dst); EXCLUSIVE = dst }
concat!("st", $release, "ex", $suffix, " {r}, {val}, [{dst}]"), // atomic { if EXCLUSIVE == dst { *dst = val; r = 0 } else { r = 1 }; EXCLUSIVE = None }
"cmp {r}, #0", // if r == 0 { Z = 1 } else { Z = 0 }
"bne 2b", // if Z == 0 { jump 'retry }
dst = in(reg) dst,
val = in(reg) val,
out = out(reg) out,
r = out(reg) _,
// Do not use `preserves_flags` because CMP modifies the condition flags.
options(nostack),
)
};
}
atomic_rmw!(swap, order);
}
out
}
}
impl AtomicCompareExchange for $ty {
#[inline]
unsafe fn atomic_compare_exchange(
dst: *mut MaybeUninit<Self>,
old: MaybeUninit<Self>,
new: MaybeUninit<Self>,
success: Ordering,
failure: Ordering,
) -> (MaybeUninit<Self>, bool) {
debug_assert_atomic_unsafe_precondition!(dst, $ty);
let order = crate::utils::upgrade_success_ordering(success, failure);
let mut out: MaybeUninit<Self>;
let mut r: i32;
// SAFETY: the caller must uphold the safety contract.
unsafe {
macro_rules! cmpxchg {
($acquire:tt, $release:tt) => {
asm!(
"2:", // 'retry:
concat!("ld", $acquire, "ex", $suffix, " {out}, [{dst}]"), // atomic { out = zero_extend(*dst); EXCLUSIVE = dst }
"cmp {out}, {old}", // if out == old { Z = 1 } else { Z = 0 }
"bne 3f", // if Z == 0 { jump 'cmp-fail }
concat!("st", $release, "ex", $suffix, " r3, {new}, [{dst}]"), // atomic { if EXCLUSIVE == dst { *dst = new; r3 = 0 } else { r3 = 1 }; EXCLUSIVE = None }
cbz!("r3", "4f"), // if r3 == 0 { jump 'success }
"b 2b", // jump 'retry
"3:", // 'cmp-fail:
"clrex", // EXCLUSIVE = None
s!("mov", "r3, #1"), // r3 = 1
"4:", // 'success:
dst = in(reg) dst,
old = in(reg) crate::utils::extend32::$ty::zero(old),
new = in(reg) new,
out = out(reg) out,
out("r3") r,
// Do not use `preserves_flags` because CMP, cbz!, and s! modify the condition flags.
options(nostack),
)
};
}
atomic_rmw!(cmpxchg, order);
crate::utils::assert_unchecked(r == 0 || r == 1); // may help remove extra test
}
// 0 if the store was successful, 1 if no store was performed
(out, r == 0)
}
#[inline]
unsafe fn atomic_compare_exchange_weak(
dst: *mut MaybeUninit<Self>,
old: MaybeUninit<Self>,
new: MaybeUninit<Self>,
success: Ordering,
failure: Ordering,
) -> (MaybeUninit<Self>, bool) {
debug_assert_atomic_unsafe_precondition!(dst, $ty);
let order = crate::utils::upgrade_success_ordering(success, failure);
let mut out: MaybeUninit<Self>;
let mut r: i32;
// SAFETY: the caller must uphold the safety contract.
unsafe {
macro_rules! cmpxchg_weak {
($acquire:tt, $release:tt) => {
asm!(
concat!("ld", $acquire, "ex", $suffix, " {out}, [{dst}]"), // atomic { out = zero_extend(*dst); EXCLUSIVE = dst }
"cmp {out}, {old}", // if out == old { Z = 1 } else { Z = 0 }
"bne 3f", // if Z == 0 { jump 'cmp-fail }
concat!("st", $release, "ex", $suffix, " {r}, {new}, [{dst}]"), // atomic { if EXCLUSIVE == dst { *dst = new; r = 0 } else { r = 1 }; EXCLUSIVE = None }
"b 4f", // jump 'success
"3:", // 'cmp-fail:
"clrex", // EXCLUSIVE = None
s!("mov", "{r}, #1"), // r = 1
"4:", // 'success:
dst = in(reg) dst,
old = in(reg) crate::utils::extend32::$ty::zero(old),
new = in(reg) new,
out = out(reg) out,
r = out(reg) r,
// Do not use `preserves_flags` because CMP and s! modify the condition flags.
options(nostack),
)
};
}
atomic_rmw!(cmpxchg_weak, order);
crate::utils::assert_unchecked(r == 0 || r == 1); // may help remove extra test
}
// 0 if the store was successful, 1 if no store was performed
(out, r == 0)
}
}
};
}
atomic!(u8, "b");
atomic!(u16, "h");
atomic!(u32, "");
// -----------------------------------------------------------------------------
// 64-bit atomics
//
// Unlike AArch64's LDXP, Armv8 AArch32's LDREXD is atomic without corresponding STREXD.
// See Arm® Architecture Reference Manual for A-profile architecture
// Section E2.2 "Atomicity in the Arm architecture" for more.
#[cfg(not(any(target_feature = "mclass", atomic_maybe_uninit_target_feature = "mclass")))]
delegate_signed!(delegate_all, u64);
#[cfg(not(any(target_feature = "mclass", atomic_maybe_uninit_target_feature = "mclass")))]
impl AtomicLoad for u64 {
#[inline]
unsafe fn atomic_load(src: *const MaybeUninit<Self>, order: Ordering) -> MaybeUninit<Self> {
debug_assert_atomic_unsafe_precondition!(src, u64);
let (out_lo, out_hi);
// SAFETY: the caller must uphold the safety contract.
unsafe {
macro_rules! atomic_load {
($acquire:tt) => {
asm!(
concat!("ld", $acquire, "exd r0, r1, [{src}]"), // atomic { r0:r1 = *src; EXCLUSIVE = src }
"clrex", // EXCLUSIVE = None
src = in(reg) src,
// out pair - must be even-numbered and not R14
lateout("r0") out_lo,
lateout("r1") out_hi,
options(nostack, preserves_flags),
)
};
}
match order {
Ordering::Relaxed => atomic_load!("r"),
// Acquire and SeqCst loads are equivalent.
Ordering::Acquire | Ordering::SeqCst => atomic_load!("a"),
_ => crate::utils::unreachable_unchecked(),
}
MaybeUninit64 { pair: Pair { lo: out_lo, hi: out_hi } }.whole
}
}
}
#[cfg(not(any(target_feature = "mclass", atomic_maybe_uninit_target_feature = "mclass")))]
impl AtomicStore for u64 {
#[inline]
unsafe fn atomic_store(dst: *mut MaybeUninit<Self>, val: MaybeUninit<Self>, order: Ordering) {
debug_assert_atomic_unsafe_precondition!(dst, u64);
let val = MaybeUninit64 { whole: val };
// SAFETY: the caller must uphold the safety contract.
// Do not use atomic_swap because it needs extra registers to implement store.
unsafe {
macro_rules! atomic_store {
($acquire:tt, $release:tt) => {
asm!(
"2:", // 'retry:
concat!("ld", $acquire, "exd r4, r5, [{dst}]"), // atomic { r4:r5 = *dst; EXCLUSIVE = dst }
concat!("st", $release, "exd r4, r2, r3, [{dst}]"), // atomic { if EXCLUSIVE == dst { *dst = r2:r3; r4 = 0 } else { r4 = 1 }; EXCLUSIVE = None }
"cmp r4, #0", // if r4 == 0 { Z = 1 } else { Z = 0 }
"bne 2b", // if Z == 0 { jump 'retry }
dst = in(reg) dst,
// val pair - must be even-numbered and not R14
in("r2") val.pair.lo,
in("r3") val.pair.hi,
// tmp pair - must be even-numbered and not R14
out("r4") _,
out("r5") _,
// Do not use `preserves_flags` because CMP modifies the condition flags.
options(nostack),
)
};
}
match order {
Ordering::Relaxed => atomic_store!("r", "r"),
Ordering::Release => atomic_store!("r", "l"),
Ordering::SeqCst => atomic_store!("a", "l"),
_ => crate::utils::unreachable_unchecked(),
}
}
}
}
#[cfg(not(any(target_feature = "mclass", atomic_maybe_uninit_target_feature = "mclass")))]
impl AtomicSwap for u64 {
#[inline]
unsafe fn atomic_swap(
dst: *mut MaybeUninit<Self>,
val: MaybeUninit<Self>,
order: Ordering,
) -> MaybeUninit<Self> {
debug_assert_atomic_unsafe_precondition!(dst, u64);
let val = MaybeUninit64 { whole: val };
let (mut prev_lo, mut prev_hi);
// SAFETY: the caller must uphold the safety contract.
unsafe {
macro_rules! swap {
($acquire:tt, $release:tt) => {
asm!(
"2:", // 'retry:
concat!("ld", $acquire, "exd r0, r1, [{dst}]"), // atomic { r0:r1 = *dst; EXCLUSIVE = dst }
concat!("st", $release, "exd {r}, r2, r3, [{dst}]"), // atomic { if EXCLUSIVE == dst { *dst = r2:r3; r = 0 } else { r = 1 }; EXCLUSIVE = None }
"cmp {r}, #0", // if r == 0 { Z = 1 } else { Z = 0 }
"bne 2b", // if Z == 0 { jump 'retry }
dst = in(reg) dst,
r = out(reg) _,
// val pair - must be even-numbered and not R14
in("r2") val.pair.lo,
in("r3") val.pair.hi,
// prev pair - must be even-numbered and not R14
out("r0") prev_lo,
out("r1") prev_hi,
// Do not use `preserves_flags` because CMP modifies the condition flags.
options(nostack),
)
};
}
atomic_rmw!(swap, order);
MaybeUninit64 { pair: Pair { lo: prev_lo, hi: prev_hi } }.whole
}
}
}
#[cfg(not(any(target_feature = "mclass", atomic_maybe_uninit_target_feature = "mclass")))]
impl AtomicCompareExchange for u64 {
#[inline]
unsafe fn atomic_compare_exchange(
dst: *mut MaybeUninit<Self>,
old: MaybeUninit<Self>,
new: MaybeUninit<Self>,
success: Ordering,
failure: Ordering,
) -> (MaybeUninit<Self>, bool) {
debug_assert_atomic_unsafe_precondition!(dst, u64);
let order = crate::utils::upgrade_success_ordering(success, failure);
let old = MaybeUninit64 { whole: old };
let new = MaybeUninit64 { whole: new };
let (mut prev_lo, mut prev_hi);
let mut r: i32;
// SAFETY: the caller must uphold the safety contract.
unsafe {
macro_rules! cmpxchg {
($acquire:tt, $release:tt) => {
asm!(
"2:", // 'retry:
concat!("ld", $acquire, "exd r2, r3, [{dst}]"), // atomic { r2:r3 = *dst; EXCLUSIVE = dst }
"eor {tmp}, r3, {old_hi}", // tmp = r3 ^ old_hi
"eor r1, r2, {old_lo}", // r1 = r2 ^ old_lo
"orrs r1, {tmp}", // r1 |= tmp; if r1 == 0 { Z = 1 } else { Z = 0 }
"bne 3f", // if Z == 0 { jump 'cmp-fail }
concat!("st", $release, "exd r1, r4, r5, [{dst}]"), // atomic { if EXCLUSIVE == dst { *dst = r4:r5; r1 = 0 } else { r1 = 1 }; EXCLUSIVE = None }
cbz!("r1", "4f"), // if r1 == 0 { jump 'success }
"b 2b", // jump 'retry
"3:", // 'cmp-fail:
"clrex", // EXCLUSIVE = None
s!("mov", "r1, #1"), // r1 = 1
"4:", // 'success:
dst = in(reg) dst,
old_lo = in(reg) old.pair.lo,
old_hi = in(reg) old.pair.hi,
tmp = out(reg) _,
out("r1") r,
// prev pair - must be even-numbered and not R14
out("r2") prev_lo,
out("r3") prev_hi,
// new pair - must be even-numbered and not R14
in("r4") new.pair.lo,
in("r5") new.pair.hi,
// Do not use `preserves_flags` because ORRS, cbz!, and s! modify the condition flags.
options(nostack),
)
};
}
atomic_rmw!(cmpxchg, order);
crate::utils::assert_unchecked(r == 0 || r == 1); // may help remove extra test
// 0 if the store was successful, 1 if no store was performed
(MaybeUninit64 { pair: Pair { lo: prev_lo, hi: prev_hi } }.whole, r == 0)
}
}
#[inline]
unsafe fn atomic_compare_exchange_weak(
dst: *mut MaybeUninit<Self>,
old: MaybeUninit<Self>,
new: MaybeUninit<Self>,
success: Ordering,
failure: Ordering,
) -> (MaybeUninit<Self>, bool) {
debug_assert_atomic_unsafe_precondition!(dst, u64);
let order = crate::utils::upgrade_success_ordering(success, failure);
let old = MaybeUninit64 { whole: old };
let new = MaybeUninit64 { whole: new };
let (mut prev_lo, mut prev_hi);
let mut r: i32;
// SAFETY: the caller must uphold the safety contract.
unsafe {
macro_rules! cmpxchg_weak {
($acquire:tt, $release:tt) => {
asm!(
concat!("ld", $acquire, "exd r2, r3, [{dst}]"), // atomic { r2:r3 = *dst; EXCLUSIVE = dst }
"eor {tmp}, r3, {old_hi}", // tmp = r3 ^ old_hi
"eor {r}, r2, {old_lo}", // r = r2 ^ old_lo
"orrs {r}, {tmp}", // r |= tmp; if r == 0 { Z = 1 } else { Z = 0 }
"bne 3f", // if Z == 0 { jump 'cmp-fail }
concat!("st", $release, "exd {r}, r4, r5, [{dst}]"), // atomic { if EXCLUSIVE == dst { *dst = r4:r5; r = 0 } else { r = 1 }; EXCLUSIVE = None }
"b 4f", // jump 'success
"3:", // 'cmp-fail:
"clrex", // EXCLUSIVE = None
s!("mov", "{r}, #1"), // r = 1
"4:", // 'success:
dst = in(reg) dst,
old_lo = in(reg) old.pair.lo,
old_hi = in(reg) old.pair.hi,
r = out(reg) r,
tmp = out(reg) _,
// prev pair - must be even-numbered and not R14
out("r2") prev_lo,
out("r3") prev_hi,
// new pair - must be even-numbered and not R14
in("r4") new.pair.lo,
in("r5") new.pair.hi,
// Do not use `preserves_flags` because ORRS and s! modify the condition flags.
options(nostack),
)
};
}
atomic_rmw!(cmpxchg_weak, order);
crate::utils::assert_unchecked(r == 0 || r == 1); // may help remove extra test
// 0 if the store was successful, 1 if no store was performed
(MaybeUninit64 { pair: Pair { lo: prev_lo, hi: prev_hi } }.whole, r == 0)
}
}
}
// -----------------------------------------------------------------------------
// cfg macros
#[macro_export]
macro_rules! cfg_has_atomic_8 {
($($tt:tt)*) => { $($tt)* };
}
#[macro_export]
macro_rules! cfg_no_atomic_8 {
($($tt:tt)*) => {};
}
#[macro_export]
macro_rules! cfg_has_atomic_16 {
($($tt:tt)*) => { $($tt)* };
}
#[macro_export]
macro_rules! cfg_no_atomic_16 {
($($tt:tt)*) => {};
}
#[macro_export]
macro_rules! cfg_has_atomic_32 {
($($tt:tt)*) => { $($tt)* };
}
#[macro_export]
macro_rules! cfg_no_atomic_32 {
($($tt:tt)*) => {};
}
#[cfg(any(target_feature = "mclass", atomic_maybe_uninit_target_feature = "mclass"))]
#[macro_export]
macro_rules! cfg_has_atomic_64 {
($($tt:tt)*) => {};
}
#[cfg(any(target_feature = "mclass", atomic_maybe_uninit_target_feature = "mclass"))]
#[macro_export]
macro_rules! cfg_no_atomic_64 {
($($tt:tt)*) => { $($tt)* };
}
#[cfg(not(any(target_feature = "mclass", atomic_maybe_uninit_target_feature = "mclass")))]
#[macro_export]
macro_rules! cfg_has_atomic_64 {
($($tt:tt)*) => { $($tt)* };
}
#[cfg(not(any(target_feature = "mclass", atomic_maybe_uninit_target_feature = "mclass")))]
#[macro_export]
macro_rules! cfg_no_atomic_64 {
($($tt:tt)*) => {};
}
#[macro_export]
macro_rules! cfg_has_atomic_128 {
($($tt:tt)*) => {};
}
#[macro_export]
macro_rules! cfg_no_atomic_128 {
($($tt:tt)*) => { $($tt)* };
}
#[macro_export]
macro_rules! cfg_has_atomic_cas {
($($tt:tt)*) => { $($tt)* };
}
#[macro_export]
macro_rules! cfg_no_atomic_cas {
($($tt:tt)*) => {};
}