123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- From 15b98f6759a7f27367c2450c4aebd894468dd8b8 Mon Sep 17 00:00:00 2001
- From: Jun Yuan Tan <junyuan.tan@starfivetech.com>
- Date: Tue, 9 Nov 2021 10:49:26 +0800
- Subject: [PATCH 24/34] compiler-rt: Use mcr based barrier on armv6
- dsb is an armv7 instruction and wont work when we are building for armv6.
- Upstream-Status: Pending
- Rebased to LLVM 14.0.0 by Jun Yuan Tan
- Signed-off-by: Khem Raj <raj.khem@gmail.com>
- Signed-off-by: Jun Yuan Tan <junyuan.tan@starfivetech.com>
- ---
- compiler-rt/lib/builtins/arm/sync-ops.h | 8 ++++----
- compiler-rt/lib/builtins/assembly.h | 8 ++++++++
- 2 files changed, 12 insertions(+), 4 deletions(-)
- diff --git a/compiler-rt/lib/builtins/arm/sync-ops.h b/compiler-rt/lib/builtins/arm/sync-ops.h
- index c9623249e5d2..7a26170741ad 100644
- --- a/compiler-rt/lib/builtins/arm/sync-ops.h
- +++ b/compiler-rt/lib/builtins/arm/sync-ops.h
- @@ -19,14 +19,14 @@
- .thumb; \
- .syntax unified; \
- DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \
- - dmb; \
- + DMB; \
- mov r12, r0; \
- LOCAL_LABEL(tryatomic_##op) : ldrex r0, [r12]; \
- op(r2, r0, r1); \
- strex r3, r2, [r12]; \
- cmp r3, #0; \
- bne LOCAL_LABEL(tryatomic_##op); \
- - dmb; \
- + DMB; \
- bx lr
-
- #define SYNC_OP_8(op) \
- @@ -35,14 +35,14 @@
- .syntax unified; \
- DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \
- push {r4, r5, r6, lr}; \
- - dmb; \
- + DMB; \
- mov r12, r0; \
- LOCAL_LABEL(tryatomic_##op) : ldrexd r0, r1, [r12]; \
- op(r4, r5, r0, r1, r2, r3); \
- strexd r6, r4, r5, [r12]; \
- cmp r6, #0; \
- bne LOCAL_LABEL(tryatomic_##op); \
- - dmb; \
- + DMB; \
- pop { r4, r5, r6, pc }
-
- #define MINMAX_4(rD, rN, rM, cmp_kind) \
- diff --git a/compiler-rt/lib/builtins/assembly.h b/compiler-rt/lib/builtins/assembly.h
- index 9c015059af5a..aec4ff59beb7 100644
- --- a/compiler-rt/lib/builtins/assembly.h
- +++ b/compiler-rt/lib/builtins/assembly.h
- @@ -183,6 +183,14 @@
- JMP(ip)
- #endif
-
- +#if __ARM_ARCH >= 7
- +#define DMB dmb
- +#elif __ARM_ARCH >= 6
- +#define DMB mcr p15, #0, r0, c7, c10, #5
- +#else
- +#error Only use this with ARMv6+
- +#endif
- +
- #if defined(USE_THUMB_2)
- #define WIDE(op) op.w
- #else
- --
- 2.33.1
|