Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/compiler_rt/dist/lib Fix builtin shadowing ...
details: https://anonhg.NetBSD.org/src/rev/1e7f02174c1e
branches: trunk
changeset: 793182:1e7f02174c1e
user: joerg <joerg%NetBSD.org@localhost>
date: Wed Jan 29 14:21:41 2014 +0000
description:
Fix builtin shadowing in PowerPC specific code. Implement clzdi/clzsi
for ARM.
diffstat:
sys/external/bsd/compiler_rt/dist/lib/arm/bswapdi2.S | 4 +-
sys/external/bsd/compiler_rt/dist/lib/arm/bswapsi2.S | 4 +-
sys/external/bsd/compiler_rt/dist/lib/arm/clzdi2.S | 89 ++++++++++++++++++
sys/external/bsd/compiler_rt/dist/lib/arm/clzsi2.S | 69 +++++++++++++
sys/external/bsd/compiler_rt/dist/lib/arm/comparesf2.S | 6 +-
sys/external/bsd/compiler_rt/dist/lib/arm/udivmodsi4.S | 7 -
sys/external/bsd/compiler_rt/dist/lib/arm/udivsi3.S | 9 -
sys/external/bsd/compiler_rt/dist/lib/arm/umodsi3.S | 9 -
sys/external/bsd/compiler_rt/dist/lib/assembly.h | 8 +
sys/external/bsd/compiler_rt/dist/lib/clear_cache.c | 21 ++++
sys/external/bsd/compiler_rt/dist/lib/ppc/DD.h | 2 +-
sys/external/bsd/compiler_rt/dist/lib/ppc/gcc_qadd.c | 4 +-
sys/external/bsd/compiler_rt/dist/lib/ppc/gcc_qsub.c | 4 +-
sys/external/bsd/compiler_rt/dist/lib/svn-commit.tmp | 9 +
14 files changed, 208 insertions(+), 37 deletions(-)
diffs (truncated from 408 to 300 lines):
diff -r 323612498694 -r 1e7f02174c1e sys/external/bsd/compiler_rt/dist/lib/arm/bswapdi2.S
--- a/sys/external/bsd/compiler_rt/dist/lib/arm/bswapdi2.S Wed Jan 29 13:06:36 2014 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/arm/bswapdi2.S Wed Jan 29 14:21:41 2014 +0000
@@ -16,7 +16,7 @@
//
.align 2
DEFINE_COMPILERRT_FUNCTION(__bswapdi2)
-#if __ARM_ARCH_5TEJ__ || __ARM_ARCH_4T__
+#if __ARM_ARCH < 6
// before armv6 does not have "rev" instruction
// r2 = rev(r0)
eor r2, r0, r0, ror #16
@@ -33,5 +33,5 @@
rev r0, r1 // r0 = rev(r1)
#endif
mov r1, r2 // r1 = r2 = rev(r0)
- bx lr
+ JMP(lr)
END_COMPILERRT_FUNCTION(__bswapdi2)
diff -r 323612498694 -r 1e7f02174c1e sys/external/bsd/compiler_rt/dist/lib/arm/bswapsi2.S
--- a/sys/external/bsd/compiler_rt/dist/lib/arm/bswapsi2.S Wed Jan 29 13:06:36 2014 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/arm/bswapsi2.S Wed Jan 29 14:21:41 2014 +0000
@@ -16,7 +16,7 @@
//
.align 2
DEFINE_COMPILERRT_FUNCTION(__bswapsi2)
-#if __ARM_ARCH_5TEJ__ || __ARM_ARCH_4T__
+#if __ARM_ARCH < 6
// before armv6 does not have "rev" instruction
eor r1, r0, r0, ror #16
bic r1, r1, #0xff0000
@@ -25,5 +25,5 @@
#else
rev r0, r0
#endif
- bx lr
+ JMP(lr)
END_COMPILERRT_FUNCTION(__bswapsi2)
diff -r 323612498694 -r 1e7f02174c1e sys/external/bsd/compiler_rt/dist/lib/arm/clzdi2.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/arm/clzdi2.S Wed Jan 29 14:21:41 2014 +0000
@@ -0,0 +1,89 @@
+/* ===-- clzdi2.c - Implement __clzdi2 -------------------------------------===
+ *
+ * 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 count leading zeros for 64bit arguments.
+ *
+ * ===----------------------------------------------------------------------===
+ */
+#include "../assembly.h"
+
+ .syntax unified
+
+ .text
+ .align 2
+DEFINE_COMPILERRT_FUNCTION(__clzdi2)
+#ifdef __ARM_FEATURE_CLZ
+#ifdef __ARMEB__
+ cmp r0, 0
+ itee ne
+ clzne r0, r0
+ clzeq r0, r1
+ addeq r0, r0, 32
+#else
+ cmp r1, 0
+ itee ne
+ clzne r0, r1
+ clzeq r0, r0
+ addeq r0, r0, 32
+#endif
+ JMP(lr)
+#else
+ /* Assumption: n != 0 */
+
+ /*
+ * r0: n
+ * r1: upper half of n, overwritten after check
+ * r1: count of leading zeros in n + 1
+ * r2: scratch register for shifted r0
+ */
+#ifdef __ARMEB__
+ cmp r0, 0
+ moveq r0, r1
+#else
+ cmp r1, 0
+ movne r0, r1
+#endif
+ movne r1, 1
+ moveq r1, 33
+
+ /*
+ * Basic block:
+ * if ((r0 >> SHIFT) == 0)
+ * r1 += SHIFT;
+ * else
+ * r0 >>= SHIFT;
+ * for descending powers of two as SHIFT.
+ */
+#define BLOCK(shift) \
+ lsrs r2, r0, shift; \
+ movne r0, r2; \
+ addeq r1, shift \
+
+ BLOCK(16)
+ BLOCK(8)
+ BLOCK(4)
+ BLOCK(2)
+
+ /*
+ * The basic block invariants at this point are (r0 >> 2) == 0 and
+ * r0 != 0. This means 1 <= r0 <= 3 and 0 <= (r0 >> 1) <= 1.
+ *
+ * r0 | (r0 >> 1) == 0 | (r0 >> 1) == 1 | -(r0 >> 1) | 1 - (r0 >> 1)
+ * ---+----------------+----------------+------------+--------------
+ * 1 | 1 | 0 | 0 | 1
+ * 2 | 0 | 1 | -1 | 0
+ * 3 | 0 | 1 | -1 | 0
+ *
+ * The r1's initial value of 1 compensates for the 1 here.
+ */
+ sub r0, r1, r0, lsr #1
+
+ JMP(lr)
+#endif // __ARM_FEATURE_CLZ
+END_COMPILERRT_FUNCTION(__clzdi2)
diff -r 323612498694 -r 1e7f02174c1e sys/external/bsd/compiler_rt/dist/lib/arm/clzsi2.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/arm/clzsi2.S Wed Jan 29 14:21:41 2014 +0000
@@ -0,0 +1,69 @@
+/* ===-- clzsi2.c - Implement __clzsi2 -------------------------------------===
+ *
+ * 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 count leading zeros for 32bit arguments.
+ *
+ * ===----------------------------------------------------------------------===
+ */
+#include "../assembly.h"
+
+ .syntax unified
+
+ .text
+ .align 2
+DEFINE_COMPILERRT_FUNCTION(__clzsi2)
+#ifdef __ARM_FEATURE_CLZ
+ clz r0, r0
+ JMP(lr)
+#else
+ /* Assumption: n != 0 */
+
+ /*
+ * r0: n
+ * r1: count of leading zeros in n + 1
+ * r2: scratch register for shifted r0
+ */
+ mov r1, 1
+
+ /*
+ * Basic block:
+ * if ((r0 >> SHIFT) == 0)
+ * r1 += SHIFT;
+ * else
+ * r0 >>= SHIFT;
+ * for descending powers of two as SHIFT.
+ */
+
+#define BLOCK(shift) \
+ lsrs r2, r0, shift; \
+ movne r0, r2; \
+ addeq r1, shift \
+
+ BLOCK(16)
+ BLOCK(8)
+ BLOCK(4)
+ BLOCK(2)
+
+ /*
+ * The basic block invariants at this point are (r0 >> 2) == 0 and
+ * r0 != 0. This means 1 <= r0 <= 3 and 0 <= (r0 >> 1) <= 1.
+ *
+ * r0 | (r0 >> 1) == 0 | (r0 >> 1) == 1 | -(r0 >> 1) | 1 - (r0 >> 1)
+ * ---+----------------+----------------+------------+--------------
+ * 1 | 1 | 0 | 0 | 1
+ * 2 | 0 | 1 | -1 | 0
+ * 3 | 0 | 1 | -1 | 0
+ *
+ * The r1's initial value of 1 compensates for the 1 here.
+ */
+ sub r0, r1, r0, lsr #1
+
+ JMP(lr)
+#endif // __ARM_FEATURE_CLZ
+END_COMPILERRT_FUNCTION(__clzsi2)
diff -r 323612498694 -r 1e7f02174c1e sys/external/bsd/compiler_rt/dist/lib/arm/comparesf2.S
--- a/sys/external/bsd/compiler_rt/dist/lib/arm/comparesf2.S Wed Jan 29 13:06:36 2014 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/arm/comparesf2.S Wed Jan 29 14:21:41 2014 +0000
@@ -99,7 +99,7 @@
ite ls
cmpls r3, #0xff000000
movhi r0, #1
- bx lr
+ JMP(lr)
END_COMPILERRT_FUNCTION(__eqsf2)
DEFINE_COMPILERRT_FUNCTION_ALIAS(__lesf2, __eqsf2)
DEFINE_COMPILERRT_FUNCTION_ALIAS(__ltsf2, __eqsf2)
@@ -128,7 +128,7 @@
ite ls
cmpls r3, #0xff000000
movhi r0, #-1
- bx lr
+ JMP(lr)
END_COMPILERRT_FUNCTION(__gtsf2)
DEFINE_COMPILERRT_FUNCTION_ALIAS(__gesf2, __gtsf2)
@@ -142,7 +142,7 @@
ite ls
cmpls r3, #0xff000000
movhi r0, #1
- bx lr
+ JMP(lr)
END_COMPILERRT_FUNCTION(__unordsf2)
DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_fcmpun, __unordsf2)
diff -r 323612498694 -r 1e7f02174c1e sys/external/bsd/compiler_rt/dist/lib/arm/udivmodsi4.S
--- a/sys/external/bsd/compiler_rt/dist/lib/arm/udivmodsi4.S Wed Jan 29 13:06:36 2014 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/arm/udivmodsi4.S Wed Jan 29 14:21:41 2014 +0000
@@ -16,14 +16,7 @@
.syntax unified
-#ifdef ARM_HAS_BX
-#define JMP(r) bx r
-#else
-#define JMP(r) mov pc, r
-#endif
-
.text
- .arm
.p2align 2
DEFINE_COMPILERRT_FUNCTION(__udivmodsi4)
#if __ARM_ARCH_EXT_IDIV__
diff -r 323612498694 -r 1e7f02174c1e sys/external/bsd/compiler_rt/dist/lib/arm/udivsi3.S
--- a/sys/external/bsd/compiler_rt/dist/lib/arm/udivsi3.S Wed Jan 29 13:06:36 2014 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/arm/udivsi3.S Wed Jan 29 14:21:41 2014 +0000
@@ -16,16 +16,7 @@
.syntax unified
-#ifdef ARM_HAS_BX
-#define JMP(r) bx r
-#define JMPc(r,c) bx##c r
-#else
-#define JMP(r) mov pc, r
-#define JMPc(r,c) mov##c pc, r
-#endif
-
.text
- .arm
.p2align 2
DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_uidiv, __udivsi3)
DEFINE_COMPILERRT_FUNCTION(__udivsi3)
diff -r 323612498694 -r 1e7f02174c1e sys/external/bsd/compiler_rt/dist/lib/arm/umodsi3.S
--- a/sys/external/bsd/compiler_rt/dist/lib/arm/umodsi3.S Wed Jan 29 13:06:36 2014 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/arm/umodsi3.S Wed Jan 29 14:21:41 2014 +0000
@@ -16,16 +16,7 @@
.syntax unified
-#ifdef ARM_HAS_BX
-#define JMP(r) bx r
-#define JMPc(r,c) bx##c r
-#else
-#define JMP(r) mov pc, r
-#define JMPc(r,c) mov##c pc, r
-#endif
-
.text
- .arm
.p2align 2
DEFINE_COMPILERRT_FUNCTION(__umodsi3)
#if __ARM_ARCH_EXT_IDIV__
diff -r 323612498694 -r 1e7f02174c1e sys/external/bsd/compiler_rt/dist/lib/assembly.h
--- a/sys/external/bsd/compiler_rt/dist/lib/assembly.h Wed Jan 29 13:06:36 2014 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/assembly.h Wed Jan 29 14:21:41 2014 +0000
@@ -74,6 +74,14 @@
(__ARM_ARCH >= 6 || (__ARM_ARCH == 5 && !defined(__ARM_ARCH_5__)))
# define __ARM_FEATURE_CLZ
# endif
+
Home |
Main Index |
Thread Index |
Old Index