summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/builtins/arm/sync-ops.h
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2014-07-22 20:59:41 +0000
committerRenato Golin <renato.golin@linaro.org>2014-07-22 20:59:41 +0000
commit8c714213d5fd311541962580b7d7d9dd40fc788b (patch)
tree1b06a2a4883d4401000997c2165cda5150acdbd4 /compiler-rt/lib/builtins/arm/sync-ops.h
parentaad0347c8b04d2b86d267f48cd3fd084f7d38100 (diff)
downloadbcm5719-llvm-8c714213d5fd311541962580b7d7d9dd40fc788b.tar.gz
bcm5719-llvm-8c714213d5fd311541962580b7d7d9dd40fc788b.zip
Fix incompatible assembly in ARM builtins library
Convert the CBNZ backward branch instruction to CMP and BNE avoiding illegal backwards branch and making the assembly code in synh-ops.h to be UAL compliant. Patch by: Sumanth Gundapaneni llvm-svn: 213685
Diffstat (limited to 'compiler-rt/lib/builtins/arm/sync-ops.h')
-rw-r--r--compiler-rt/lib/builtins/arm/sync-ops.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler-rt/lib/builtins/arm/sync-ops.h b/compiler-rt/lib/builtins/arm/sync-ops.h
index 87cc3c27c17..5cca8f705a5 100644
--- a/compiler-rt/lib/builtins/arm/sync-ops.h
+++ b/compiler-rt/lib/builtins/arm/sync-ops.h
@@ -18,6 +18,7 @@
#define SYNC_OP_4(op) \
.p2align 2 ; \
.thumb ; \
+ .syntax unified ; \
DEFINE_COMPILERRT_FUNCTION(__sync_fetch_and_ ## op) \
dmb ; \
mov r12, r0 ; \
@@ -25,13 +26,15 @@
ldrex r0, [r12] ; \
op(r2, r0, r1) ; \
strex r3, r2, [r12] ; \
- cbnz r3, LOCAL_LABEL(tryatomic_ ## op) ; \
+ cmp r3, #0 ; \
+ bne LOCAL_LABEL(tryatomic_ ## op) ; \
dmb ; \
bx lr
#define SYNC_OP_8(op) \
.p2align 2 ; \
.thumb ; \
+ .syntax unified ; \
DEFINE_COMPILERRT_FUNCTION(__sync_fetch_and_ ## op) \
push {r4, r5, r6, lr} ; \
dmb ; \
@@ -40,7 +43,8 @@
ldrexd r0, r1, [r12] ; \
op(r4, r5, r0, r1, r2, r3) ; \
strexd r6, r4, r5, [r12] ; \
- cbnz r6, LOCAL_LABEL(tryatomic_ ## op) ; \
+ cmp r6, #0 ; \
+ bne LOCAL_LABEL(tryatomic_ ## op) ; \
dmb ; \
pop {r4, r5, r6, pc}
OpenPOWER on IntegriCloud