]> www.ginac.de Git - cln.git/commitdiff
Remove all #if-def'ed out code regarding mulusmall_loop_up/down.
authorRichard Kreckel <kreckel@ginac.de>
Mon, 25 Apr 2022 22:14:39 +0000 (00:14 +0200)
committerRichard Kreckel <kreckel@ginac.de>
Mon, 25 Apr 2022 22:14:39 +0000 (00:14 +0200)
With a view on d58e9198, let's accept that 'digit' can be arbitrary.

src/base/digitseq/cl_DS.h
src/base/digitseq/cl_asm_arm_.cc
src/integer/conv/cl_I_from_digits.cc

index a4389cc208fa6eff8c0133ceccabfb2dfc066e82..3964e6b5501cc8e58f109fa8e4e1c8f90755b4a9 100644 (file)
@@ -1148,9 +1148,9 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des
 // Multiplikations-Einfachschleife:
 // Multipliziert eine UDS mit einem kleinen Digit und addiert ein kleines Digit.
 // mulusmall_loop_down(digit,ptr,len,newdigit)
-// multipliziert die UDS  ptr[-len..-1]  mit digit (>=2, <=36),
-// addiert dabei newdigit (>=0, <digit) zur letzten Ziffer,
-// und liefert den Carry (>=0, <digit).
+// multipliziert die UDS  ptr[-len..-1]  mit digit,
+// addiert dabei newdigit zur letzten Ziffer,
+// und liefert den Carry.
   #if HAVE_DD
   inline uintD mulusmall_loop_down (uintD digit, uintD* ptr, uintC len, uintD newdigit)
     { var uintDD carry = newdigit;
@@ -1862,9 +1862,9 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des
 // Multiplikations-Einfachschleife:
 // Multipliziert eine UDS mit einem kleinen Digit und addiert ein kleines Digit.
 // mulusmall_loop_up(digit,ptr,len,newdigit)
-// multipliziert die UDS  ptr[0..len-1]  mit digit (>=2, <=36),
-// addiert dabei newdigit (>=0, <digit) zur letzten Ziffer,
-// und liefert den Carry (>=0, <digit).
+// multipliziert die UDS  ptr[0..len-1]  mit digit,
+// addiert dabei newdigit zur letzten Ziffer,
+// und liefert den Carry.
   #if HAVE_DD
   inline uintD mulusmall_loop_up (uintD digit, uintD* ptr, uintC len, uintD newdigit)
     { var uintDD carry = newdigit;
index d333fdb73ab7141142cd7f3223e9c1ff532da940..00f9a09abbdc59236e1bd3264f088ba6d87549e5 100644 (file)
@@ -1807,27 +1807,18 @@ LABEL(mulusmall_loop_down_l1)
         MOV     a1,a4                   // return carry
         LDMFD   sp!,{v1,pc}
 #else
-        STMFD   sp!,{v1-v2,lr}
+        STMFD   sp!,{v1-v4,lr}
 LABEL(mulusmall_loop_down_l1)
         LDR     ip,[a2,#-4]!
 
-//      BL      mulu32_64_vregs         // muluD(digit,*--ptr,hi=,lo=)
-// replaced by multiplication of a small x = a1 and a big y = ip :
-        MOV     v1,ip,LSR #16           // top half of y
-        BIC     ip,ip,v1,LSL #16        // bottom half of y
-        MUL     v2,a1,v1                // middle section of result
-        MUL     v1,a1,ip                // low section of result
-        MOV     ip,#0                   // high section of result
-        ADDS    v1,v1,v2,LSL #16        // bottom 32 bits of result
-        ADC     ip,ip,v2,LSR #16        // top 32 bits of result
-
+        BL      mulu32_64_vregs         // muluD(digit,*--ptr,hi=,lo=)
         ADDS    v1,v1,a4                // lo += carry
         ADC     a4,ip,#0                // if (lo<carry) { hi += 1 }; carry=hi
         STR     v1,[a2,#0]              // *ptr = lo
         SUBS    a3,a3,#1                // len--
         BNE     mulusmall_loop_down_l1  // until len==0
         MOV     a1,a4                   // return carry
-        LDMFD   sp!,{v1-v2,pc}
+        LDMFD   sp!,{v1-v4,pc}
 #endif
 
 // extern void mulu_loop_down (uintD digit, uintD* sourceptr, uintD* destptr, uintC len);
@@ -3284,19 +3275,7 @@ LABEL(mulusmall_loop_up_l1)
 LABEL(mulusmall_loop_up_l1)
         LDR     ip,[a2]
 
-#if 1
         BL      mulu32_64_vregs         // muluD(digit,*ptr,hi=,lo=)
-#else
-// this code requires that digit is small, but this condition is violated in
-// digits_to_I_baseN(const char * MSBptr, uintC len, uintD base)
-        MOV     v1,ip,LSR #16           // top half of y
-        BIC     ip,ip,v1,LSL #16        // bottom half of y
-        MUL     v2,a1,v1                // middle section of result
-        MUL     v1,a1,ip                // low section of result
-        MOV     ip,#0                   // high section of result
-        ADDS    v1,v1,v2,LSL #16        // bottom 32 bits of result
-        ADC     ip,ip,v2,LSR #16        // top 32 bits of result
-#endif
         ADDS    v1,v1,a4                // lo += carry
         ADC     a4,ip,#0                // if (lo<carry) { hi += 1 }; carry=hi
         STR     v1,[a2],#4              // *ptr++ = lo
index 1819f5e89ea0eb4d94a17ffc76661424ea322500..681c51dde796a72f7ad30cb809b20cf5aa6cc1c5 100644 (file)
@@ -134,7 +134,6 @@ static const cl_I digits_to_I_baseN (const char * MSBptr, uintC len, uintD base)
                        chx++;
                        len--;
                }
-               // FIXME: mulusmall_loop_up/down are documented to require a small factor (<= 36).
                var uintD carry = mulusmall_loop_lsp(factor,erg_LSDptr,erg_len,newdigit);
                if (carry!=0) {
                        // need to extend NUDS: