123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- typedef int32_t atomic32_t;
- typedef uint32_t uatomic32_t;
- typedef int_fast32_t atomic_fast32_t;
- typedef uint_fast32_t uatomic_fast32_t;
- typedef int64_t atomic64_t;
- typedef uint64_t uatomic64_t;
- typedef int_fast64_t atomic_fast64_t;
- typedef uint_fast64_t uatomic_fast64_t;
- typedef intptr_t atomicptr_t;
- typedef uintptr_t uatomicptr_t;
- typedef intmax_t atomic_max_t;
- typedef uintmax_t uatomic_max_t;
- (abort (), 0)
- (abort (), 0)
- (abort (), 0)
- (abort (), 0)
- ({__typeof__(*(mem)) __tmp, __value; \
- __asm__ __volatile__( \
- " memw \n" \
- "1: l32ex %0, %2 \n" \
- " bne %0, %4, 2f \n" \
- " mov %1, %3 \n" \
- " s32ex %1, %2 \n" \
- " getex %1 \n" \
- " beqz %1, 1b \n" \
- " memw \n" \
- "2: \n" \
- : "=&a" (__value), "=&a" (__tmp) \
- : "a" (mem), "a" (newval), "a" (oldval) \
- : "memory" ); \
- __value; \
- })
- ({__typeof__(*(mem)) __tmp, __value; \
- __asm__ __volatile__( \
- " memw \n" \
- "1: l32ex %0, %2 \n" \
- " sub %0, %4, %0 \n" \
- " bnez %0, 2f \n" \
- " mov %1, %3 \n" \
- " s32ex %1, %2 \n" \
- " getex %1 \n" \
- " beqz %1, 1b \n" \
- " movi %0, 0 \n" \
- " memw \n" \
- "2: \n" \
- : "=&a" (__value), "=&a" (__tmp) \
- : "a" (mem), "a" (newval), "a" (oldval) \
- : "memory" ); \
- __value != 0; \
- })
- ({__typeof__(*(mem)) __tmp, __value; \
- __asm__ __volatile__( \
- " memw \n" \
- "1: l32ex %0, %2 \n" \
- " mov %1, %3 \n" \
- " s32ex %1, %2 \n" \
- " getex %1 \n" \
- " beqz %1, 1b \n" \
- " memw \n" \
- : "=&a" (__value), "=&a" (__tmp) \
- : "a" (mem), "a" (newval) \
- : "memory" ); \
- __value; \
- })
- ({__typeof__(*(mem)) __tmp, __value; \
- __asm__ __volatile__( \
- " memw \n" \
- "1: l32ex %0, %2 \n" \
- " add %1, %0, %3 \n" \
- " s32ex %1, %2 \n" \
- " getex %1 \n" \
- " beqz %1, 1b \n" \
- " memw \n" \
- : "=&a" (__value), "=&a" (__tmp) \
- : "a" (mem), "a" (value) \
- : "memory" ); \
- __value; \
- })
- ({__typeof__(*(mem)) __tmp, __value; \
- __asm__ __volatile__( \
- " memw \n" \
- "1: l32ex %0, %2 \n" \
- " sub %1, %0, %3 \n" \
- " s32ex %1, %2 \n" \
- " getex %1 \n" \
- " beqz %1, 1b \n" \
- " memw \n" \
- : "=&a" (__value), "=&a" (__tmp) \
- : "a" (mem), "a" (value) \
- : "memory" ); \
- __tmp; \
- })
- ({__typeof__(*(mem)) __tmp, __value; \
- __asm__ __volatile__( \
- " memw \n" \
- "1: l32ex %0, %2 \n" \
- " blti %0, 1, 2f \n" \
- " addi %1, %0, -1 \n" \
- " s32ex %1, %2 \n" \
- " getex %1 \n" \
- " beqz %1, 1b \n" \
- " memw \n" \
- "2: \n" \
- : "=&a" (__value), "=&a" (__tmp) \
- : "a" (mem) \
- : "memory" ); \
- __value; \
- })
- ({__typeof__(*(mem)) __tmp, __value; \
- __asm__ __volatile__( \
- "1: l32i %1, %2 \n" \
- " bne %1, %4, 2f \n" \
- " wsr %1, SCOMPARE1 \n" \
- " mov %0, %1 \n" \
- " mov %1, %3 \n" \
- " s32c1i %1, %2 \n" \
- " bne %0, %1, 1b \n" \
- "2: \n" \
- : "=&a" (__value), "=&a" (__tmp), "+m" (*(mem)) \
- : "a" (newval), "a" (oldval) \
- : "memory" ); \
- __tmp; \
- })
- ({__typeof__(*(mem)) __tmp, __value; \
- __asm__ __volatile__( \
- "1: l32i %0, %2 \n" \
- " sub %1, %4, %0 \n" \
- " bnez %1, 2f \n" \
- " wsr %0, SCOMPARE1 \n" \
- " mov %1, %3 \n" \
- " s32c1i %1, %2 \n" \
- " bne %0, %1, 1b \n" \
- " movi %1, 0 \n" \
- "2: \n" \
- : "=&a" (__value), "=&a" (__tmp), "+m" (*(mem)) \
- : "a" (newval), "a" (oldval) \
- : "memory" ); \
- __tmp != 0; \
- })
- ({__typeof__(*(mem)) __tmp, __value; \
- __asm__ __volatile__( \
- "1: l32i %0, %2 \n" \
- " wsr %0, SCOMPARE1 \n" \
- " mov %1, %3 \n" \
- " s32c1i %1, %2 \n" \
- " bne %0, %1, 1b \n" \
- : "=&a" (__value), "=&a" (__tmp), "+m" (*(mem)) \
- : "a" (newval) \
- : "memory" ); \
- __tmp; \
- })
- ({__typeof__(*(mem)) __tmp, __value; \
- __asm__ __volatile__( \
- "1: l32i %0, %2 \n" \
- " wsr %0, SCOMPARE1 \n" \
- " add %1, %0, %3 \n" \
- " s32c1i %1, %2 \n" \
- " bne %0, %1, 1b \n" \
- : "=&a" (__value), "=&a" (__tmp), "+m" (*(mem)) \
- : "a" (value) \
- : "memory" ); \
- __tmp; \
- })
- ({__typeof__(*(mem)) __tmp, __value; \
- __asm__ __volatile__( \
- "1: l32i %0, %2 \n" \
- " wsr %0, SCOMPARE1 \n" \
- " sub %1, %0, %3 \n" \
- " s32c1i %1, %2 \n" \
- " bne %0, %1, 1b \n" \
- : "=&a" (__value), "=&a" (__tmp), "+m" (*(mem)) \
- : "a" (value) \
- : "memory" ); \
- __tmp; \
- })
- ({__typeof__(*(mem)) __tmp, __value; \
- __asm__ __volatile__( \
- "1: l32i %0, %2 \n" \
- " blti %0, 1, 2f \n" \
- " wsr %0, SCOMPARE1 \n" \
- " addi %1, %0, -1 \n" \
- " s32c1i %1, %2 \n" \
- " bne %0, %1, 1b \n" \
- "2: \n" \
- : "=&a" (__value), "=&a" (__tmp), "+m" (*(mem)) \
- :: "memory" ); \
- __value; \
- })
- ({ \
- if (sizeof (*mem) != 4) \
- abort(); \
- __arch_compare_and_exchange_val_32_acq(mem, newval, oldval); \
- })
- ({ \
- if (sizeof(*(mem)) != 4) \
- abort(); \
- __arch_exchange_32_acq(mem, newval); \
- })
- ({ \
- if (sizeof(*(mem)) != 4) \
- abort(); \
- __arch_atomic_exchange_and_add_32(mem, newval); \
- })
- ({ \
- if (sizeof(*(mem)) != 4) \
- abort(); \
- __arch_atomic_exchange_and_sub_32(mem, newval); \
- })
- ({ \
- if (sizeof(*(mem)) != 4) \
- abort(); \
- __arch_atomic_decrement_if_positive_32(mem); \
- })
- (abort (), 0)
- (abort (), (__typeof (*mem)) 0)
- (abort (), 0)
- (abort (), (__typeof (*mem)) 0)
- ({ abort (); (*mem) = (value); })
- ({ abort (); (*mem) = (value); })
- ({ abort (); (*mem) = (value); })
- ({ abort (); (*mem)++; })
- ({ abort (); (*mem)--; })
- ({ abort (); (*mem)--; })
|