[compiler-rt] r218601 - [compiler-rt] Do not use ldrexd or strexd on v7M

Oliver Stannard oliver.stannard at arm.com
Mon Sep 29 03:23:20 PDT 2014


Author: olista01
Date: Mon Sep 29 05:23:20 2014
New Revision: 218601

URL: http://llvm.org/viewvc/llvm-project?rev=218601&view=rev
Log:
[compiler-rt] Do not use ldrexd or strexd on v7M

The ldrexd and strexd instructions are undefined for the ARMv7M
architecture, so we cannot use them to implement the
__sync_fetch_and_*_8 builtins. There is no other way to implement
these without OS support, so this patch #ifdef's these functions out
for M-class architectures.

There are no tests as I cannot find any existing tests for these
builtins.

I used the __ARM_ARCH_PROFILE predefine because __ARM_FEATURE_LDREX is
deprecated and not set by clang.


Modified:
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_add_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_and_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_max_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_min_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_nand_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_or_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_sub_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umax_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umin_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_xor_8.S

Modified: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_add_8.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_add_8.S?rev=218601&r1=218600&r2=218601&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_add_8.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_add_8.S Mon Sep 29 05:23:20 2014
@@ -14,9 +14,11 @@
 
 #include "sync-ops.h"
 
+#if __ARM_ARCH_PROFILE != 'M'
 #define add_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) \
     adds rD_LO, rN_LO, rM_LO ; \
     adc rD_HI, rN_HI, rM_HI
 
 SYNC_OP_8(add_8)
+#endif
 

Modified: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_and_8.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_and_8.S?rev=218601&r1=218600&r2=218601&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_and_8.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_and_8.S Mon Sep 29 05:23:20 2014
@@ -14,8 +14,10 @@
 
 #include "sync-ops.h"
 
+#if __ARM_ARCH_PROFILE != 'M'
 #define and_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) \
     and rD_LO, rN_LO, rM_LO ; \
     and rD_HI, rN_HI, rM_HI
 
 SYNC_OP_8(and_8)
+#endif

Modified: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_max_8.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_max_8.S?rev=218601&r1=218600&r2=218601&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_max_8.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_max_8.S Mon Sep 29 05:23:20 2014
@@ -14,6 +14,8 @@
 
 #include "sync-ops.h"
 
+#if __ARM_ARCH_PROFILE != 'M'
 #define max_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI)         MINMAX_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI, gt)
 
 SYNC_OP_8(max_8)
+#endif

Modified: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_min_8.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_min_8.S?rev=218601&r1=218600&r2=218601&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_min_8.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_min_8.S Mon Sep 29 05:23:20 2014
@@ -14,6 +14,8 @@
 
 #include "sync-ops.h"
 
+#if __ARM_ARCH_PROFILE != 'M'
 #define min_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI)         MINMAX_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI, lt)
 
 SYNC_OP_8(min_8)
+#endif

Modified: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_nand_8.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_nand_8.S?rev=218601&r1=218600&r2=218601&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_nand_8.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_nand_8.S Mon Sep 29 05:23:20 2014
@@ -14,9 +14,11 @@
 
 #include "sync-ops.h"
 
+#if __ARM_ARCH_PROFILE != 'M'
 #define nand_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) \
     bic rD_LO, rN_LO, rM_LO ; \
     bic rD_HI, rN_HI, rM_HI
 
 SYNC_OP_8(nand_8)
+#endif
 

Modified: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_or_8.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_or_8.S?rev=218601&r1=218600&r2=218601&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_or_8.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_or_8.S Mon Sep 29 05:23:20 2014
@@ -14,9 +14,11 @@
 
 #include "sync-ops.h"
 
+#if __ARM_ARCH_PROFILE != 'M'
 #define or_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) \
     orr rD_LO, rN_LO, rM_LO ; \
     orr rD_HI, rN_HI, rM_HI
 
 SYNC_OP_8(or_8)
+#endif
 

Modified: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_sub_8.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_sub_8.S?rev=218601&r1=218600&r2=218601&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_sub_8.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_sub_8.S Mon Sep 29 05:23:20 2014
@@ -14,9 +14,11 @@
 
 #include "sync-ops.h"
 
+#if __ARM_ARCH_PROFILE != 'M'
 #define sub_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) \
     subs rD_LO, rN_LO, rM_LO ; \
     sbc rD_HI, rN_HI, rM_HI
 
 SYNC_OP_8(sub_8)
+#endif
 

Modified: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umax_8.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umax_8.S?rev=218601&r1=218600&r2=218601&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umax_8.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umax_8.S Mon Sep 29 05:23:20 2014
@@ -14,6 +14,8 @@
 
 #include "sync-ops.h"
 
+#if __ARM_ARCH_PROFILE != 'M'
 #define umax_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI)         MINMAX_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI, hi)
 
 SYNC_OP_8(umax_8)
+#endif

Modified: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umin_8.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umin_8.S?rev=218601&r1=218600&r2=218601&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umin_8.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umin_8.S Mon Sep 29 05:23:20 2014
@@ -14,6 +14,8 @@
 
 #include "sync-ops.h"
 
+#if __ARM_ARCH_PROFILE != 'M'
 #define umin_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI)         MINMAX_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI, lo)
 
 SYNC_OP_8(umin_8)
+#endif

Modified: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_xor_8.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_xor_8.S?rev=218601&r1=218600&r2=218601&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_xor_8.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_xor_8.S Mon Sep 29 05:23:20 2014
@@ -14,9 +14,11 @@
 
 #include "sync-ops.h"
 
+#if __ARM_ARCH_PROFILE != 'M'
 #define xor_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) \
     eor rD_LO, rN_LO, rM_LO ; \
     eor rD_HI, rN_HI, rM_HI
 
 SYNC_OP_8(xor_8)
+#endif
 





More information about the llvm-commits mailing list