[PATCH] Revert Thumb-2 conversion of ARM builtins.
Stephen Hines
srhines at google.com
Thu Jul 17 01:25:13 PDT 2014
This cuts the revert down to just the 3 affected files, if that is more
acceptable.
Thanks,
Steve
>From 0c86082f6c3010da95176d5ed1be8921952fff04 Mon Sep 17 00:00:00 2001
From: Stephen Hines <srhines at google.com>
Date: Thu, 17 Jul 2014 00:48:53 -0700
Subject: [PATCH] Revert Thumb-2 conversion of some ARM builtins.
The udivmodsi4/modsi3/umodsi3 code computes jump targets based on ARM
encodings
(if CLZ is present and IDIV is not present).
Reverts parts of r211032 and r211035.
---
lib/builtins/arm/udivmodsi4.S | 16 +++-------------
lib/builtins/arm/udivsi3.S | 21 +++------------------
lib/builtins/arm/umodsi3.S | 18 ++----------------
3 files changed, 8 insertions(+), 47 deletions(-)
diff --git a/lib/builtins/arm/udivmodsi4.S b/lib/builtins/arm/udivmodsi4.S
index 5b4e1bc..ddc8752 100644
--- a/lib/builtins/arm/udivmodsi4.S
+++ b/lib/builtins/arm/udivmodsi4.S
@@ -16,9 +16,6 @@
.syntax unified
.text
-#if __ARM_ARCH_ISA_THUMB == 2
- .thumb
-#endif
.p2align 2
DEFINE_COMPILERRT_FUNCTION(__udivmodsi4)
@@ -99,16 +96,9 @@ DEFINE_COMPILERRT_FUNCTION(__udivmodsi4)
#define IMM #
-#if __ARM_ARCH_ISA_THUMB == 2
-#define ITT itt
-#else
-#define ITT @
-#endif
-
-#define block(shift)
\
- cmp r0, r1, lsl IMM shift; \
- ITT hs; \
- addhs r3, r3, IMM (1 << shift); \
+#define block(shift) \
+ cmp r0, r1, lsl IMM shift; \
+ addhs r3, r3, IMM (1 << shift); \
subhs r0, r0, r1, lsl IMM shift
block(31)
diff --git a/lib/builtins/arm/udivsi3.S b/lib/builtins/arm/udivsi3.S
index 8695257..8fb1dca 100644
--- a/lib/builtins/arm/udivsi3.S
+++ b/lib/builtins/arm/udivsi3.S
@@ -16,17 +16,6 @@
.syntax unified
.text
-#if __ARM_ARCH_ISA_THUMB == 2
- .thumb
-#endif
-
-#if __ARM_ARCH_ISA_THUMB == 2
-#define IT it
-#define ITT itt
-#else
-#define IT @
-#define ITT @
-#endif
.p2align 2
DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_uidiv, __udivsi3)
@@ -40,12 +29,9 @@ DEFINE_COMPILERRT_FUNCTION(__udivsi3)
bx lr
#else
cmp r1, #1
- IT cc
bcc LOCAL_LABEL(divby0)
- IT eq
JMPc(lr, eq)
cmp r0, r1
- ITT cc
movcc r0, #0
JMPc(lr, cc)
/*
@@ -108,10 +94,9 @@ DEFINE_COMPILERRT_FUNCTION(__udivsi3)
#define IMM #
-#define block(shift)
\
- cmp r0, r1, lsl IMM shift; \
- ITT hs; \
- addhs r3, r3, IMM (1 << shift); \
+#define block(shift) \
+ cmp r0, r1, lsl IMM shift; \
+ addhs r3, r3, IMM (1 << shift); \
subhs r0, r0, r1, lsl IMM shift
block(31)
diff --git a/lib/builtins/arm/umodsi3.S b/lib/builtins/arm/umodsi3.S
index c690df3..164646b 100644
--- a/lib/builtins/arm/umodsi3.S
+++ b/lib/builtins/arm/umodsi3.S
@@ -16,17 +16,6 @@
.syntax unified
.text
-#if __ARM_ARCH_ISA_THUMB == 2
- .thumb
-#endif
-
-#if __ARM_ARCH_ISA_THUMB == 2
-#define IT it
-#define ITT itt
-#else
-#define IT @
-#define ITT @
-#endif
.p2align 2
DEFINE_COMPILERRT_FUNCTION(__umodsi3)
@@ -41,11 +30,9 @@ DEFINE_COMPILERRT_FUNCTION(__umodsi3)
#else
cmp r1, #1
bcc LOCAL_LABEL(divby0)
- ITT eq
moveq r0, #0
JMPc(lr, eq)
cmp r0, r1
- IT cc
JMPc(lr, cc)
/*
* Implement division using binary long division algorithm.
@@ -103,9 +90,8 @@ DEFINE_COMPILERRT_FUNCTION(__umodsi3)
#define IMM #
-#define block(shift)
\
- cmp r0, r1, lsl IMM shift; \
- IT hs; \
+#define block(shift) \
+ cmp r0, r1, lsl IMM shift; \
subhs r0, r0, r1, lsl IMM shift
block(31)
--
2.0.0.526.g5318336
On Thu, Jul 17, 2014 at 1:12 AM, Stephen Hines <srhines at google.com> wrote:
> Many of the files in this change use computed jumps and it seems like
> there were no tests checked in to verify the new Thumb-2 behavior. The
> original change also claims that the "code remains compatible with older
> CPUs with no adverse effects". I dispute that there are no adverse effects
> here, since the Thumb-2 predicated instructions certainly have different
> timings/behavior than their equivalent ARM counterparts.
>
> Steve
>
>
> On Thu, Jul 17, 2014 at 1:02 AM, Tim Northover <t.p.northover at gmail.com>
> wrote:
>
>> Hi Stephen,
>>
>>
>> > The umodsi3 code computes jump targets based on ARM encodings (if CLZ is
>> > present and IDIV is not present).
>>
>> Reverting everything seems a little extreme if only a few functions
>> are computing jumps like this. Can't we be a bit more targeted?
>>
>> Cheers.
>>
>> Tim.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140717/eded4cf3/attachment.html>
More information about the llvm-commits
mailing list