]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
bpabi.S (__aeabi_ldivmod): Perform division using __udivmoddi4, and fixups for negati...
authorCharles Baylis <charles.baylis@linaro.org>
Wed, 18 Jun 2014 15:42:53 +0000 (15:42 +0000)
committerCharles Baylis <cbaylis@gcc.gnu.org>
Wed, 18 Jun 2014 15:42:53 +0000 (15:42 +0000)
2014-06-18  Charles Baylis  <charles.baylis@linaro.org>

* config/arm/bpabi.S (__aeabi_ldivmod): Perform division using
__udivmoddi4, and fixups for negative operands.

From-SVN: r211794

gcc/ChangeLog
libgcc/config/arm/bpabi.S

index fec83a5883e647de1119eaec4665c03824689c39..3d46032ce32f0f9d866f58b94423bf829db1f6a7 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-18  Charles Baylis  <charles.baylis@linaro.org>
+
+       * config/arm/bpabi.S (__aeabi_ldivmod): Perform division using
+       __udivmoddi4, and fixups for negative operands.
+
 2014-06-18  Charles Baylis  <charles.baylis@linaro.org>
 
        * config/arm/bpabi.S (__aeabi_ldivmod): Optimise stack manipulation.
index 3f9ece58ba089860cdab94f438fcf6995acae1a4..c0441673029fe7247c14bacf65e3141cc2022113 100644 (file)
@@ -175,10 +175,49 @@ ARM_FUNC_START aeabi_ldivmod
        test_div_by_zero        signed
 
        push_for_divide __aeabi_ldivmod
+       cmp     xxh, #0
+       blt     1f
+       cmp     yyh, #0
+       blt     2f
+       /* arguments in (r0:r1), (r2:r3) and *sp */
+       bl      SYM(__udivmoddi4) __PLT__
+       pop_for_divide
+       RET
+
+1: /* xxh:xxl is negative */
+       negs    xxl, xxl
+       sbc     xxh, xxh, xxh, lsl #1   /* Thumb-2 has no RSC, so use X - 2X */
+       cmp     yyh, #0
+       blt     3f
+       /* arguments in (r0:r1), (r2:r3) and *sp */
+       bl      SYM(__udivmoddi4) __PLT__
+       pop_for_divide
+       negs    xxl, xxl
+       sbc     xxh, xxh, xxh, lsl #1   /* Thumb-2 has no RSC, so use X - 2X */
+       negs    yyl, yyl
+       sbc     yyh, yyh, yyh, lsl #1   /* Thumb-2 has no RSC, so use X - 2X */
+       RET
+
+2: /* only yyh:yyl is negative */
+       negs    yyl, yyl
+       sbc     yyh, yyh, yyh, lsl #1   /* Thumb-2 has no RSC, so use X - 2X */
+       /* arguments in (r0:r1), (r2:r3) and *sp */
+       bl      SYM(__udivmoddi4) __PLT__
+       pop_for_divide
+       negs    xxl, xxl
+       sbc     xxh, xxh, xxh, lsl #1   /* Thumb-2 has no RSC, so use X - 2X */
+       RET
+
+3: /* both xxh:xxl and yyh:yyl are negative */
+       negs    yyl, yyl
+       sbc     yyh, yyh, yyh, lsl #1   /* Thumb-2 has no RSC, so use X - 2X */
        /* arguments in (r0:r1), (r2:r3) and *sp */
-       bl      SYM(__gnu_ldivmod_helper) __PLT__
+       bl      SYM(__udivmoddi4) __PLT__
        pop_for_divide
+       negs    yyl, yyl
+       sbc     yyh, yyh, yyh, lsl #1   /* Thumb-2 has no RSC, so use X - 2X */
        RET
+
        cfi_end LSYM(Lend_aeabi_ldivmod)
        
 #endif /* L_aeabi_ldivmod */