[compiler-rt] r202812 - ARM: implement __sync_fetch_and_* operations

Tim Northover tnorthover at apple.com
Tue Mar 4 02:10:19 PST 2014


Author: tnorthover
Date: Tue Mar  4 04:10:17 2014
New Revision: 202812

URL: http://llvm.org/viewvc/llvm-project?rev=202812&view=rev
Log:
ARM: implement __sync_fetch_and_* operations

Since these are primarily useful for deeply embedded targets where code size is
very important, they are each in a separate file making use of infrastructure
in sync-ops.h. This allows a linker to include just the functions that are
actually used.

rdar://problem/14736665

Added:
    compiler-rt/trunk/lib/builtins/arm/sync-ops.h
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_add_4.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_add_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_and_4.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_and_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_max_4.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_max_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_min_4.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_min_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_nand_4.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_nand_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_or_4.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_or_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_sub_4.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_sub_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umax_4.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umax_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umin_4.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umin_8.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_xor_4.S
    compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_xor_8.S
Modified:
    compiler-rt/trunk/lib/builtins/CMakeLists.txt
    compiler-rt/trunk/lib/builtins/arm/Makefile.mk
    compiler-rt/trunk/make/platform/clang_macho_embedded.mk

Modified: compiler-rt/trunk/lib/builtins/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/CMakeLists.txt?rev=202812&r1=202811&r2=202812&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/builtins/CMakeLists.txt Tue Mar  4 04:10:17 2014
@@ -213,6 +213,26 @@ set(arm_SOURCES
   arm/switch32.S
   arm/switch8.S
   arm/switchu8.S
+  arm/sync_fetch_and_add_4.S
+  arm/sync_fetch_and_add_8.S
+  arm/sync_fetch_and_and_4.S
+  arm/sync_fetch_and_and_8.S
+  arm/sync_fetch_and_max_4.S
+  arm/sync_fetch_and_max_8.S
+  arm/sync_fetch_and_min_4.S
+  arm/sync_fetch_and_min_8.S
+  arm/sync_fetch_and_nand_4.S
+  arm/sync_fetch_and_nand_8.S
+  arm/sync_fetch_and_or_4.S
+  arm/sync_fetch_and_or_8.S
+  arm/sync_fetch_and_sub_4.S
+  arm/sync_fetch_and_sub_8.S
+  arm/sync_fetch_and_umax_4.S
+  arm/sync_fetch_and_umax_8.S
+  arm/sync_fetch_and_umin_4.S
+  arm/sync_fetch_and_umin_8.S
+  arm/sync_fetch_and_xor_4.S
+  arm/sync_fetch_and_xor_8.S
   arm/sync_synchronize.S
   arm/truncdfsf2vfp.S
   arm/udivmodsi4.S

Modified: compiler-rt/trunk/lib/builtins/arm/Makefile.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/Makefile.mk?rev=202812&r1=202811&r2=202812&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/Makefile.mk (original)
+++ compiler-rt/trunk/lib/builtins/arm/Makefile.mk Tue Mar  4 04:10:17 2014
@@ -9,7 +9,7 @@
 
 ModuleName := builtins
 SubDirs := 
-OnlyArchs := armv5 armv6 armv7 armv7k armv7m armv7em armv7s
+OnlyArchs := armv5 armv6 armv6m armv7 armv7k armv7m armv7em armv7s
 
 AsmSources := $(foreach file,$(wildcard $(Dir)/*.S),$(notdir $(file)))
 Sources := $(foreach file,$(wildcard $(Dir)/*.c),$(notdir $(file)))

Added: compiler-rt/trunk/lib/builtins/arm/sync-ops.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync-ops.h?rev=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync-ops.h (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync-ops.h Tue Mar  4 04:10:17 2014
@@ -0,0 +1,61 @@
+/*===-- sync-ops.h - --===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * FIXME: description
+ * This file implements the __udivsi3 (32-bit unsigned integer divide) 
+ * function for the ARM architecture.  A naive digit-by-digit computation is
+ * employed for simplicity.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "../assembly.h"
+
+#define SYNC_OP_4(op) \
+        .align 2 ; \
+        .thumb ; \
+        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) ; \
+        dmb ; \
+        bx lr
+
+#define SYNC_OP_8(op) \
+        .align 2 ; \
+        .thumb ; \
+        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) ; \
+        dmb ; \
+        pop {r4, r5, r6, pc}
+
+#define MINMAX_4(rD, rN, rM, cmp_kind) \
+        cmp rN, rM ; \
+        mov rD, rM ; \
+        it cmp_kind ; \
+        mov##cmp_kind rD, rN
+
+#define MINMAX_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI, cmp_kind) \
+        cmp rN_LO, rM_LO ; \
+        sbcs rN_HI, rM_HI ; \
+        mov rD_LO, rM_LO ; \
+        mov rD_HI, rM_HI ; \
+        itt cmp_kind ; \
+        mov##cmp_kind rD_LO, rN_LO ; \
+        mov##cmp_kind rD_HI, rN_HI

Added: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_add_4.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_add_4.S?rev=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_add_4.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_add_4.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,21 @@
+/*===-- sync_fetch_and_add_4.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_add_4 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+/* "adds" is 2 bytes shorter than "add". */
+#define add_4(rD, rN, rM)  add rD, rN, rM
+
+SYNC_OP_4(add_4)
+

Added: 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=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_add_8.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_add_8.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,22 @@
+/*===-- sync_fetch_and_add_8.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_add_8 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#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)
+

Added: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_and_4.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_and_4.S?rev=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_and_4.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_and_4.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,19 @@
+/*===-- sync_fetch_and_and_4.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_and_4 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#define and_4(rD, rN, rM)  and rD, rN, rM
+
+SYNC_OP_4(and_4)

Added: 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=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_and_8.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_and_8.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,21 @@
+/*===-- sync_fetch_and_and_8.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_and_8 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#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)

Added: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_max_4.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_max_4.S?rev=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_max_4.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_max_4.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,20 @@
+/*===-- sync_fetch_and_max_4.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_max_4 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#define max_4(rD, rN, rM)  MINMAX_4(rD, rN, rM, gt)
+
+SYNC_OP_4(max_4)
+

Added: 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=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_max_8.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_max_8.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,19 @@
+/*===-- sync_fetch_and_max_8.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_max_8 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#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)

Added: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_min_4.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_min_4.S?rev=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_min_4.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_min_4.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,20 @@
+/*===-- sync_fetch_and_min_4.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_min_4 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#define min_4(rD, rN, rM) MINMAX_4(rD, rN, rM, lt)
+
+SYNC_OP_4(min_4)
+

Added: 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=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_min_8.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_min_8.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,19 @@
+/*===-- sync_fetch_and_min_8.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_min_8 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#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)

Added: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_nand_4.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_nand_4.S?rev=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_nand_4.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_nand_4.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,20 @@
+/*===-- sync_fetch_and_nand_4.S - -----------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_nand_4 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#define nand_4(rD, rN, rM)  bic rD, rN, rM
+
+SYNC_OP_4(nand_4)
+

Added: 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=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_nand_8.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_nand_8.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,22 @@
+/*===-- sync_fetch_and_nand_8.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_nand_8 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#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)
+

Added: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_or_4.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_or_4.S?rev=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_or_4.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_or_4.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,20 @@
+/*===-- sync_fetch_and_or_4.S - -------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_or_4 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#define or_4(rD, rN, rM)  orr rD, rN, rM
+
+SYNC_OP_4(or_4)
+

Added: 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=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_or_8.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_or_8.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,22 @@
+/*===-- sync_fetch_and_or_8.S - -------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_or_8 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#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)
+

Added: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_sub_4.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_sub_4.S?rev=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_sub_4.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_sub_4.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,21 @@
+/*===-- sync_fetch_and_sub_4.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_sub_4 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+/* "subs" is 2 bytes shorter than "sub". */
+#define sub_4(rD, rN, rM)  sub rD, rN, rM
+
+SYNC_OP_4(sub_4)
+

Added: 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=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_sub_8.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_sub_8.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,22 @@
+/*===-- sync_fetch_and_sub_8.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_sub_8 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#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)
+

Added: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umax_4.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umax_4.S?rev=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umax_4.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umax_4.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,20 @@
+/*===-- sync_fetch_and_umax_4.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_umax_4 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#define umax_4(rD, rN, rM)  MINMAX_4(rD, rN, rM, hi)
+
+SYNC_OP_4(umax_4)
+

Added: 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=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umax_8.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umax_8.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,19 @@
+/*===-- sync_fetch_and_umax_8.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_umax_8 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#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)

Added: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umin_4.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umin_4.S?rev=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umin_4.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umin_4.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,20 @@
+/*===-- sync_fetch_and_umin_4.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_umin_4 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#define umin_4(rD, rN, rM) MINMAX_4(rD, rN, rM, lo)
+
+SYNC_OP_4(umin_4)
+

Added: 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=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umin_8.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_umin_8.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,19 @@
+/*===-- sync_fetch_and_umin_8.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_umin_8 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#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)

Added: compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_xor_4.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_xor_4.S?rev=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_xor_4.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_xor_4.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,20 @@
+/*===-- sync_fetch_and_xor_4.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_xor_4 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#define xor_4(rD, rN, rM)  eor rD, rN, rM
+
+SYNC_OP_4(xor_4)
+

Added: 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=202812&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_xor_8.S (added)
+++ compiler-rt/trunk/lib/builtins/arm/sync_fetch_and_xor_8.S Tue Mar  4 04:10:17 2014
@@ -0,0 +1,22 @@
+/*===-- sync_fetch_and_xor_8.S - ------------------------------------------===//
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===//
+ *
+ * This file implements the __sync_fetch_and_xor_8 function for the ARM
+ * architecture.
+ *
+ *===----------------------------------------------------------------------===*/
+
+#include "sync-ops.h"
+
+#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)
+

Modified: compiler-rt/trunk/make/platform/clang_macho_embedded.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/platform/clang_macho_embedded.mk?rev=202812&r1=202811&r2=202812&view=diff
==============================================================================
--- compiler-rt/trunk/make/platform/clang_macho_embedded.mk (original)
+++ compiler-rt/trunk/make/platform/clang_macho_embedded.mk Tue Mar  4 04:10:17 2014
@@ -204,6 +204,26 @@ THUMB2_FUNCTIONS := \
 	switch32 \
 	switch8 \
 	switchu8 \
+	sync_fetch_and_add_4 \
+	sync_fetch_and_sub_4 \
+	sync_fetch_and_and_4 \
+	sync_fetch_and_or_4 \
+	sync_fetch_and_xor_4 \
+	sync_fetch_and_nand_4 \
+	sync_fetch_and_max_4 \
+	sync_fetch_and_umax_4 \
+	sync_fetch_and_min_4 \
+	sync_fetch_and_umin_4 \
+	sync_fetch_and_add_8 \
+	sync_fetch_and_sub_8 \
+	sync_fetch_and_and_8 \
+	sync_fetch_and_or_8 \
+	sync_fetch_and_xor_8 \
+	sync_fetch_and_nand_8 \
+	sync_fetch_and_max_8 \
+	sync_fetch_and_umax_8 \
+	sync_fetch_and_min_8 \
+	sync_fetch_and_umin_8
 
 I386_FUNCTIONS :=  \
 	i686.get_pc_thunk.eax \





More information about the llvm-commits mailing list