| 1 | /* ---------------------------------------------- */ |
| 2 | #if defined __i386__ |
| 3 | |
| 4 | #define endbr32 |
| 5 | |
| 6 | .text |
| 7 | |
| 8 | .global _V_atomic_thread_fence |
| 9 | .type _V_atomic_thread_fence, %function |
| 10 | _V_atomic_thread_fence: |
| 11 | endbr32 |
| 12 | lock orl $0x0,(%esp) |
| 13 | ret |
| 14 | |
| 15 | #endif //__i386__ |
| 16 | |
| 17 | /* ---------------------------------------------- */ |
| 18 | #if defined __x86_64__ && !defined _WIN32 |
| 19 | #define endbr64 |
| 20 | .text |
| 21 | .global __atomic_thread_fence |
| 22 | .type __atomic_thread_fence, %function |
| 23 | __atomic_thread_fence: |
| 24 | endbr64 |
| 25 | lock orq $0x0,(%rsp) |
| 26 | ret |
| 27 | #endif //__x86_64__ && !_WIN32 |
| 28 | |
| 29 | /* ---------------------------------------------- */ |
| 30 | #if defined __x86_64__ && defined _WIN32 |
| 31 | .text |
| 32 | |
| 33 | .global _V_atomic_thread_fence |
| 34 | .type _V_atomic_thread_fence, %function |
| 35 | _V_atomic_thread_fence: |
| 36 | lock orq $0x0,(%rsp) |
| 37 | ret |
| 38 | |
| 39 | #endif //__x86_64__ && _WIN32 |
| 40 | |
| 41 | /* ---------------------------------------------- */ |
| 42 | #if defined __arm__ |
| 43 | .text |
| 44 | #ifndef __TINYC__ |
| 45 | .arch armv6k |
| 46 | .syntax unified |
| 47 | #endif |
| 48 | |
| 49 | .global _V_atomic_thread_fence |
| 50 | .type _V_atomic_thread_fence, %function |
| 51 | _V_atomic_thread_fence: |
| 52 | #ifdef __TINYC__ |
| 53 | .int 0xee070fba |
| 54 | .int 0xe12fff1e |
| 55 | #else |
| 56 | mcr p15, #0, r0, c7, c10, #5 |
| 57 | bx lr |
| 58 | |
| 59 | #endif |
| 60 | #endif //__arm__ |
| 61 | |
| 62 | /* ---------------------------------------------- */ |
| 63 | #if defined __aarch64__ |
| 64 | .text |
| 65 | |
| 66 | .global _V_atomic_thread_fence |
| 67 | .type _V_atomic_thread_fence, %function |
| 68 | _V_atomic_thread_fence: |
| 69 | #ifdef __TINYC__ |
| 70 | .int 0xd5033bbf |
| 71 | .int 0xd65f03c0 |
| 72 | #else |
| 73 | dmb ish |
| 74 | ret |
| 75 | |
| 76 | #endif |
| 77 | #endif //__aarch64__ |
| 78 | |
| 79 | /* ---------------------------------------------- */ |
| 80 | #if defined __riscv |
| 81 | .text |
| 82 | |
| 83 | .global _V_atomic_thread_fence |
| 84 | .type _V_atomic_thread_fence, %function |
| 85 | _V_atomic_thread_fence: |
| 86 | #ifdef __TINYC__ |
| 87 | .int 0x0330000f |
| 88 | .short 0x8082 |
| 89 | #else |
| 90 | fence rw,rw |
| 91 | ret |
| 92 | |
| 93 | #endif |
| 94 | #endif //__riscv |
| 95 | |