summaryrefslogtreecommitdiff
path: root/lib/builtins/arm/umodsi3.S
diff options
context:
space:
mode:
Diffstat (limited to 'lib/builtins/arm/umodsi3.S')
-rw-r--r--lib/builtins/arm/umodsi3.S61
1 files changed, 6 insertions, 55 deletions
diff --git a/lib/builtins/arm/umodsi3.S b/lib/builtins/arm/umodsi3.S
index 8a979e56c..164646b1f 100644
--- a/lib/builtins/arm/umodsi3.S
+++ b/lib/builtins/arm/umodsi3.S
@@ -16,9 +16,6 @@
.syntax unified
.text
-#if __ARM_ARCH_ISA_THUMB == 2
- .thumb
-#endif
.p2align 2
DEFINE_COMPILERRT_FUNCTION(__umodsi3)
@@ -33,7 +30,6 @@ DEFINE_COMPILERRT_FUNCTION(__umodsi3)
#else
cmp r1, #1
bcc LOCAL_LABEL(divby0)
- IT eq
moveq r0, #0
JMPc(lr, eq)
cmp r0, r1
@@ -43,15 +39,11 @@ DEFINE_COMPILERRT_FUNCTION(__umodsi3)
*
* r0 is the numerator, r1 the denominator.
*
- * For ARM:
* The code before JMP computes the correct shift I, so that
* r0 and (r1 << I) have the highest bit set in the same position.
* At the time of JMP, ip := .Ldiv0block - 8 * I.
* This depends on the fixed instruction size of block.
*
- * For Thumb:
- * Uses a jumptable to jump to the appropriate block.
- *
* block(shift) implements the test-and-update-quotient core.
* It assumes (r0 << shift) can be computed without overflow and
* that (r0 << shift) < 2 * r1. The quotient is stored in r3.
@@ -62,52 +54,12 @@ DEFINE_COMPILERRT_FUNCTION(__umodsi3)
clz r3, r1
/* r0 >= r1 implies clz(r0) <= clz(r1), so ip <= r3. */
sub r3, r3, ip
-#if __ARM_ARCH_ISA_THUMB == 2
- tbb [pc, r3]
-LOCAL_LABEL(JT):
- .byte (LOCAL_LABEL( 0) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL( 1) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL( 2) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL( 3) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL( 4) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL( 5) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL( 6) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL( 7) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL( 8) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL( 9) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(10) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(11) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(12) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(13) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(14) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(15) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(16) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(17) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(18) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(19) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(20) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(21) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(22) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(23) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(24) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(25) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(26) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(27) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(28) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(29) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(30) - LOCAL_LABEL(JT)) / 2
- .byte (LOCAL_LABEL(31) - LOCAL_LABEL(JT)) / 2
-#else
- adr ip, LOCAL_LABEL(0)
+ adr ip, LOCAL_LABEL(div0block)
sub ip, ip, r3, lsl #3
bx ip
-#endif
# else
-#if __ARM_ARCH_ISA_THUMB == 2
-#error unsupported configuration
-#endif
mov r2, r0
- adr ip, LOCAL_LABEL(0)
+ adr ip, LOCAL_LABEL(div0block)
lsr r3, r2, #16
cmp r3, r1
@@ -138,11 +90,9 @@ LOCAL_LABEL(JT):
#define IMM #
-#define block(shift) \
-LOCAL_LABEL(shift): \
- cmp r0, r1, lsl IMM shift; \
- IT hs; \
- subhs r0, r0, r1, lsl IMM shift
+#define block(shift) \
+ cmp r0, r1, lsl IMM shift; \
+ subhs r0, r0, r1, lsl IMM shift
block(31)
block(30)
@@ -175,6 +125,7 @@ LOCAL_LABEL(shift): \
block(3)
block(2)
block(1)
+LOCAL_LABEL(div0block):
block(0)
JMP(lr)
#endif /* __ARM_ARCH_EXT_IDIV__ */