[PATCH] [compiler-rt: Builtins] Fix the incompatible assembly in ARM builtins library.

Sumanth Gundapaneni sgundapa at codeaurora.org
Mon Jul 21 16:56:12 PDT 2014


Hi t.p.northover, rengolin,

This patch address the PR20360. It has the following fixes
    1. Include the .S files for compilation when CMake is used as build system
    2. Make the assembly code in synh-ops.h to be UAL compliant
    3. Convert the CBNZ backward branch instruction to CMP and BNE

http://reviews.llvm.org/D4610

Files:
  lib/builtins/CMakeLists.txt
  lib/builtins/arm/sync-ops.h

Index: lib/builtins/CMakeLists.txt
===================================================================
--- lib/builtins/CMakeLists.txt
+++ lib/builtins/CMakeLists.txt
@@ -251,6 +251,7 @@
 if (NOT WIN32)
   foreach(arch x86_64 i386 arm)
     if(CAN_TARGET_${arch})
+      set_source_files_properties(${${arch}_SOURCES} PROPERTIES LANGUAGE C)
       add_compiler_rt_runtime(clang_rt.builtins-${arch} ${arch} STATIC
         SOURCES ${${arch}_SOURCES}
         CFLAGS "-std=c99")
Index: lib/builtins/arm/sync-ops.h
===================================================================
--- lib/builtins/arm/sync-ops.h
+++ lib/builtins/arm/sync-ops.h
@@ -18,29 +18,33 @@
 #define SYNC_OP_4(op) \
         .p2align 2 ; \
         .thumb ; \
+        .syntax unified ; \
         DEFINE_COMPILERRT_FUNCTION(__sync_fetch_and_ ## op) \
         dmb ; \
         mov r12, r0 ; \
         LOCAL_LABEL(tryatomic_ ## op): \
         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 ; \
         mov r12, r0 ; \
         LOCAL_LABEL(tryatomic_ ## op): \
         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}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4610.11730.patch
Type: text/x-patch
Size: 1720 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140721/1a0af06d/attachment.bin>


More information about the llvm-commits mailing list