libgcc/arc: Update udivmodsi4 and make the lib safe for rf16

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.
This commit is contained in:
Claudiu Zissulescu 2022-07-18 14:54:38 +03:00 committed by Claudiu Zissulescu
parent 7313381d2c
commit c8697735ab
2 changed files with 3 additions and 1 deletions

View 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

View 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;