aboutsummaryrefslogtreecommitdiff
path: root/libgcc/soft-fp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2025-05-20 08:20:16 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2025-05-20 08:20:16 +0200
commit092dcef93d40ff3dfed6c35001325bf522785c25 (patch)
treedb837dbbaab0c560f32d2e7da1fafa1f6a852609 /libgcc/soft-fp
parent1c32b55b99ea55035a7c726e358f75f8bf9df038 (diff)
downloadgcc-092dcef93d40ff3dfed6c35001325bf522785c25.zip
gcc-092dcef93d40ff3dfed6c35001325bf522785c25.tar.gz
gcc-092dcef93d40ff3dfed6c35001325bf522785c25.tar.bz2
libgcc: Small bitint_reduce_prec big-endian fixes
The big-endian _BitInt support in libgcc was written without any testing and so I haven't discovered I've made one mistake in it (in multiple places). The bitint_reduce_prec function attempts to optimize inputs which have some larger precision but at runtime they are found to need smaller number of limbs. For little-endian that is handled just by returning smaller precision (or negative precision for signed), but for big-endian we need to adjust the passed in limb pointer so that when it returns smaller precision the argument still contains the least significant limbs for the returned precision. 2025-05-20 Jakub Jelinek <jakub@redhat.com> * libgcc2.c (bitint_reduce_prec): For big endian __LIBGCC_BITINT_ORDER__ use ++*p and --*p instead of ++p and --p. * soft-fp/bitint.h (bitint_reduce_prec): Likewise.
Diffstat (limited to 'libgcc/soft-fp')
-rw-r--r--libgcc/soft-fp/bitint.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/libgcc/soft-fp/bitint.h b/libgcc/soft-fp/bitint.h
index 07a7bcb..8d489e6 100644
--- a/libgcc/soft-fp/bitint.h
+++ b/libgcc/soft-fp/bitint.h
@@ -76,7 +76,7 @@ bitint_reduce_prec (const UBILtype **p, SItype prec)
if (prec >= -1)
return -2;
#if __LIBGCC_BITINT_ORDER__ == __ORDER_BIG_ENDIAN__
- ++p;
+ ++*p;
#else
--i;
#endif
@@ -90,7 +90,7 @@ bitint_reduce_prec (const UBILtype **p, SItype prec)
if (prec >= -1)
return -2;
#if __LIBGCC_BITINT_ORDER__ == __ORDER_BIG_ENDIAN__
- ++p;
+ ++*p;
#else
--i;
#endif
@@ -101,7 +101,7 @@ bitint_reduce_prec (const UBILtype **p, SItype prec)
if ((BILtype) mslimb >= 0)
{
#if __LIBGCC_BITINT_ORDER__ == __ORDER_BIG_ENDIAN__
- --p;
+ --*p;
#endif
return prec - 1;
}
@@ -130,7 +130,7 @@ bitint_reduce_prec (const UBILtype **p, SItype prec)
if (prec == 0)
return 1;
#if __LIBGCC_BITINT_ORDER__ == __ORDER_BIG_ENDIAN__
- ++p;
+ ++*p;
#else
--i;
#endif
@@ -143,7 +143,7 @@ bitint_reduce_prec (const UBILtype **p, SItype prec)
if (prec == 0)
return 1;
#if __LIBGCC_BITINT_ORDER__ == __ORDER_BIG_ENDIAN__
- ++p;
+ ++*p;
#else
--i;
#endif