Hello,
I was able to build package gmp-ecm_6.4.4+ds-2 with patch that is attached.
First part of patch is taken from upstream (file longlong.h)
I had to add second part (file sp.h) in order to build package successfully.
Patch is attached.
Alternatively, if following code for umul_ppm is used, instead of upstream
patch,
package also does build successfully.
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("multu %2,%3\n\tmflo %0\n\tmfhi %1" \
: "=d" (w0), "=d" (w1) : "d" (u), "d" (v))
Thank you!
Regards,
Jurica
--- gmp-ecm-6.4.4+ds.orig/longlong.h
+++ gmp-ecm-6.4.4+ds/longlong.h
@@ -931,10 +931,19 @@ extern UWtype __MPN(udiv_qrnnd) _PROTO (
#endif /* __m88000__ */
#if defined (__mips) && W_TYPE_SIZE == 32
-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
+#if __GMP_GNUC_PREREQ (4,4)
+ #define umul_ppmm(w1, w0, u, v) \
+ do { \
+ UDItype __ll = (UDItype)(u) * (v); \
+ w1 = __ll >> 32; \
+ w0 = __ll; \
+ } while (0)
+#endif
+#if !defined (umul_ppmm) && __GMP_GNUC_PREREQ (2,7)
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("multu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
-#else
+#endif
+#if !defined (umul_ppmm)
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("multu %2,%3\n\tmflo %0\n\tmfhi %1" \
: "=d" (w0), "=d" (w1) : "d" (u), "d" (v))
--- gmp-ecm-6.4.4+ds.orig/sp.h
+++ gmp-ecm-6.4.4+ds/sp.h
@@ -69,7 +69,7 @@ extern size_t MPZSPV_NORMALISE_STRIDE;
* note that a small prime must be the size of a GMP limb */
typedef mp_limb_t UWtype;
typedef unsigned int UHWtype;
-#if (defined(_PA_RISC1_1) && defined(__GNUC__))
+#if ((defined(_PA_RISC1_1) || defined(__mips)) && defined(__GNUC__))
/* this seems to be needed, otherwise umul_ppmm() does not work properly */
typedef mp_limb_t USItype __attribute__ ((mode (SI)));
typedef mp_limb_t UDItype __attribute__ ((mode (DI)));