From 0252cc9b62dfe20c77211f093b4fda54786177d3 Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Wed, 30 Dec 2020 17:45:56 +0200 Subject: mpi/longlong: add s390x/zSeries macros * mpi/longlong.h [__s390x__] (add_ssaaaa, sub_ddmmss, UTItype) (umul_ppmm, udiv_qrnnd): New. -- Signed-off-by: Jussi Kivilinna --- mpi/longlong.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'mpi') diff --git a/mpi/longlong.h b/mpi/longlong.h index 6573c984..85493871 100644 --- a/mpi/longlong.h +++ b/mpi/longlong.h @@ -1540,6 +1540,54 @@ extern USItype __udiv_qrnnd (); #endif /* __z8000__ */ +/*************************************** + *********** s390x/zSeries ************ + ***************************************/ +#if defined (__s390x__) && W_TYPE_SIZE == 64 && __GNUC__ >= 4 +# define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("algr %1,%5\n" \ + "alcgr %0,%3\n" \ + : "=r" ((sh)), \ + "=&r" ((sl)) \ + : "0" ((UDItype)(ah)), \ + "r" ((UDItype)(bh)), \ + "1" ((UDItype)(al)), \ + "r" ((UDItype)(bl)) \ + __CLOBBER_CC) +# define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("slgr %1,%5\n" \ + "slbgr %0,%3\n" \ + : "=r" ((sh)), \ + "=&r" ((sl)) \ + : "0" ((UDItype)(ah)), \ + "r" ((UDItype)(bh)), \ + "1" ((UDItype)(al)), \ + "r" ((UDItype)(bl)) \ + __CLOBBER_CC) +typedef unsigned int UTItype __attribute__ ((mode (TI))); +# define umul_ppmm(w1, w0, u, v) \ + do { \ + UTItype ___r; \ + __asm__ ("mlgr %0,%2" \ + : "=r" (___r) \ + : "0" ((UDItype)(u)), \ + "r" ((UDItype)(v))); \ + (w1) = ___r >> 64; \ + (w0) = (UDItype) ___r; \ + } while (0) +# define udiv_qrnnd(q, r, n1, n0, d) \ + do { \ + UTItype ___r = ((UTItype)n1 << 64) | n0; \ + __asm__ ("dlgr %0,%2" \ + : "=r" (___r) \ + : "0" (___r), \ + "r" ((UDItype)(d))); \ + (r) = ___r >> 64; \ + (q) = (UDItype) ___r; \ + } while (0) +#endif /* __s390x__ */ + + /*************************************** ***** End CPU Specific Versions ***** ***************************************/ -- cgit v1.2.1