tinycc/lib/atomic.S
kbkpbot 7f13f24e12
Some checks are pending
build and test / test-x86_64-linux (push) Waiting to run
build and test / test-x86_64-osx (push) Waiting to run
build and test / test-aarch64-osx (push) Waiting to run
build and test / test-x86-win32 (push) Waiting to run
build and test / test-armv7-linux (push) Waiting to run
build and test / test-aarch64-linux (push) Waiting to run
build and test / test-riscv64-linux (push) Waiting to run
Use asm implements some atomic functions
Use asm implements for i386/x86_64/arm/aarch64/riscv:

 __atomic_load_[1,2,4,8]
 __atomic_store_[1,2,4,8]
 __atomic_compare_exchange_[1,2,4,8]
 __atomic_test_and_set_[1,2,4,8]
 atomic_thread_fence
 atomic_signal_fence
 atomic_flag_test_and_set
 atomic_flag_test_and_set_explicit
 atomic_flag_clear
 atomic_flag_clear_explicit

`atomic.S` is extracted from `gcc` v15.1.0 `libatomic.a`.
And generated by https://github.com/kbkpbot/gen_atomic.git
2025-06-24 22:40:07 +08:00

2453 lines
63 KiB
ArmAsm

/* ---------------------------------------------- */
/* This file is extracted from `gcc` v15.1.0 `libatomic.a`. */
/* This file is generated by https://github.com/kbkpbot/gen_atomic.git */
/* This file is generated at 2025-06-24 21:37. */
/* This file implements for i386/x86_64/arm/aarch64/riscv:
* __atomic_load_[1,2,4,8]
* __atomic_store_[1,2,4,8]
* __atomic_compare_exchange_[1,2,4,8]
* __atomic_test_and_set_[1,2,4,8]
* atomic_thread_fence
* atomic_signal_fence
* atomic_flag_test_and_set
* atomic_flag_test_and_set_explicit
* atomic_flag_clear
* atomic_flag_clear_explicit
*/
#ifdef __leading_underscore
# define _(s) _##s
#else
# define _(s) s
#endif
/* ---------------------------------------------- */
#if defined __i386__
.text
.align 2
.global _(__atomic_load_1)
.type _(__atomic_load_1), %function
_(__atomic_load_1):
endbr32
mov 0x4(%esp),%eax
movzbl (%eax),%eax
ret
.size _(__atomic_load_1), .-_(__atomic_load_1)
.global _(__atomic_load_2)
.type _(__atomic_load_2), %function
_(__atomic_load_2):
endbr32
mov 0x4(%esp),%eax
movzwl (%eax),%eax
ret
.size _(__atomic_load_2), .-_(__atomic_load_2)
.global _(__atomic_load_4)
.type _(__atomic_load_4), %function
_(__atomic_load_4):
endbr32
mov 0x4(%esp),%eax
mov (%eax),%eax
ret
.size _(__atomic_load_4), .-_(__atomic_load_4)
.global _(__atomic_load_8)
.type _(__atomic_load_8), %function
_(__atomic_load_8):
endbr32
sub $0xc,%esp
mov 0x10(%esp),%eax
fildll (%eax)
fistpll (%esp)
mov (%esp),%eax
mov 0x4(%esp),%edx
add $0xc,%esp
ret
.size _(__atomic_load_8), .-_(__atomic_load_8)
.global _(__atomic_store_1)
.type _(__atomic_store_1), %function
_(__atomic_store_1):
endbr32
mov 0x4(%esp),%edx
mov 0x8(%esp),%eax
xchg %al,(%edx)
ret
.size _(__atomic_store_1), .-_(__atomic_store_1)
.global _(__atomic_store_2)
.type _(__atomic_store_2), %function
_(__atomic_store_2):
endbr32
mov 0x4(%esp),%edx
mov 0x8(%esp),%eax
xchg %ax,(%edx)
ret
.size _(__atomic_store_2), .-_(__atomic_store_2)
.global _(__atomic_store_4)
.type _(__atomic_store_4), %function
_(__atomic_store_4):
endbr32
mov 0x4(%esp),%edx
mov 0x8(%esp),%eax
xchg %eax,(%edx)
ret
.size _(__atomic_store_4), .-_(__atomic_store_4)
.global _(__atomic_store_8)
.type _(__atomic_store_8), %function
_(__atomic_store_8):
endbr32
push %ebx
sub $0x8,%esp
mov 0x18(%esp),%ebx
mov 0x14(%esp),%ecx
mov %ecx,(%esp)
mov %ebx,0x4(%esp)
fildll (%esp)
mov 0x10(%esp),%eax
fistpll (%eax)
lock orl $0x0,(%esp)
add $0x8,%esp
pop %ebx
ret
.size _(__atomic_store_8), .-_(__atomic_store_8)
.global _(__atomic_compare_exchange_1)
.type _(__atomic_compare_exchange_1), %function
_(__atomic_compare_exchange_1):
endbr32
push %ebx
mov 0xc(%esp),%ecx
mov 0x8(%esp),%edx
movzbl 0x10(%esp),%ebx
movzbl (%ecx),%eax
lock cmpxchg %bl,(%edx)
sete %dl
je .L___atomic_compare_exchange_1_020
mov %al,(%ecx)
.L___atomic_compare_exchange_1_020:
mov %edx,%eax
pop %ebx
ret
.size _(__atomic_compare_exchange_1), .-_(__atomic_compare_exchange_1)
.global _(__atomic_compare_exchange_2)
.type _(__atomic_compare_exchange_2), %function
_(__atomic_compare_exchange_2):
endbr32
push %ebx
mov 0xc(%esp),%ecx
mov 0x8(%esp),%edx
movzwl 0x10(%esp),%ebx
movzwl (%ecx),%eax
lock cmpxchg %bx,(%edx)
sete %dl
je .L___atomic_compare_exchange_2_022
mov %ax,(%ecx)
.L___atomic_compare_exchange_2_022:
mov %edx,%eax
pop %ebx
ret
.size _(__atomic_compare_exchange_2), .-_(__atomic_compare_exchange_2)
.global _(__atomic_compare_exchange_4)
.type _(__atomic_compare_exchange_4), %function
_(__atomic_compare_exchange_4):
endbr32
push %ebx
mov 0xc(%esp),%ecx
mov 0x8(%esp),%edx
mov 0x10(%esp),%ebx
mov (%ecx),%eax
lock cmpxchg %ebx,(%edx)
sete %dl
je .L___atomic_compare_exchange_4_01e
mov %eax,(%ecx)
.L___atomic_compare_exchange_4_01e:
mov %edx,%eax
pop %ebx
ret
.size _(__atomic_compare_exchange_4), .-_(__atomic_compare_exchange_4)
.global _(__atomic_compare_exchange_8)
.type _(__atomic_compare_exchange_8), %function
_(__atomic_compare_exchange_8):
endbr32
push %edi
push %esi
push %ebx
mov 0x14(%esp),%esi
mov 0x1c(%esp),%ecx
mov 0x10(%esp),%edi
mov (%esi),%eax
mov 0x4(%esi),%edx
mov 0x18(%esp),%ebx
lock cmpxchg8b (%edi)
sete %cl
je .L___atomic_compare_exchange_8_02a
mov %eax,(%esi)
mov %edx,0x4(%esi)
.L___atomic_compare_exchange_8_02a:
pop %ebx
mov %ecx,%eax
pop %esi
pop %edi
ret
.size _(__atomic_compare_exchange_8), .-_(__atomic_compare_exchange_8)
.global _(__atomic_test_and_set_1)
.type _(__atomic_test_and_set_1), %function
_(__atomic_test_and_set_1):
endbr32
mov 0x4(%esp),%edx
mov $0x1,%eax
xchg %al,(%edx)
ret
.size _(__atomic_test_and_set_1), .-_(__atomic_test_and_set_1)
.global _(__atomic_test_and_set_2)
.type _(__atomic_test_and_set_2), %function
_(__atomic_test_and_set_2):
endbr32
mov 0x4(%esp),%edx
mov $0x1,%eax
xchg %al,(%edx)
ret
.size _(__atomic_test_and_set_2), .-_(__atomic_test_and_set_2)
.global _(__atomic_test_and_set_4)
.type _(__atomic_test_and_set_4), %function
_(__atomic_test_and_set_4):
endbr32
mov 0x4(%esp),%edx
mov $0x1,%eax
xchg %al,(%edx)
ret
.size _(__atomic_test_and_set_4), .-_(__atomic_test_and_set_4)
.global _(__atomic_test_and_set_8)
.type _(__atomic_test_and_set_8), %function
_(__atomic_test_and_set_8):
endbr32
mov 0x4(%esp),%edx
mov $0x1,%eax
xchg %al,(%edx)
ret
.size _(__atomic_test_and_set_8), .-_(__atomic_test_and_set_8)
.global _(atomic_thread_fence)
.type _(atomic_thread_fence), %function
_(atomic_thread_fence):
endbr32
lock orl $0x0,(%esp)
ret
.size _(atomic_thread_fence), .-_(atomic_thread_fence)
.global _(atomic_signal_fence)
.type _(atomic_signal_fence), %function
_(atomic_signal_fence):
endbr32
ret
.size _(atomic_signal_fence), .-_(atomic_signal_fence)
.global _(atomic_flag_test_and_set)
.type _(atomic_flag_test_and_set), %function
_(atomic_flag_test_and_set):
endbr32
mov 0x4(%esp),%edx
mov $0x1,%eax
xchg %al,(%edx)
ret
.size _(atomic_flag_test_and_set), .-_(atomic_flag_test_and_set)
.global _(atomic_flag_test_and_set_explicit)
.type _(atomic_flag_test_and_set_explicit), %function
_(atomic_flag_test_and_set_explicit):
endbr32
mov 0x4(%esp),%edx
mov $0x1,%eax
xchg %al,(%edx)
ret
.size _(atomic_flag_test_and_set_explicit), .-_(atomic_flag_test_and_set_explicit)
.global _(atomic_flag_clear)
.type _(atomic_flag_clear), %function
_(atomic_flag_clear):
endbr32
mov 0x4(%esp),%edx
xor %eax,%eax
xchg %al,(%edx)
ret
.size _(atomic_flag_clear), .-_(atomic_flag_clear)
.global _(atomic_flag_clear_explicit)
.type _(atomic_flag_clear_explicit), %function
_(atomic_flag_clear_explicit):
endbr32
mov 0x4(%esp),%edx
xor %eax,%eax
xchg %al,(%edx)
ret
.size _(atomic_flag_clear_explicit), .-_(atomic_flag_clear_explicit)
#endif //__i386__
/* ---------------------------------------------- */
#if defined __x86_64__
.text
.align 2
.global _(__atomic_load_1)
.type _(__atomic_load_1), %function
_(__atomic_load_1):
endbr64
movzbl (%rdi),%eax
ret
.size _(__atomic_load_1), .-_(__atomic_load_1)
.global _(__atomic_load_2)
.type _(__atomic_load_2), %function
_(__atomic_load_2):
endbr64
movzwl (%rdi),%eax
ret
.size _(__atomic_load_2), .-_(__atomic_load_2)
.global _(__atomic_load_4)
.type _(__atomic_load_4), %function
_(__atomic_load_4):
endbr64
mov (%rdi),%eax
ret
.size _(__atomic_load_4), .-_(__atomic_load_4)
.global _(__atomic_load_8)
.type _(__atomic_load_8), %function
_(__atomic_load_8):
endbr64
mov (%rdi),%rax
ret
.size _(__atomic_load_8), .-_(__atomic_load_8)
.global _(__atomic_store_1)
.type _(__atomic_store_1), %function
_(__atomic_store_1):
endbr64
xchg %sil,(%rdi)
ret
.size _(__atomic_store_1), .-_(__atomic_store_1)
.global _(__atomic_store_2)
.type _(__atomic_store_2), %function
_(__atomic_store_2):
endbr64
xchg %si,(%rdi)
ret
.size _(__atomic_store_2), .-_(__atomic_store_2)
.global _(__atomic_store_4)
.type _(__atomic_store_4), %function
_(__atomic_store_4):
endbr64
xchg %esi,(%rdi)
ret
.size _(__atomic_store_4), .-_(__atomic_store_4)
.global _(__atomic_store_8)
.type _(__atomic_store_8), %function
_(__atomic_store_8):
endbr64
xchg %rsi,(%rdi)
ret
.size _(__atomic_store_8), .-_(__atomic_store_8)
.global _(__atomic_compare_exchange_1)
.type _(__atomic_compare_exchange_1), %function
_(__atomic_compare_exchange_1):
endbr64
movzbl (%rsi),%eax
lock cmpxchg %dl,(%rdi)
sete %dl
je .L___atomic_compare_exchange_1_012
mov %al,(%rsi)
.L___atomic_compare_exchange_1_012:
mov %edx,%eax
ret
.size _(__atomic_compare_exchange_1), .-_(__atomic_compare_exchange_1)
.global _(__atomic_compare_exchange_2)
.type _(__atomic_compare_exchange_2), %function
_(__atomic_compare_exchange_2):
endbr64
movzwl (%rsi),%eax
lock cmpxchg %dx,(%rdi)
sete %dl
je .L___atomic_compare_exchange_2_014
mov %ax,(%rsi)
.L___atomic_compare_exchange_2_014:
mov %edx,%eax
ret
.size _(__atomic_compare_exchange_2), .-_(__atomic_compare_exchange_2)
.global _(__atomic_compare_exchange_4)
.type _(__atomic_compare_exchange_4), %function
_(__atomic_compare_exchange_4):
endbr64
mov (%rsi),%eax
lock cmpxchg %edx,(%rdi)
sete %dl
je .L___atomic_compare_exchange_4_011
mov %eax,(%rsi)
.L___atomic_compare_exchange_4_011:
mov %edx,%eax
ret
.size _(__atomic_compare_exchange_4), .-_(__atomic_compare_exchange_4)
.global _(__atomic_compare_exchange_8)
.type _(__atomic_compare_exchange_8), %function
_(__atomic_compare_exchange_8):
endbr64
mov (%rsi),%rax
lock cmpxchg %rdx,(%rdi)
sete %dl
je .L___atomic_compare_exchange_8_014
mov %rax,(%rsi)
.L___atomic_compare_exchange_8_014:
mov %edx,%eax
ret
.size _(__atomic_compare_exchange_8), .-_(__atomic_compare_exchange_8)
.global _(__atomic_test_and_set_1)
.type _(__atomic_test_and_set_1), %function
_(__atomic_test_and_set_1):
endbr64
mov $0x1,%eax
xchg %al,(%rdi)
ret
.size _(__atomic_test_and_set_1), .-_(__atomic_test_and_set_1)
.global _(__atomic_test_and_set_2)
.type _(__atomic_test_and_set_2), %function
_(__atomic_test_and_set_2):
endbr64
mov $0x1,%eax
xchg %al,(%rdi)
ret
.size _(__atomic_test_and_set_2), .-_(__atomic_test_and_set_2)
.global _(__atomic_test_and_set_4)
.type _(__atomic_test_and_set_4), %function
_(__atomic_test_and_set_4):
endbr64
mov $0x1,%eax
xchg %al,(%rdi)
ret
.size _(__atomic_test_and_set_4), .-_(__atomic_test_and_set_4)
.global _(__atomic_test_and_set_8)
.type _(__atomic_test_and_set_8), %function
_(__atomic_test_and_set_8):
endbr64
mov $0x1,%eax
xchg %al,(%rdi)
ret
.size _(__atomic_test_and_set_8), .-_(__atomic_test_and_set_8)
.global _(atomic_thread_fence)
.type _(atomic_thread_fence), %function
_(atomic_thread_fence):
endbr64
lock orq $0x0,(%rsp)
ret
.size _(atomic_thread_fence), .-_(atomic_thread_fence)
.global _(atomic_signal_fence)
.type _(atomic_signal_fence), %function
_(atomic_signal_fence):
endbr64
ret
.size _(atomic_signal_fence), .-_(atomic_signal_fence)
.global _(atomic_flag_test_and_set)
.type _(atomic_flag_test_and_set), %function
_(atomic_flag_test_and_set):
endbr64
mov $0x1,%eax
xchg %al,(%rdi)
ret
.size _(atomic_flag_test_and_set), .-_(atomic_flag_test_and_set)
.global _(atomic_flag_test_and_set_explicit)
.type _(atomic_flag_test_and_set_explicit), %function
_(atomic_flag_test_and_set_explicit):
endbr64
mov $0x1,%eax
xchg %al,(%rdi)
ret
.size _(atomic_flag_test_and_set_explicit), .-_(atomic_flag_test_and_set_explicit)
.global _(atomic_flag_clear)
.type _(atomic_flag_clear), %function
_(atomic_flag_clear):
endbr64
xor %eax,%eax
xchg %al,(%rdi)
ret
.size _(atomic_flag_clear), .-_(atomic_flag_clear)
.global _(atomic_flag_clear_explicit)
.type _(atomic_flag_clear_explicit), %function
_(atomic_flag_clear_explicit):
endbr64
xor %eax,%eax
xchg %al,(%rdi)
ret
.size _(atomic_flag_clear_explicit), .-_(atomic_flag_clear_explicit)
#endif //__x86_64__
/* ---------------------------------------------- */
#if defined __arm__
.text
.align 2
.thumb
.syntax unified
.global _(__atomic_load_1)
.type _(__atomic_load_1), %function
_(__atomic_load_1):
#ifdef __TINYC__
.short 0xb911
.short 0x7800
.short 0xb2c0
.short 0x4770
.short 0xf3bf
.short 0x7800
.short 0xf3bf
.short 0xb2c0
.short 0x4770
#else
cbnz r1, .L___atomic_load_1_008
ldrb r0, [r0, #0]
uxtb r0, r0
bx lr
.L___atomic_load_1_008:
dmb ish
ldrb r0, [r0, #0]
dmb ish
uxtb r0, r0
bx lr
.size _(__atomic_load_1), .-_(__atomic_load_1)
#endif
.global _(__atomic_load_2)
.type _(__atomic_load_2), %function
_(__atomic_load_2):
#ifdef __TINYC__
.short 0xb911
.short 0x8800
.short 0xb280
.short 0x4770
.short 0xf3bf
.short 0x8800
.short 0xf3bf
.short 0xb280
.short 0x4770
#else
cbnz r1, .L___atomic_load_2_008
ldrh r0, [r0, #0]
uxth r0, r0
bx lr
.L___atomic_load_2_008:
dmb ish
ldrh r0, [r0, #0]
dmb ish
uxth r0, r0
bx lr
.size _(__atomic_load_2), .-_(__atomic_load_2)
#endif
.global _(__atomic_load_4)
.type _(__atomic_load_4), %function
_(__atomic_load_4):
#ifdef __TINYC__
.short 0xb909
.short 0x6800
.short 0x4770
.short 0xf3bf
.short 0x6800
.short 0xf3bf
.short 0x4770
#else
cbnz r1, .L___atomic_load_4_006
ldr r0, [r0, #0]
bx lr
.L___atomic_load_4_006:
dmb ish
ldr r0, [r0, #0]
dmb ish
bx lr
.size _(__atomic_load_4), .-_(__atomic_load_4)
#endif
.global _(__atomic_load_8)
.type _(__atomic_load_8), %function
_(__atomic_load_8):
#ifdef __TINYC__
.short 0xb911
.short 0xe8d0
.short 0x4770
.short 0xf3bf
.short 0xe8d0
.short 0xf3bf
.short 0x4770
#else
cbnz r1, .L___atomic_load_8_008
ldrexd r0, r1, [r0]
bx lr
.L___atomic_load_8_008:
dmb ish
ldrexd r0, r1, [r0]
dmb ish
bx lr
.size _(__atomic_load_8), .-_(__atomic_load_8)
#endif
.global _(__atomic_store_1)
.type _(__atomic_store_1), %function
_(__atomic_store_1):
#ifdef __TINYC__
.short 0xb90a
.short 0x7001
.short 0x4770
.short 0xf3bf
.short 0x7001
.short 0xf3bf
.short 0x4770
#else
cbnz r2, .L___atomic_store_1_006
strb r1, [r0, #0]
bx lr
.L___atomic_store_1_006:
dmb ish
strb r1, [r0, #0]
dmb ish
bx lr
.size _(__atomic_store_1), .-_(__atomic_store_1)
#endif
.global _(__atomic_store_2)
.type _(__atomic_store_2), %function
_(__atomic_store_2):
#ifdef __TINYC__
.short 0xb90a
.short 0x8001
.short 0x4770
.short 0xf3bf
.short 0x8001
.short 0xf3bf
.short 0x4770
#else
cbnz r2, .L___atomic_store_2_006
strh r1, [r0, #0]
bx lr
.L___atomic_store_2_006:
dmb ish
strh r1, [r0, #0]
dmb ish
bx lr
.size _(__atomic_store_2), .-_(__atomic_store_2)
#endif
.global _(__atomic_store_4)
.type _(__atomic_store_4), %function
_(__atomic_store_4):
#ifdef __TINYC__
.short 0xb90a
.short 0x6001
.short 0x4770
.short 0xf3bf
.short 0x6001
.short 0xf3bf
.short 0x4770
#else
cbnz r2, .L___atomic_store_4_006
str r1, [r0, #0]
bx lr
.L___atomic_store_4_006:
dmb ish
str r1, [r0, #0]
dmb ish
bx lr
.size _(__atomic_store_4), .-_(__atomic_store_4)
#endif
.global _(__atomic_store_8)
.type _(__atomic_store_8), %function
_(__atomic_store_8):
#ifdef __TINYC__
.short 0xb430
.short 0x4614
.short 0x9902
.short 0x461d
.short 0xb939
.short 0xe8d0
.short 0xe8c0
.short 0x2900
.short 0xd1f9
.short 0xbc30
.short 0x4770
.short 0xf3bf
.short 0xe8d0
.short 0xe8c0
.short 0x2900
.short 0xd1f9
.short 0xf3bf
.short 0xbc30
.short 0x4770
#else
push {r4, r5}
mov r4, r2
ldr r1, [sp, #8]
mov r5, r3
cbnz r1, .L___atomic_store_8_01a
.L___atomic_store_8_00a:
ldrexd r2, r3, [r0]
strexd r1, r4, r5, [r0]
cmp r1, #0
bne.n .L___atomic_store_8_00a
pop {r4, r5}
bx lr
.L___atomic_store_8_01a:
dmb ish
.L___atomic_store_8_01e:
ldrexd r2, r3, [r0]
strexd r1, r4, r5, [r0]
cmp r1, #0
bne.n .L___atomic_store_8_01e
dmb ish
pop {r4, r5}
bx lr
.size _(__atomic_store_8), .-_(__atomic_store_8)
#endif
.global _(__atomic_compare_exchange_1)
.type _(__atomic_compare_exchange_1), %function
_(__atomic_compare_exchange_1):
#ifdef __TINYC__
.short 0xb500
.short 0xb983
.short 0x780b
.short 0xe8d0
.short 0x459c
.short 0xd104
.short 0xe8c0
.short 0xf1be
.short 0xd1f6
.short 0xbf0e
.short 0x2001
.short 0x2000
.short 0xf881
.short 0xf85d
.short 0x780b
.short 0xf3bf
.short 0xe8d0
.short 0x459c
.short 0xd1f1
.short 0xe8c0
.short 0xf1be
.short 0xd1f6
.short 0xf3bf
.short 0xe7e9
#else
push {lr}
cbnz r3, .L___atomic_compare_exchange_1_026
ldrb r3, [r1, #0]
.L___atomic_compare_exchange_1_006:
ldrexb ip, [r0]
cmp ip, r3
bne.n .L___atomic_compare_exchange_1_018
strexb lr, r2, [r0]
cmp.w lr, #0
bne.n .L___atomic_compare_exchange_1_006
.L___atomic_compare_exchange_1_018:
itee eq
moveq r0, #1
movne r0, #0
strbne.w ip, [r1]
ldr.w pc, [sp], #4
.L___atomic_compare_exchange_1_026:
ldrb r3, [r1, #0]
dmb ish
.L___atomic_compare_exchange_1_02c:
ldrexb ip, [r0]
cmp ip, r3
bne.n .L___atomic_compare_exchange_1_018
strexb lr, r2, [r0]
cmp.w lr, #0
bne.n .L___atomic_compare_exchange_1_02c
dmb ish
b.n .L___atomic_compare_exchange_1_018
.size _(__atomic_compare_exchange_1), .-_(__atomic_compare_exchange_1)
#endif
.global _(__atomic_compare_exchange_2)
.type _(__atomic_compare_exchange_2), %function
_(__atomic_compare_exchange_2):
#ifdef __TINYC__
.short 0xb500
.short 0xb983
.short 0x880b
.short 0xe8d0
.short 0x459c
.short 0xd104
.short 0xe8c0
.short 0xf1be
.short 0xd1f6
.short 0xbf0e
.short 0x2001
.short 0x2000
.short 0xf8a1
.short 0xf85d
.short 0x880b
.short 0xf3bf
.short 0xe8d0
.short 0x459c
.short 0xd1f1
.short 0xe8c0
.short 0xf1be
.short 0xd1f6
.short 0xf3bf
.short 0xe7e9
#else
push {lr}
cbnz r3, .L___atomic_compare_exchange_2_026
ldrh r3, [r1, #0]
.L___atomic_compare_exchange_2_006:
ldrexh ip, [r0]
cmp ip, r3
bne.n .L___atomic_compare_exchange_2_018
strexh lr, r2, [r0]
cmp.w lr, #0
bne.n .L___atomic_compare_exchange_2_006
.L___atomic_compare_exchange_2_018:
itee eq
moveq r0, #1
movne r0, #0
strhne.w ip, [r1]
ldr.w pc, [sp], #4
.L___atomic_compare_exchange_2_026:
ldrh r3, [r1, #0]
dmb ish
.L___atomic_compare_exchange_2_02c:
ldrexh ip, [r0]
cmp ip, r3
bne.n .L___atomic_compare_exchange_2_018
strexh lr, r2, [r0]
cmp.w lr, #0
bne.n .L___atomic_compare_exchange_2_02c
dmb ish
b.n .L___atomic_compare_exchange_2_018
.size _(__atomic_compare_exchange_2), .-_(__atomic_compare_exchange_2)
#endif
.global _(__atomic_compare_exchange_4)
.type _(__atomic_compare_exchange_4), %function
_(__atomic_compare_exchange_4):
#ifdef __TINYC__
.short 0xb410
.short 0xb983
.short 0x680b
.short 0xe850
.short 0x429c
.short 0xd104
.short 0xe840
.short 0xf1bc
.short 0xd1f6
.short 0xbf0e
.short 0x2001
.short 0x2000
.short 0x600c
.short 0xf85d
.short 0x4770
.short 0x680b
.short 0xf3bf
.short 0xe850
.short 0x429c
.short 0xd1f1
.short 0xe840
.short 0xf1bc
.short 0xd1f6
.short 0xf3bf
.short 0xe7e9
#else
push {r4}
cbnz r3, .L___atomic_compare_exchange_4_026
ldr r3, [r1, #0]
.L___atomic_compare_exchange_4_006:
ldrex r4, [r0]
cmp r4, r3
bne.n .L___atomic_compare_exchange_4_018
strex ip, r2, [r0]
cmp.w ip, #0
bne.n .L___atomic_compare_exchange_4_006
.L___atomic_compare_exchange_4_018:
itee eq
moveq r0, #1
movne r0, #0
strne r4, [r1, #0]
ldr.w r4, [sp], #4
bx lr
.L___atomic_compare_exchange_4_026:
ldr r3, [r1, #0]
dmb ish
.L___atomic_compare_exchange_4_02c:
ldrex r4, [r0]
cmp r4, r3
bne.n .L___atomic_compare_exchange_4_018
strex ip, r2, [r0]
cmp.w ip, #0
bne.n .L___atomic_compare_exchange_4_02c
dmb ish
b.n .L___atomic_compare_exchange_4_018
.size _(__atomic_compare_exchange_4), .-_(__atomic_compare_exchange_4)
#endif
.global _(__atomic_compare_exchange_8)
.type _(__atomic_compare_exchange_8), %function
_(__atomic_compare_exchange_8):
#ifdef __TINYC__
.short 0xb4f0
.short 0x461d
.short 0x9b04
.short 0x4614
.short 0xb99b
.short 0xe9d1
.short 0xe8d0
.short 0x429f
.short 0xbf08
.short 0x4296
.short 0xd104
.short 0xe8c0
.short 0xf1bc
.short 0xd1f4
.short 0xbf0e
.short 0x2001
.short 0x2000
.short 0xe9c1
.short 0xbcf0
.short 0x4770
.short 0xe9d1
.short 0xf3bf
.short 0xe8d0
.short 0x429f
.short 0xbf08
.short 0x4296
.short 0xd1ee
.short 0xe8c0
.short 0xf1bc
.short 0xd1f4
.short 0xf3bf
.short 0xe7e6
#else
push {r4, r5, r6, r7}
mov r5, r3
ldr r3, [sp, #16]
mov r4, r2
cbnz r3, .L___atomic_compare_exchange_8_032
ldrd r2, r3, [r1]
.L___atomic_compare_exchange_8_00e:
ldrexd r6, r7, [r0]
cmp r7, r3
it eq
cmpeq r6, r2
bne.n .L___atomic_compare_exchange_8_024
strexd ip, r4, r5, [r0]
cmp.w ip, #0
bne.n .L___atomic_compare_exchange_8_00e
.L___atomic_compare_exchange_8_024:
itee eq
moveq r0, #1
movne r0, #0
strdne r6, r7, [r1]
pop {r4, r5, r6, r7}
bx lr
.L___atomic_compare_exchange_8_032:
ldrd r2, r3, [r1]
dmb ish
.L___atomic_compare_exchange_8_03a:
ldrexd r6, r7, [r0]
cmp r7, r3
it eq
cmpeq r6, r2
bne.n .L___atomic_compare_exchange_8_024
strexd ip, r4, r5, [r0]
cmp.w ip, #0
bne.n .L___atomic_compare_exchange_8_03a
dmb ish
b.n .L___atomic_compare_exchange_8_024
.size _(__atomic_compare_exchange_8), .-_(__atomic_compare_exchange_8)
#endif
.global _(__atomic_test_and_set_1)
.type _(__atomic_test_and_set_1), %function
_(__atomic_test_and_set_1):
#ifdef __TINYC__
.short 0xf04f
.short 0xb939
.short 0xe8d0
.short 0xe8c0
.short 0x2900
.short 0xd1f9
.short 0xb2d8
.short 0x4770
.short 0xf3bf
.short 0xe8d0
.short 0xe8c0
.short 0x2900
.short 0xd1f9
.short 0xb2d8
.short 0xf3bf
.short 0x4770
#else
mov.w r2, #1
cbnz r1, .L___atomic_test_and_set_1_016
.L___atomic_test_and_set_1_006:
ldrexb r3, [r0]
strexb r1, r2, [r0]
cmp r1, #0
bne.n .L___atomic_test_and_set_1_006
uxtb r0, r3
bx lr
.L___atomic_test_and_set_1_016:
dmb ish
.L___atomic_test_and_set_1_01a:
ldrexb r3, [r0]
strexb r1, r2, [r0]
cmp r1, #0
bne.n .L___atomic_test_and_set_1_01a
uxtb r0, r3
dmb ish
bx lr
.size _(__atomic_test_and_set_1), .-_(__atomic_test_and_set_1)
#endif
.global _(__atomic_test_and_set_2)
.type _(__atomic_test_and_set_2), %function
_(__atomic_test_and_set_2):
#ifdef __TINYC__
.short 0xf04f
.short 0xb939
.short 0xe8d0
.short 0xe8c0
.short 0x2900
.short 0xd1f9
.short 0xb2d8
.short 0x4770
.short 0xf3bf
.short 0xe8d0
.short 0xe8c0
.short 0x2900
.short 0xd1f9
.short 0xb2d8
.short 0xf3bf
.short 0x4770
#else
mov.w r2, #1
cbnz r1, .L___atomic_test_and_set_2_016
.L___atomic_test_and_set_2_006:
ldrexb r3, [r0]
strexb r1, r2, [r0]
cmp r1, #0
bne.n .L___atomic_test_and_set_2_006
uxtb r0, r3
bx lr
.L___atomic_test_and_set_2_016:
dmb ish
.L___atomic_test_and_set_2_01a:
ldrexb r3, [r0]
strexb r1, r2, [r0]
cmp r1, #0
bne.n .L___atomic_test_and_set_2_01a
uxtb r0, r3
dmb ish
bx lr
.size _(__atomic_test_and_set_2), .-_(__atomic_test_and_set_2)
#endif
.global _(__atomic_test_and_set_4)
.type _(__atomic_test_and_set_4), %function
_(__atomic_test_and_set_4):
#ifdef __TINYC__
.short 0xf04f
.short 0xb939
.short 0xe8d0
.short 0xe8c0
.short 0x2900
.short 0xd1f9
.short 0xb2d8
.short 0x4770
.short 0xf3bf
.short 0xe8d0
.short 0xe8c0
.short 0x2900
.short 0xd1f9
.short 0xb2d8
.short 0xf3bf
.short 0x4770
#else
mov.w r2, #1
cbnz r1, .L___atomic_test_and_set_4_016
.L___atomic_test_and_set_4_006:
ldrexb r3, [r0]
strexb r1, r2, [r0]
cmp r1, #0
bne.n .L___atomic_test_and_set_4_006
uxtb r0, r3
bx lr
.L___atomic_test_and_set_4_016:
dmb ish
.L___atomic_test_and_set_4_01a:
ldrexb r3, [r0]
strexb r1, r2, [r0]
cmp r1, #0
bne.n .L___atomic_test_and_set_4_01a
uxtb r0, r3
dmb ish
bx lr
.size _(__atomic_test_and_set_4), .-_(__atomic_test_and_set_4)
#endif
.global _(__atomic_test_and_set_8)
.type _(__atomic_test_and_set_8), %function
_(__atomic_test_and_set_8):
#ifdef __TINYC__
.short 0xf04f
.short 0xb939
.short 0xe8d0
.short 0xe8c0
.short 0x2900
.short 0xd1f9
.short 0xb2d8
.short 0x4770
.short 0xf3bf
.short 0xe8d0
.short 0xe8c0
.short 0x2900
.short 0xd1f9
.short 0xb2d8
.short 0xf3bf
.short 0x4770
#else
mov.w r2, #1
cbnz r1, .L___atomic_test_and_set_8_016
.L___atomic_test_and_set_8_006:
ldrexb r3, [r0]
strexb r1, r2, [r0]
cmp r1, #0
bne.n .L___atomic_test_and_set_8_006
uxtb r0, r3
bx lr
.L___atomic_test_and_set_8_016:
dmb ish
.L___atomic_test_and_set_8_01a:
ldrexb r3, [r0]
strexb r1, r2, [r0]
cmp r1, #0
bne.n .L___atomic_test_and_set_8_01a
uxtb r0, r3
dmb ish
bx lr
.size _(__atomic_test_and_set_8), .-_(__atomic_test_and_set_8)
#endif
.global _(atomic_thread_fence)
.type _(atomic_thread_fence), %function
_(atomic_thread_fence):
#ifdef __TINYC__
.short 0xf3bf
.short 0x4770
#else
dmb ish
bx lr
.size _(atomic_thread_fence), .-_(atomic_thread_fence)
#endif
.global _(atomic_signal_fence)
.type _(atomic_signal_fence), %function
_(atomic_signal_fence):
#ifdef __TINYC__
.short 0x4770
#else
bx lr
.size _(atomic_signal_fence), .-_(atomic_signal_fence)
#endif
.global _(atomic_flag_test_and_set)
.type _(atomic_flag_test_and_set), %function
_(atomic_flag_test_and_set):
#ifdef __TINYC__
.short 0xf04f
.short 0xf3bf
.short 0xe8d0
.short 0xe8c0
.short 0x2900
.short 0xd1f9
.short 0xb2d8
.short 0xf3bf
.short 0x4770
#else
mov.w r2, #1
dmb ish
.L_atomic_flag_test_and_set_008:
ldrexb r3, [r0]
strexb r1, r2, [r0]
cmp r1, #0
bne.n .L_atomic_flag_test_and_set_008
uxtb r0, r3
dmb ish
bx lr
.size _(atomic_flag_test_and_set), .-_(atomic_flag_test_and_set)
#endif
.global _(atomic_flag_test_and_set_explicit)
.type _(atomic_flag_test_and_set_explicit), %function
_(atomic_flag_test_and_set_explicit):
#ifdef __TINYC__
.short 0xf04f
.short 0xf3bf
.short 0xe8d0
.short 0xe8c0
.short 0x2900
.short 0xd1f9
.short 0xb2d8
.short 0xf3bf
.short 0x4770
#else
mov.w r2, #1
dmb ish
.L_atomic_flag_test_and_set_explicit_024:
ldrexb r3, [r0]
strexb r1, r2, [r0]
cmp r1, #0
bne.n .L_atomic_flag_test_and_set_explicit_024
uxtb r0, r3
dmb ish
bx lr
.size _(atomic_flag_test_and_set_explicit), .-_(atomic_flag_test_and_set_explicit)
#endif
.global _(atomic_flag_clear)
.type _(atomic_flag_clear), %function
_(atomic_flag_clear):
#ifdef __TINYC__
.short 0x2300
.short 0xf3bf
.short 0x7003
.short 0xf3bf
.short 0x4770
#else
movs r3, #0
dmb ish
strb r3, [r0, #0]
dmb ish
bx lr
.size _(atomic_flag_clear), .-_(atomic_flag_clear)
#endif
.global _(atomic_flag_clear_explicit)
.type _(atomic_flag_clear_explicit), %function
_(atomic_flag_clear_explicit):
#ifdef __TINYC__
.short 0x2300
.short 0xf3bf
.short 0x7003
.short 0xf3bf
.short 0x4770
#else
movs r3, #0
dmb ish
strb r3, [r0, #0]
dmb ish
bx lr
.size _(atomic_flag_clear_explicit), .-_(atomic_flag_clear_explicit)
#endif
#endif //__arm__
/* ---------------------------------------------- */
#if defined __aarch64__
.text
.align 2
.global _(__atomic_load_1)
.type _(__atomic_load_1), %function
_(__atomic_load_1):
#ifdef __TINYC__
.int 0x35000081
.int 0x39400000
.int 0x12001c00
.int 0xd65f03c0
.int 0x08dffc00
.int 0x12001c00
.int 0xd65f03c0
#else
cbnz w1, .L___atomic_load_1_010
ldrb w0, [x0]
and w0, w0, #0xff
ret
.L___atomic_load_1_010:
ldarb w0, [x0]
and w0, w0, #0xff
ret
.size _(__atomic_load_1), .-_(__atomic_load_1)
#endif
.global _(__atomic_load_2)
.type _(__atomic_load_2), %function
_(__atomic_load_2):
#ifdef __TINYC__
.int 0x35000081
.int 0x79400000
.int 0x12003c00
.int 0xd65f03c0
.int 0x48dffc00
.int 0x12003c00
.int 0xd65f03c0
#else
cbnz w1, .L___atomic_load_2_010
ldrh w0, [x0]
and w0, w0, #0xffff
ret
.L___atomic_load_2_010:
ldarh w0, [x0]
and w0, w0, #0xffff
ret
.size _(__atomic_load_2), .-_(__atomic_load_2)
#endif
.global _(__atomic_load_4)
.type _(__atomic_load_4), %function
_(__atomic_load_4):
#ifdef __TINYC__
.int 0x35000061
.int 0xb9400000
.int 0xd65f03c0
.int 0x88dffc00
.int 0xd65f03c0
#else
cbnz w1, .L___atomic_load_4_00c
ldr w0, [x0]
ret
.L___atomic_load_4_00c:
ldar w0, [x0]
ret
.size _(__atomic_load_4), .-_(__atomic_load_4)
#endif
.global _(__atomic_load_8)
.type _(__atomic_load_8), %function
_(__atomic_load_8):
#ifdef __TINYC__
.int 0x35000061
.int 0xf9400000
.int 0xd65f03c0
.int 0xc8dffc00
.int 0xd65f03c0
#else
cbnz w1, .L___atomic_load_8_00c
ldr x0, [x0]
ret
.L___atomic_load_8_00c:
ldar x0, [x0]
ret
.size _(__atomic_load_8), .-_(__atomic_load_8)
#endif
.global _(__atomic_store_1)
.type _(__atomic_store_1), %function
_(__atomic_store_1):
#ifdef __TINYC__
.int 0x12001c21
.int 0x35000062
.int 0x39000001
.int 0xd65f03c0
.int 0x089ffc01
.int 0xd65f03c0
#else
and w1, w1, #0xff
cbnz w2, .L___atomic_store_1_010
strb w1, [x0]
ret
.L___atomic_store_1_010:
stlrb w1, [x0]
ret
.size _(__atomic_store_1), .-_(__atomic_store_1)
#endif
.global _(__atomic_store_2)
.type _(__atomic_store_2), %function
_(__atomic_store_2):
#ifdef __TINYC__
.int 0x12003c21
.int 0x35000062
.int 0x79000001
.int 0xd65f03c0
.int 0x489ffc01
.int 0xd65f03c0
#else
and w1, w1, #0xffff
cbnz w2, .L___atomic_store_2_010
strh w1, [x0]
ret
.L___atomic_store_2_010:
stlrh w1, [x0]
ret
.size _(__atomic_store_2), .-_(__atomic_store_2)
#endif
.global _(__atomic_store_4)
.type _(__atomic_store_4), %function
_(__atomic_store_4):
#ifdef __TINYC__
.int 0x35000062
.int 0xb9000001
.int 0xd65f03c0
.int 0x889ffc01
.int 0xd65f03c0
#else
cbnz w2, .L___atomic_store_4_00c
str w1, [x0]
ret
.L___atomic_store_4_00c:
stlr w1, [x0]
ret
.size _(__atomic_store_4), .-_(__atomic_store_4)
#endif
.global _(__atomic_store_8)
.type _(__atomic_store_8), %function
_(__atomic_store_8):
#ifdef __TINYC__
.int 0x35000062
.int 0xf9000001
.int 0xd65f03c0
.int 0xc89ffc01
.int 0xd65f03c0
#else
cbnz w2, .L___atomic_store_8_00c
str x1, [x0]
ret
.L___atomic_store_8_00c:
stlr x1, [x0]
ret
.size _(__atomic_store_8), .-_(__atomic_store_8)
#endif
.global _(__atomic_compare_exchange_1)
.type _(__atomic_compare_exchange_1), %function
_(__atomic_compare_exchange_1):
#ifdef __TINYC__
.int 0x12001c42
.int 0x35000143
.int 0x39400023
.int 0x085f7c04
.int 0x6b23009f
.int 0x54000061
.int 0x08057c02
.int 0x35ffff85
.int 0x1a9f17e0
.int 0x54000141
.int 0xd65f03c0
.int 0x39400023
.int 0x085ffc04
.int 0x6b23009f
.int 0x54000061
.int 0x0805fc02
.int 0x35ffff85
.int 0x1a9f17e0
.int 0x54ffff00
.int 0x39000024
.int 0xd65f03c0
#else
and w2, w2, #0xff
cbnz w3, .L___atomic_compare_exchange_1_02c
ldrb w3, [x1]
.L___atomic_compare_exchange_1_00c:
ldxrb w4, [x0]
cmp w4, w3, uxtb
b.ne .L___atomic_compare_exchange_1_020
stxrb w5, w2, [x0]
cbnz w5, .L___atomic_compare_exchange_1_00c
.L___atomic_compare_exchange_1_020:
cset w0, eq // eq = none
b.ne .L___atomic_compare_exchange_1_04c
.L___atomic_compare_exchange_1_028:
ret
.L___atomic_compare_exchange_1_02c:
ldrb w3, [x1]
.L___atomic_compare_exchange_1_030:
ldaxrb w4, [x0]
cmp w4, w3, uxtb
b.ne .L___atomic_compare_exchange_1_044
stlxrb w5, w2, [x0]
cbnz w5, .L___atomic_compare_exchange_1_030
.L___atomic_compare_exchange_1_044:
cset w0, eq // eq = none
b.eq .L___atomic_compare_exchange_1_028
.L___atomic_compare_exchange_1_04c:
strb w4, [x1]
ret
.size _(__atomic_compare_exchange_1), .-_(__atomic_compare_exchange_1)
#endif
.global _(__atomic_compare_exchange_2)
.type _(__atomic_compare_exchange_2), %function
_(__atomic_compare_exchange_2):
#ifdef __TINYC__
.int 0x12003c42
.int 0x35000143
.int 0x79400023
.int 0x485f7c04
.int 0x6b23209f
.int 0x54000061
.int 0x48057c02
.int 0x35ffff85
.int 0x1a9f17e0
.int 0x54000141
.int 0xd65f03c0
.int 0x79400023
.int 0x485ffc04
.int 0x6b23209f
.int 0x54000061
.int 0x4805fc02
.int 0x35ffff85
.int 0x1a9f17e0
.int 0x54ffff00
.int 0x79000024
.int 0xd65f03c0
#else
and w2, w2, #0xffff
cbnz w3, .L___atomic_compare_exchange_2_02c
ldrh w3, [x1]
.L___atomic_compare_exchange_2_00c:
ldxrh w4, [x0]
cmp w4, w3, uxth
b.ne .L___atomic_compare_exchange_2_020
stxrh w5, w2, [x0]
cbnz w5, .L___atomic_compare_exchange_2_00c
.L___atomic_compare_exchange_2_020:
cset w0, eq // eq = none
b.ne .L___atomic_compare_exchange_2_04c
.L___atomic_compare_exchange_2_028:
ret
.L___atomic_compare_exchange_2_02c:
ldrh w3, [x1]
.L___atomic_compare_exchange_2_030:
ldaxrh w4, [x0]
cmp w4, w3, uxth
b.ne .L___atomic_compare_exchange_2_044
stlxrh w5, w2, [x0]
cbnz w5, .L___atomic_compare_exchange_2_030
.L___atomic_compare_exchange_2_044:
cset w0, eq // eq = none
b.eq .L___atomic_compare_exchange_2_028
.L___atomic_compare_exchange_2_04c:
strh w4, [x1]
ret
.size _(__atomic_compare_exchange_2), .-_(__atomic_compare_exchange_2)
#endif
.global _(__atomic_compare_exchange_4)
.type _(__atomic_compare_exchange_4), %function
_(__atomic_compare_exchange_4):
#ifdef __TINYC__
.int 0x35000143
.int 0xb9400023
.int 0x885f7c04
.int 0x6b03009f
.int 0x54000061
.int 0x88057c02
.int 0x35ffff85
.int 0x1a9f17e0
.int 0x54000141
.int 0xd65f03c0
.int 0xb9400023
.int 0x885ffc04
.int 0x6b03009f
.int 0x54000061
.int 0x8805fc02
.int 0x35ffff85
.int 0x1a9f17e0
.int 0x54ffff00
.int 0xb9000024
.int 0xd65f03c0
#else
cbnz w3, .L___atomic_compare_exchange_4_028
ldr w3, [x1]
.L___atomic_compare_exchange_4_008:
ldxr w4, [x0]
cmp w4, w3
b.ne .L___atomic_compare_exchange_4_01c
stxr w5, w2, [x0]
cbnz w5, .L___atomic_compare_exchange_4_008
.L___atomic_compare_exchange_4_01c:
cset w0, eq // eq = none
b.ne .L___atomic_compare_exchange_4_048
.L___atomic_compare_exchange_4_024:
ret
.L___atomic_compare_exchange_4_028:
ldr w3, [x1]
.L___atomic_compare_exchange_4_02c:
ldaxr w4, [x0]
cmp w4, w3
b.ne .L___atomic_compare_exchange_4_040
stlxr w5, w2, [x0]
cbnz w5, .L___atomic_compare_exchange_4_02c
.L___atomic_compare_exchange_4_040:
cset w0, eq // eq = none
b.eq .L___atomic_compare_exchange_4_024
.L___atomic_compare_exchange_4_048:
str w4, [x1]
ret
.size _(__atomic_compare_exchange_4), .-_(__atomic_compare_exchange_4)
#endif
.global _(__atomic_compare_exchange_8)
.type _(__atomic_compare_exchange_8), %function
_(__atomic_compare_exchange_8):
#ifdef __TINYC__
.int 0x35000143
.int 0xf9400023
.int 0xc85f7c04
.int 0xeb03009f
.int 0x54000061
.int 0xc8057c02
.int 0x35ffff85
.int 0x1a9f17e0
.int 0x54000141
.int 0xd65f03c0
.int 0xf9400023
.int 0xc85ffc04
.int 0xeb03009f
.int 0x54000061
.int 0xc805fc02
.int 0x35ffff85
.int 0x1a9f17e0
.int 0x54ffff00
.int 0xf9000024
.int 0xd65f03c0
#else
cbnz w3, .L___atomic_compare_exchange_8_028
ldr x3, [x1]
.L___atomic_compare_exchange_8_008:
ldxr x4, [x0]
cmp x4, x3
b.ne .L___atomic_compare_exchange_8_01c
stxr w5, x2, [x0]
cbnz w5, .L___atomic_compare_exchange_8_008
.L___atomic_compare_exchange_8_01c:
cset w0, eq // eq = none
b.ne .L___atomic_compare_exchange_8_048
.L___atomic_compare_exchange_8_024:
ret
.L___atomic_compare_exchange_8_028:
ldr x3, [x1]
.L___atomic_compare_exchange_8_02c:
ldaxr x4, [x0]
cmp x4, x3
b.ne .L___atomic_compare_exchange_8_040
stlxr w5, x2, [x0]
cbnz w5, .L___atomic_compare_exchange_8_02c
.L___atomic_compare_exchange_8_040:
cset w0, eq // eq = none
b.eq .L___atomic_compare_exchange_8_024
.L___atomic_compare_exchange_8_048:
str x4, [x1]
ret
.size _(__atomic_compare_exchange_8), .-_(__atomic_compare_exchange_8)
#endif
.global _(__atomic_test_and_set_1)
.type _(__atomic_test_and_set_1), %function
_(__atomic_test_and_set_1):
#ifdef __TINYC__
.int 0x52800022
.int 0x350000c1
.int 0x085f7c01
.int 0x08037c02
.int 0x35ffffc3
.int 0x12001c20
.int 0xd65f03c0
.int 0x085ffc01
.int 0x0803fc02
.int 0x35ffffc3
.int 0x12001c20
.int 0xd65f03c0
#else
mov w2, #0x1 // #1
cbnz w1, .L___atomic_test_and_set_1_01c
.L___atomic_test_and_set_1_008:
ldxrb w1, [x0]
stxrb w3, w2, [x0]
cbnz w3, .L___atomic_test_and_set_1_008
and w0, w1, #0xff
ret
.L___atomic_test_and_set_1_01c:
ldaxrb w1, [x0]
stlxrb w3, w2, [x0]
cbnz w3, .L___atomic_test_and_set_1_01c
and w0, w1, #0xff
ret
.size _(__atomic_test_and_set_1), .-_(__atomic_test_and_set_1)
#endif
.global _(__atomic_test_and_set_2)
.type _(__atomic_test_and_set_2), %function
_(__atomic_test_and_set_2):
#ifdef __TINYC__
.int 0x52800022
.int 0x350000c1
.int 0x085f7c01
.int 0x08037c02
.int 0x35ffffc3
.int 0x12001c20
.int 0xd65f03c0
.int 0x085ffc01
.int 0x0803fc02
.int 0x35ffffc3
.int 0x12001c20
.int 0xd65f03c0
#else
mov w2, #0x1 // #1
cbnz w1, .L___atomic_test_and_set_2_01c
.L___atomic_test_and_set_2_008:
ldxrb w1, [x0]
stxrb w3, w2, [x0]
cbnz w3, .L___atomic_test_and_set_2_008
and w0, w1, #0xff
ret
.L___atomic_test_and_set_2_01c:
ldaxrb w1, [x0]
stlxrb w3, w2, [x0]
cbnz w3, .L___atomic_test_and_set_2_01c
and w0, w1, #0xff
ret
.size _(__atomic_test_and_set_2), .-_(__atomic_test_and_set_2)
#endif
.global _(__atomic_test_and_set_4)
.type _(__atomic_test_and_set_4), %function
_(__atomic_test_and_set_4):
#ifdef __TINYC__
.int 0x52800022
.int 0x350000c1
.int 0x085f7c01
.int 0x08037c02
.int 0x35ffffc3
.int 0x12001c20
.int 0xd65f03c0
.int 0x085ffc01
.int 0x0803fc02
.int 0x35ffffc3
.int 0x12001c20
.int 0xd65f03c0
#else
mov w2, #0x1 // #1
cbnz w1, .L___atomic_test_and_set_4_01c
.L___atomic_test_and_set_4_008:
ldxrb w1, [x0]
stxrb w3, w2, [x0]
cbnz w3, .L___atomic_test_and_set_4_008
and w0, w1, #0xff
ret
.L___atomic_test_and_set_4_01c:
ldaxrb w1, [x0]
stlxrb w3, w2, [x0]
cbnz w3, .L___atomic_test_and_set_4_01c
and w0, w1, #0xff
ret
.size _(__atomic_test_and_set_4), .-_(__atomic_test_and_set_4)
#endif
.global _(__atomic_test_and_set_8)
.type _(__atomic_test_and_set_8), %function
_(__atomic_test_and_set_8):
#ifdef __TINYC__
.int 0x52800022
.int 0x350000c1
.int 0x085f7c01
.int 0x08037c02
.int 0x35ffffc3
.int 0x12001c20
.int 0xd65f03c0
.int 0x085ffc01
.int 0x0803fc02
.int 0x35ffffc3
.int 0x12001c20
.int 0xd65f03c0
#else
mov w2, #0x1 // #1
cbnz w1, .L___atomic_test_and_set_8_01c
.L___atomic_test_and_set_8_008:
ldxrb w1, [x0]
stxrb w3, w2, [x0]
cbnz w3, .L___atomic_test_and_set_8_008
and w0, w1, #0xff
ret
.L___atomic_test_and_set_8_01c:
ldaxrb w1, [x0]
stlxrb w3, w2, [x0]
cbnz w3, .L___atomic_test_and_set_8_01c
and w0, w1, #0xff
ret
.size _(__atomic_test_and_set_8), .-_(__atomic_test_and_set_8)
#endif
.global _(atomic_thread_fence)
.type _(atomic_thread_fence), %function
_(atomic_thread_fence):
#ifdef __TINYC__
.int 0xd5033bbf
.int 0xd65f03c0
#else
dmb ish
ret
.size _(atomic_thread_fence), .-_(atomic_thread_fence)
#endif
.global _(atomic_signal_fence)
.type _(atomic_signal_fence), %function
_(atomic_signal_fence):
#ifdef __TINYC__
.int 0xd65f03c0
#else
ret
.size _(atomic_signal_fence), .-_(atomic_signal_fence)
#endif
.global _(atomic_flag_test_and_set)
.type _(atomic_flag_test_and_set), %function
_(atomic_flag_test_and_set):
#ifdef __TINYC__
.int 0xaa0003e1
.int 0x52800022
.int 0x085ffc20
.int 0x0803fc22
.int 0x35ffffc3
.int 0xd65f03c0
#else
mov x1, x0
mov w2, #0x1 // #1
.L_atomic_flag_test_and_set_008:
ldaxrb w0, [x1]
stlxrb w3, w2, [x1]
cbnz w3, .L_atomic_flag_test_and_set_008
ret
.size _(atomic_flag_test_and_set), .-_(atomic_flag_test_and_set)
#endif
.global _(atomic_flag_test_and_set_explicit)
.type _(atomic_flag_test_and_set_explicit), %function
_(atomic_flag_test_and_set_explicit):
#ifdef __TINYC__
.int 0xaa0003e1
.int 0x52800022
.int 0x085ffc20
.int 0x0803fc22
.int 0x35ffffc3
.int 0xd65f03c0
#else
mov x1, x0
mov w2, #0x1 // #1
.L_atomic_flag_test_and_set_explicit_020:
ldaxrb w0, [x1]
stlxrb w3, w2, [x1]
cbnz w3, .L_atomic_flag_test_and_set_explicit_020
ret
.size _(atomic_flag_test_and_set_explicit), .-_(atomic_flag_test_and_set_explicit)
#endif
.global _(atomic_flag_clear)
.type _(atomic_flag_clear), %function
_(atomic_flag_clear):
#ifdef __TINYC__
.int 0x089ffc1f
.int 0xd65f03c0
#else
stlrb wzr, [x0]
ret
.size _(atomic_flag_clear), .-_(atomic_flag_clear)
#endif
.global _(atomic_flag_clear_explicit)
.type _(atomic_flag_clear_explicit), %function
_(atomic_flag_clear_explicit):
#ifdef __TINYC__
.int 0x089ffc1f
.int 0xd65f03c0
#else
stlrb wzr, [x0]
ret
.size _(atomic_flag_clear_explicit), .-_(atomic_flag_clear_explicit)
#endif
#endif //__aarch64__
/* ---------------------------------------------- */
#if defined __riscv
.text
.align 2
.global _(__atomic_load_1)
.type _(__atomic_load_1), %function
_(__atomic_load_1):
#ifdef __TINYC__
.int 0x0330000f
.int 0x00054503
.int 0x0330000f
.short 0x8082
#else
fence rw,rw
lbu a0,0(a0)
fence rw,rw
ret
.size _(__atomic_load_1), .-_(__atomic_load_1)
#endif
.global _(__atomic_load_2)
.type _(__atomic_load_2), %function
_(__atomic_load_2):
#ifdef __TINYC__
.int 0x0330000f
.int 0x00055503
.int 0x0330000f
.short 0x8082
#else
fence rw,rw
lhu a0,0(a0)
fence rw,rw
ret
.size _(__atomic_load_2), .-_(__atomic_load_2)
#endif
.global _(__atomic_load_4)
.type _(__atomic_load_4), %function
_(__atomic_load_4):
#ifdef __TINYC__
.int 0x0330000f
.short 0x4108
.int 0x0230000f
.short 0x2501
.short 0x8082
#else
fence rw,rw
lw a0,0(a0)
fence r,rw
sext.w a0,a0
ret
.size _(__atomic_load_4), .-_(__atomic_load_4)
#endif
.global _(__atomic_load_8)
.type _(__atomic_load_8), %function
_(__atomic_load_8):
#ifdef __TINYC__
.int 0x0330000f
.short 0x6108
.int 0x0230000f
.short 0x8082
#else
fence rw,rw
ld a0,0(a0)
fence r,rw
ret
.size _(__atomic_load_8), .-_(__atomic_load_8)
#endif
.global _(__atomic_store_1)
.type _(__atomic_store_1), %function
_(__atomic_store_1):
#ifdef __TINYC__
.int 0x0330000f
.int 0x00b50023
.int 0x0330000f
.short 0x8082
#else
fence rw,rw
sb a1,0(a0)
fence rw,rw
ret
.size _(__atomic_store_1), .-_(__atomic_store_1)
#endif
.global _(__atomic_store_2)
.type _(__atomic_store_2), %function
_(__atomic_store_2):
#ifdef __TINYC__
.int 0x0330000f
.int 0x00b51023
.int 0x0330000f
.short 0x8082
#else
fence rw,rw
sh a1,0(a0)
fence rw,rw
ret
.size _(__atomic_store_2), .-_(__atomic_store_2)
#endif
.global _(__atomic_store_4)
.type _(__atomic_store_4), %function
_(__atomic_store_4):
#ifdef __TINYC__
.int 0x0310000f
.short 0xc10c
.int 0x0330000f
.short 0x8082
#else
fence rw,w
sw a1,0(a0)
fence rw,rw
ret
.size _(__atomic_store_4), .-_(__atomic_store_4)
#endif
.global _(__atomic_store_8)
.type _(__atomic_store_8), %function
_(__atomic_store_8):
#ifdef __TINYC__
.int 0x0310000f
.short 0xe10c
.int 0x0330000f
.short 0x8082
#else
fence rw,w
sd a1,0(a0)
fence rw,rw
ret
.size _(__atomic_store_8), .-_(__atomic_store_8)
#endif
.global _(__atomic_compare_exchange_1)
.type _(__atomic_compare_exchange_1), %function
_(__atomic_compare_exchange_1):
#ifdef __TINYC__
.int 0x0005c683
.int 0x00357793
.int 0x0037979b
.int 0x0ff00713
.int 0x00f7173b
.int 0x00f698bb
.int 0x00f6163b
.short 0x9971
.int 0xfff74313
.int 0x00e8f8b3
.short 0x8e79
.int 0x1605282f
.int 0x00e87e33
.int 0x011e1a63
.int 0x00687e33
.int 0x00ce6e33
.int 0x1bc52e2f
.int 0xfe0e14e3
.int 0x40f8583b
.int 0x0188179b
.int 0x0186969b
.int 0x4187d79b
.int 0x4186d69b
.short 0x9f95
.int 0x0017b513
.short 0xc399
.int 0x01058023
.short 0x8905
.short 0x8082
#else
lbu a3,0(a1)
andi a5,a0,3
slliw a5,a5,0x3
li a4,255
sllw a4,a4,a5
sllw a7,a3,a5
sllw a2,a2,a5
andi a0,a0,-4
not t1,a4
and a7,a7,a4
and a2,a2,a4
.L___atomic_compare_exchange_1_028:
lr.w.aqrl a6,(a0)
and t3,a6,a4
bne t3,a7, .L___atomic_compare_exchange_1_044
and t3,a6,t1
or t3,t3,a2
sc.w.rl t3,t3,(a0)
bnez t3, .L___atomic_compare_exchange_1_028
.L___atomic_compare_exchange_1_044:
sraw a6,a6,a5
slliw a5,a6,0x18
slliw a3,a3,0x18
sraiw a5,a5,0x18
sraiw a3,a3,0x18
subw a5,a5,a3
seqz a0,a5
beqz a5, .L___atomic_compare_exchange_1_064
sb a6,0(a1)
.L___atomic_compare_exchange_1_064:
andi a0,a0,1
ret
.size _(__atomic_compare_exchange_1), .-_(__atomic_compare_exchange_1)
#endif
.global _(__atomic_compare_exchange_2)
.type _(__atomic_compare_exchange_2), %function
_(__atomic_compare_exchange_2):
#ifdef __TINYC__
.int 0x0005d683
.int 0x00357713
.short 0x67c1
.int 0x0037171b
.short 0x37fd
.int 0x00e797bb
.int 0x00e698bb
.int 0x00e6163b
.short 0x9971
.int 0xfff7c313
.int 0x00f8f8b3
.short 0x8e7d
.int 0x1605282f
.int 0x00f87e33
.int 0x011e1a63
.int 0x00687e33
.int 0x00ce6e33
.int 0x1bc52e2f
.int 0xfe0e14e3
.int 0x40e8583b
.int 0x0108179b
.int 0x0106969b
.int 0x4107d79b
.int 0x4106d69b
.short 0x9f95
.int 0x0017b513
.short 0xc399
.int 0x01059023
.short 0x8905
.short 0x8082
#else
lhu a3,0(a1)
andi a4,a0,3
lui a5,0x10
slliw a4,a4,0x3
addiw a5,a5,-1 # ffff <.LASF16+0xfec8>
sllw a5,a5,a4
sllw a7,a3,a4
sllw a2,a2,a4
andi a0,a0,-4
not t1,a5
and a7,a7,a5
and a2,a2,a5
.L___atomic_compare_exchange_2_028:
lr.w.aqrl a6,(a0)
and t3,a6,a5
bne t3,a7, .L___atomic_compare_exchange_2_044
and t3,a6,t1
or t3,t3,a2
sc.w.rl t3,t3,(a0)
bnez t3, .L___atomic_compare_exchange_2_028
.L___atomic_compare_exchange_2_044:
sraw a6,a6,a4
slliw a5,a6,0x10
slliw a3,a3,0x10
sraiw a5,a5,0x10
sraiw a3,a3,0x10
subw a5,a5,a3
seqz a0,a5
beqz a5, .L___atomic_compare_exchange_2_064
sh a6,0(a1)
.L___atomic_compare_exchange_2_064:
andi a0,a0,1
ret
.size _(__atomic_compare_exchange_2), .-_(__atomic_compare_exchange_2)
#endif
.global _(__atomic_compare_exchange_4)
.type _(__atomic_compare_exchange_4), %function
_(__atomic_compare_exchange_4):
#ifdef __TINYC__
.short 0x419c
.int 0x1605272f
.int 0x00f71563
.int 0x1ac526af
.short 0xfaf5
.int 0x40f707bb
.int 0x0017b513
.short 0xc391
.short 0xc198
.short 0x8905
.short 0x8082
#else
lw a5,0(a1)
.L___atomic_compare_exchange_4_002:
lr.w.aqrl a4,(a0)
bne a4,a5, .L___atomic_compare_exchange_4_010
sc.w.rl a3,a2,(a0)
bnez a3, .L___atomic_compare_exchange_4_002
.L___atomic_compare_exchange_4_010:
subw a5,a4,a5
seqz a0,a5
beqz a5, .L___atomic_compare_exchange_4_01c
sw a4,0(a1)
.L___atomic_compare_exchange_4_01c:
andi a0,a0,1
ret
.size _(__atomic_compare_exchange_4), .-_(__atomic_compare_exchange_4)
#endif
.global _(__atomic_compare_exchange_8)
.type _(__atomic_compare_exchange_8), %function
_(__atomic_compare_exchange_8):
#ifdef __TINYC__
.short 0x619c
.int 0x1605372f
.int 0x00f71563
.int 0x1ac536af
.short 0xfaf5
.int 0x40f707b3
.int 0x0017b513
.short 0xc391
.short 0xe198
.short 0x8905
.short 0x8082
#else
ld a5,0(a1)
.L___atomic_compare_exchange_8_002:
lr.d.aqrl a4,(a0)
bne a4,a5, .L___atomic_compare_exchange_8_010
sc.d.rl a3,a2,(a0)
bnez a3, .L___atomic_compare_exchange_8_002
.L___atomic_compare_exchange_8_010:
sub a5,a4,a5
seqz a0,a5
beqz a5, .L___atomic_compare_exchange_8_01c
sd a4,0(a1)
.L___atomic_compare_exchange_8_01c:
andi a0,a0,1
ret
.size _(__atomic_compare_exchange_8), .-_(__atomic_compare_exchange_8)
#endif
.global _(__atomic_test_and_set_1)
.type _(__atomic_test_and_set_1), %function
_(__atomic_test_and_set_1):
#ifdef __TINYC__
.int 0x00357793
.int 0x0037979b
.short 0x4685
.short 0x9971
.int 0x00f696bb
.int 0x46d5272f
.int 0x00f7553b
.int 0x0ff57513
.short 0x8082
#else
andi a5,a0,3
slliw a5,a5,0x3
li a3,1
andi a0,a0,-4
sllw a3,a3,a5
amoor.w.aqrl a4,a3,(a0)
srlw a0,a4,a5
zext.b a0,a0
ret
.size _(__atomic_test_and_set_1), .-_(__atomic_test_and_set_1)
#endif
.global _(__atomic_test_and_set_2)
.type _(__atomic_test_and_set_2), %function
_(__atomic_test_and_set_2):
#ifdef __TINYC__
.int 0x00357793
.int 0x0037979b
.short 0x4685
.short 0x9971
.int 0x00f696bb
.int 0x46d5272f
.int 0x00f7553b
.int 0x0ff57513
.short 0x8082
#else
andi a5,a0,3
slliw a5,a5,0x3
li a3,1
andi a0,a0,-4
sllw a3,a3,a5
amoor.w.aqrl a4,a3,(a0)
srlw a0,a4,a5
zext.b a0,a0
ret
.size _(__atomic_test_and_set_2), .-_(__atomic_test_and_set_2)
#endif
.global _(__atomic_test_and_set_4)
.type _(__atomic_test_and_set_4), %function
_(__atomic_test_and_set_4):
#ifdef __TINYC__
.int 0x00357793
.int 0x0037979b
.short 0x4685
.short 0x9971
.int 0x00f696bb
.int 0x46d5272f
.int 0x00f7553b
.int 0x0ff57513
.short 0x8082
#else
andi a5,a0,3
slliw a5,a5,0x3
li a3,1
andi a0,a0,-4
sllw a3,a3,a5
amoor.w.aqrl a4,a3,(a0)
srlw a0,a4,a5
zext.b a0,a0
ret
.size _(__atomic_test_and_set_4), .-_(__atomic_test_and_set_4)
#endif
.global _(__atomic_test_and_set_8)
.type _(__atomic_test_and_set_8), %function
_(__atomic_test_and_set_8):
#ifdef __TINYC__
.int 0x00357793
.int 0x0037979b
.short 0x4685
.short 0x9971
.int 0x00f696bb
.int 0x46d5272f
.int 0x00f7553b
.int 0x0ff57513
.short 0x8082
#else
andi a5,a0,3
slliw a5,a5,0x3
li a3,1
andi a0,a0,-4
sllw a3,a3,a5
amoor.w.aqrl a4,a3,(a0)
srlw a0,a4,a5
zext.b a0,a0
ret
.size _(__atomic_test_and_set_8), .-_(__atomic_test_and_set_8)
#endif
.global _(atomic_thread_fence)
.type _(atomic_thread_fence), %function
_(atomic_thread_fence):
#ifdef __TINYC__
.int 0x0330000f
.short 0x8082
#else
fence rw,rw
ret
.size _(atomic_thread_fence), .-_(atomic_thread_fence)
#endif
.global _(atomic_signal_fence)
.type _(atomic_signal_fence), %function
_(atomic_signal_fence):
#ifdef __TINYC__
.short 0x8082
#else
ret
.size _(atomic_signal_fence), .-_(atomic_signal_fence)
#endif
.global _(atomic_flag_test_and_set)
.type _(atomic_flag_test_and_set), %function
_(atomic_flag_test_and_set):
#ifdef __TINYC__
.int 0x00357793
.int 0x0037979b
.short 0x4685
.short 0x9971
.int 0x00f696bb
.int 0x46d5272f
.int 0x00f7553b
.int 0x0ff57513
.short 0x8082
#else
andi a5,a0,3
slliw a5,a5,0x3
li a3,1
andi a0,a0,-4
sllw a3,a3,a5
amoor.w.aqrl a4,a3,(a0)
srlw a0,a4,a5
zext.b a0,a0
ret
.size _(atomic_flag_test_and_set), .-_(atomic_flag_test_and_set)
#endif
.global _(atomic_flag_test_and_set_explicit)
.type _(atomic_flag_test_and_set_explicit), %function
_(atomic_flag_test_and_set_explicit):
#ifdef __TINYC__
.int 0x00357793
.int 0x0037979b
.short 0x4685
.short 0x9971
.int 0x00f696bb
.int 0x46d5272f
.int 0x00f7553b
.int 0x0ff57513
.short 0x8082
#else
andi a5,a0,3
slliw a5,a5,0x3
li a3,1
andi a0,a0,-4
sllw a3,a3,a5
amoor.w.aqrl a4,a3,(a0)
srlw a0,a4,a5
zext.b a0,a0
ret
.size _(atomic_flag_test_and_set_explicit), .-_(atomic_flag_test_and_set_explicit)
#endif
.global _(atomic_flag_clear)
.type _(atomic_flag_clear), %function
_(atomic_flag_clear):
#ifdef __TINYC__
.int 0x0330000f
.int 0x00050023
.int 0x0330000f
.short 0x8082
#else
fence rw,rw
sb zero,0(a0)
fence rw,rw
ret
.size _(atomic_flag_clear), .-_(atomic_flag_clear)
#endif
.global _(atomic_flag_clear_explicit)
.type _(atomic_flag_clear_explicit), %function
_(atomic_flag_clear_explicit):
#ifdef __TINYC__
.int 0x0330000f
.int 0x00050023
.int 0x0330000f
.short 0x8082
#else
fence rw,rw
sb zero,0(a0)
fence rw,rw
ret
.size _(atomic_flag_clear_explicit), .-_(atomic_flag_clear_explicit)
#endif
#endif //__riscv