diff options
author | Pádraig Brady <P@draigBrady.com> | 2022-04-04 13:41:32 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2022-04-04 13:41:32 +0100 |
commit | 224c1fee6901183e8616661da88a30ee1ee6d0b3 (patch) | |
tree | 2e3e556b319585f05cad4db21f00e087f5a1e334 | |
parent | 8d9321ee0f73632eafe4b75e58dc7da7627cb97f (diff) | |
download | coreutils-224c1fee6901183e8616661da88a30ee1ee6d0b3.tar.gz |
factor: improve support on RISCV and loongson
* src/longlong.h: Pull in RISCV fix and loongarch64 support from
https://gmplib.org/repo/gmp/log/tip/longlong.h
-rw-r--r-- | src/longlong.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/longlong.h b/src/longlong.h index 279e6a7b3..6e279b466 100644 --- a/src/longlong.h +++ b/src/longlong.h @@ -1142,6 +1142,17 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype); #endif /* i960mx */ #endif /* i960 */ + +#if defined (__loongarch64) && W_TYPE_SIZE == 64 +#define umul_ppmm(w1, w0, u, v) \ + do { \ + UDItype __u = (u), __v = (v); \ + (w0) = __u * __v; \ + (w1) = (unsigned __int128__) __u * __v >> 64; \ + } while (0) +#endif + + #if (defined (__mc68000__) || defined (__mc68020__) || defined(mc68020) \ || defined (__m68k__) || defined (__mc5200__) || defined (__mc5206e__) \ || defined (__mc5307__)) && W_TYPE_SIZE == 32 @@ -1638,12 +1649,12 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype); } while (0) #endif /* RT/ROMP */ -#if defined (__riscv64) && W_TYPE_SIZE == 64 +#if defined (__riscv) && defined (__riscv_mul) && W_TYPE_SIZE == 64 #define umul_ppmm(ph, pl, u, v) \ do { \ UDItype __u = (u), __v = (v); \ (pl) = __u * __v; \ - __asm__ ("mulhu\t%2, %1, %0" : "=r" (ph) : "%r" (__u), "r" (__v)); \ + __asm__ ("mulhu\t%0, %1, %2" : "=r" (ph) : "%r" (__u), "r" (__v)); \ } while (0) #endif |