]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgcc/arc: Update udivmodsi4 and make the lib safe for rf16
authorClaudiu Zissulescu <claziss@synopsys.com>
Mon, 18 Jul 2022 11:54:38 +0000 (14:54 +0300)
committerClaudiu Zissulescu <claziss@gmail.com>
Mon, 18 Jul 2022 12:00:53 +0000 (15:00 +0300)
The ARC soft udivmodsi4 algorithm and as well as using umodsi3
for reduced register set configurations are wrong.

libgcc/
* config/arc/lib2funcs.c (udivmodsi4): Update AND mask.
* config/arc/lib1funcs.S (umodsi3): Don't use it for RF16
configurations.

libgcc/config/arc/lib1funcs.S
libgcc/config/arc/lib2funcs.c

index 14fd1d2f303314d1638a2806cc952fd7b1a978b5..b06361257d12c0521ce2991c0b54b733686b8aba 100644 (file)
@@ -936,6 +936,7 @@ SYM(__divsi3):
 
 #endif /* L_divsi3 */
 
+#ifndef __ARC_RF16__
 #ifdef  L_umodsi3
        .section .text
        .align 4
@@ -950,6 +951,7 @@ SYM(__umodsi3):
        ENDFUNC(__umodsi3)
 
 #endif /* L_umodsi3 */
+#endif /* !__ARC_RF16__ */
 
 #ifdef  L_modsi3
        .section .text
index 70727b55365306d15fbdbbd666d530de43aa09af..8cba45172b213d1fafc0bf15047f1b03ba929512 100644 (file)
@@ -59,7 +59,7 @@ udivmodsi4 (nint32_t num, nint32_t den, word_t modwanted)
   nint32_t bit = 1;
   nint32_t res = 0;
 
-  while (den < num && bit && !(den & (1LL << 63)))
+  while (den < num && bit && !(den & (1L << 31)))
     {
       den <<= 1;
       bit <<= 1;