MIPS: math-emu: Turn macros into functions where possible.
authorRalf Baechle <ralf@linux-mips.org>
Fri, 18 Apr 2014 22:36:32 +0000 (00:36 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 21 May 2014 09:12:57 +0000 (11:12 +0200)
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
39 files changed:
arch/mips/math-emu/dp_add.c
arch/mips/math-emu/dp_cmp.c
arch/mips/math-emu/dp_div.c
arch/mips/math-emu/dp_fint.c
arch/mips/math-emu/dp_flong.c
arch/mips/math-emu/dp_frexp.c
arch/mips/math-emu/dp_fsp.c
arch/mips/math-emu/dp_logb.c
arch/mips/math-emu/dp_modf.c
arch/mips/math-emu/dp_mul.c
arch/mips/math-emu/dp_scalb.c
arch/mips/math-emu/dp_simple.c
arch/mips/math-emu/dp_sqrt.c
arch/mips/math-emu/dp_sub.c
arch/mips/math-emu/dp_tint.c
arch/mips/math-emu/dp_tlong.c
arch/mips/math-emu/ieee754.c
arch/mips/math-emu/ieee754.h
arch/mips/math-emu/ieee754dp.c
arch/mips/math-emu/ieee754dp.h
arch/mips/math-emu/ieee754int.h
arch/mips/math-emu/ieee754sp.c
arch/mips/math-emu/ieee754sp.h
arch/mips/math-emu/sp_add.c
arch/mips/math-emu/sp_cmp.c
arch/mips/math-emu/sp_div.c
arch/mips/math-emu/sp_fdp.c
arch/mips/math-emu/sp_fint.c
arch/mips/math-emu/sp_flong.c
arch/mips/math-emu/sp_frexp.c
arch/mips/math-emu/sp_logb.c
arch/mips/math-emu/sp_modf.c
arch/mips/math-emu/sp_mul.c
arch/mips/math-emu/sp_scalb.c
arch/mips/math-emu/sp_simple.c
arch/mips/math-emu/sp_sqrt.c
arch/mips/math-emu/sp_sub.c
arch/mips/math-emu/sp_tint.c
arch/mips/math-emu/sp_tlong.c

index b5aac129e9f1749be9dd0206b2b7847f908213ef..7daaafcfeb781ccbcb78c40aec205b9eaf699c0e 100644 (file)
@@ -35,7 +35,7 @@ union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y)
        EXPLODEXDP;
        EXPLODEYDP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        FLUSHXDP;
        FLUSHYDP;
@@ -52,7 +52,7 @@ union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y)
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754dp_nanxcpt(ieee754dp_indef(), "add", x, y);
 
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
@@ -75,7 +75,7 @@ union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y)
        case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
                if (xs == ys)
                        return x;
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754dp_xcpt(ieee754dp_indef(), "add", x, y);
 
        case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
index a3b4984d2e83f5cf98b772ebc944d308455fc6c2..a8da7257a2e8070715bea2b925ec189338f84f49 100644 (file)
@@ -35,15 +35,15 @@ int ieee754dp_cmp(union ieee754dp x, union ieee754dp y, int cmp, int sig)
        EXPLODEYDP;
        FLUSHXDP;
        FLUSHYDP;
-       CLEARCX;        /* Even clear inexact flag here */
+       ieee754_clearcx();      /* Even clear inexact flag here */
 
        if (ieee754dp_isnan(x) || ieee754dp_isnan(y)) {
                if (sig || xc == IEEE754_CLASS_SNAN || yc == IEEE754_CLASS_SNAN)
-                       SETCX(IEEE754_INVALID_OPERATION);
+                       ieee754_setcx(IEEE754_INVALID_OPERATION);
                if (cmp & IEEE754_CUN)
                        return 1;
                if (cmp & (IEEE754_CLT | IEEE754_CGT)) {
-                       if (sig && SETANDTESTCX(IEEE754_INVALID_OPERATION))
+                       if (sig && ieee754_setandtestcx(IEEE754_INVALID_OPERATION))
                                return ieee754si_xcpt(0, "fcmpf", x);
                }
                return 0;
index 30cc7fa3ce37f2efd52aa98b9319b2fd20029ada..3b568b718d52ba413035d63b96063c469a096888 100644 (file)
@@ -34,7 +34,7 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y)
        EXPLODEXDP;
        EXPLODEYDP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        FLUSHXDP;
        FLUSHYDP;
@@ -51,7 +51,7 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y)
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754dp_nanxcpt(ieee754dp_indef(), "div", x, y);
 
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
@@ -72,7 +72,7 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y)
                 */
 
        case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754dp_xcpt(ieee754dp_indef(), "div", x, y);
 
        case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
@@ -89,12 +89,12 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y)
                 */
 
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO):
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754dp_xcpt(ieee754dp_indef(), "div", x, y);
 
        case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO):
        case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
-               SETCX(IEEE754_ZERO_DIVIDE);
+               ieee754_setcx(IEEE754_ZERO_DIVIDE);
                return ieee754dp_xcpt(ieee754dp_inf(xs ^ ys), "div", x, y);
 
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM):
index 60ed6ec7ddc7b599e7af8df8ec61526619ef5183..fa75f5dd5587bf2383121cce910300d87ad119ad 100644 (file)
@@ -32,7 +32,7 @@ union ieee754dp ieee754dp_fint(int x)
        int xe;
        int xs;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        if (x == 0)
                return ieee754dp_zero(0);
index 2418f9d030559edd84e724f79622c64eee55ab7f..89bd57917c94de66e80cb741279845494004201b 100644 (file)
@@ -32,7 +32,7 @@ union ieee754dp ieee754dp_flong(s64 x)
        int xe;
        int xs;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        if (x == 0)
                return ieee754dp_zero(0);
index 6ab7df9583629dd60bb4a32130fddaab506edc30..25ebce16143ec6a30e266113123aabfffb3ec31a 100644 (file)
@@ -31,7 +31,7 @@
 union ieee754dp ieee754dp_frexp(union ieee754dp x, int *eptr)
 {
        COMPXDP;
-       CLEARCX;
+       ieee754_clearcx();
        EXPLODEXDP;
 
        switch (xc) {
index d69cb1ad3f60d45114a1717ff68d59f3f4ed1300..cacd9f3286905534658bcfa52ea3c6e82235e468 100644 (file)
@@ -32,13 +32,13 @@ union ieee754dp ieee754dp_fsp(union ieee754sp x)
 
        EXPLODEXSP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        FLUSHXSP;
 
        switch (xc) {
        case IEEE754_CLASS_SNAN:
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754dp_nanxcpt(ieee754dp_indef(), "fsp");
        case IEEE754_CLASS_QNAN:
                return ieee754dp_nanxcpt(builddp(xs,
index 80116e2f331f034a288ce68da64174418ec9f6f4..b412c90355cde62f766e99b7c679a00be831a021 100644 (file)
@@ -30,7 +30,7 @@ union ieee754dp ieee754dp_logb(union ieee754dp x)
 {
        COMPXDP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        EXPLODEXDP;
 
index cbc1386cdfca32ddc563f9000fe602d88263ff27..61733ff512c7e22f0d25cd423e3fd3a0c3863364 100644 (file)
@@ -32,7 +32,7 @@ union ieee754dp ieee754dp_modf(union ieee754dp x, union ieee754dp *ip)
 {
        COMPXDP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        EXPLODEXDP;
 
index c4cad69c377e28dc7b1e60872358280375fd4470..8f1bef91aa95f831899d52a21b8015fa5b248f63 100644 (file)
@@ -34,7 +34,7 @@ union ieee754dp ieee754dp_mul(union ieee754dp x, union ieee754dp y)
        EXPLODEXDP;
        EXPLODEYDP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        FLUSHXDP;
        FLUSHYDP;
@@ -51,7 +51,7 @@ union ieee754dp ieee754dp_mul(union ieee754dp x, union ieee754dp y)
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754dp_nanxcpt(ieee754dp_indef(), "mul", x, y);
 
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
@@ -72,7 +72,7 @@ union ieee754dp ieee754dp_mul(union ieee754dp x, union ieee754dp y)
 
        case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754dp_xcpt(ieee754dp_indef(), "mul", x, y);
 
        case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
index 4f8b65622942a24934cff6465cbade926b1319ae..dee37551fae1b31c1945dd8222337870c6699581 100644 (file)
@@ -30,7 +30,7 @@ union ieee754dp ieee754dp_scalb(union ieee754dp x, int n)
 {
        COMPXDP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        EXPLODEXDP;
 
index b341cc83eeb0fe24c81839d80dc8863e2db59fac..c116502a00b7c3da64525acd520504f734cddd0b 100644 (file)
@@ -33,7 +33,7 @@ int ieee754dp_finite(union ieee754dp x)
 
 union ieee754dp ieee754dp_copysign(union ieee754dp x, union ieee754dp y)
 {
-       CLEARCX;
+       ieee754_clearcx();
        DPSIGN(x) = DPSIGN(y);
        return x;
 }
@@ -44,7 +44,7 @@ union ieee754dp ieee754dp_neg(union ieee754dp x)
        COMPXDP;
 
        EXPLODEXDP;
-       CLEARCX;
+       ieee754_clearcx();
        FLUSHXDP;
 
        /*
@@ -56,7 +56,7 @@ union ieee754dp ieee754dp_neg(union ieee754dp x)
 
        if (xc == IEEE754_CLASS_SNAN) {
                union ieee754dp y = ieee754dp_indef();
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                DPSIGN(y) = DPSIGN(x);
                return ieee754dp_nanxcpt(y, "neg");
        }
@@ -70,14 +70,14 @@ union ieee754dp ieee754dp_abs(union ieee754dp x)
        COMPXDP;
 
        EXPLODEXDP;
-       CLEARCX;
+       ieee754_clearcx();
        FLUSHXDP;
 
        /* Clear sign ALWAYS, irrespective of NaN */
        DPSIGN(x) = 0;
 
        if (xc == IEEE754_CLASS_SNAN) {
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754dp_nanxcpt(ieee754dp_indef(), "abs");
        }
 
index cee9f3c2700d0b4331f76cc2f2cb1b75d4c657ec..1e0fbbf56e971c66809e07e813ae9a77a9eb7f4c 100644 (file)
@@ -42,7 +42,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x)
        COMPXDP;
 
        EXPLODEXDP;
-       CLEARCX;
+       ieee754_clearcx();
        FLUSHXDP;
 
        /* x == INF or NAN? */
@@ -51,7 +51,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x)
                /* sqrt(Nan) = Nan */
                return ieee754dp_nanxcpt(x, "sqrt");
        case IEEE754_CLASS_SNAN:
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt");
        case IEEE754_CLASS_ZERO:
                /* sqrt(0) = 0 */
@@ -59,7 +59,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x)
        case IEEE754_CLASS_INF:
                if (xs) {
                        /* sqrt(-Inf) = Nan */
-                       SETCX(IEEE754_INVALID_OPERATION);
+                       ieee754_setcx(IEEE754_INVALID_OPERATION);
                        return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt");
                }
                /* sqrt(+Inf) = Inf */
@@ -70,7 +70,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x)
        case IEEE754_CLASS_NORM:
                if (xs) {
                        /* sqrt(-x) = Nan */
-                       SETCX(IEEE754_INVALID_OPERATION);
+                       ieee754_setcx(IEEE754_INVALID_OPERATION);
                        return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt");
                }
                break;
index 1e8f19ae6cd5b23bbf33f195b035d3d1bee20822..e369c7b07f5e3811ab52b73848a88f0735b9e9d4 100644 (file)
@@ -34,7 +34,7 @@ union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y)
        EXPLODEXDP;
        EXPLODEYDP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        FLUSHXDP;
        FLUSHYDP;
@@ -51,7 +51,7 @@ union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y)
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754dp_nanxcpt(ieee754dp_indef(), "sub", x, y);
 
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
@@ -74,7 +74,7 @@ union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y)
        case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
                if (xs != ys)
                        return x;
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754dp_xcpt(ieee754dp_indef(), "sub", x, y);
 
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
index e6bc33fd61a9a4dfd2aceebfc694ab549b44796c..792470c53779068d1ff92791a511274ac77c5c87 100644 (file)
@@ -30,7 +30,7 @@ int ieee754dp_tint(union ieee754dp x)
 {
        COMPXDP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        EXPLODEXDP;
        FLUSHXDP;
@@ -39,7 +39,7 @@ int ieee754dp_tint(union ieee754dp x)
        case IEEE754_CLASS_SNAN:
        case IEEE754_CLASS_QNAN:
        case IEEE754_CLASS_INF:
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x);
        case IEEE754_CLASS_ZERO:
                return 0;
@@ -50,7 +50,7 @@ int ieee754dp_tint(union ieee754dp x)
        if (xe > 31) {
                /* Set invalid. We will only use overflow for floating
                   point overflow */
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x);
        }
        /* oh gawd */
@@ -95,11 +95,11 @@ int ieee754dp_tint(union ieee754dp x)
                /* look for valid corner case 0x80000000 */
                if ((xm >> 31) != 0 && (xs == 0 || xm != 0x80000000)) {
                        /* This can happen after rounding */
-                       SETCX(IEEE754_INVALID_OPERATION);
+                       ieee754_setcx(IEEE754_INVALID_OPERATION);
                        return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x);
                }
                if (round || sticky)
-                       SETCX(IEEE754_INEXACT);
+                       ieee754_setcx(IEEE754_INEXACT);
        }
        if (xs)
                return -xm;
index 3366399eebe8f4143dc1b9ff3560bf1c05f6919d..fcc1c4f50e98953ffbcf1205831f8d7ae3575417 100644 (file)
@@ -30,7 +30,7 @@ s64 ieee754dp_tlong(union ieee754dp x)
 {
        COMPXDP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        EXPLODEXDP;
        FLUSHXDP;
@@ -39,7 +39,7 @@ s64 ieee754dp_tlong(union ieee754dp x)
        case IEEE754_CLASS_SNAN:
        case IEEE754_CLASS_QNAN:
        case IEEE754_CLASS_INF:
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x);
        case IEEE754_CLASS_ZERO:
                return 0;
@@ -53,7 +53,7 @@ s64 ieee754dp_tlong(union ieee754dp x)
                        return -0x8000000000000000LL;
                /* Set invalid. We will only use overflow for floating
                   point overflow */
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x);
        }
        /* oh gawd */
@@ -99,11 +99,11 @@ s64 ieee754dp_tlong(union ieee754dp x)
                }
                if ((xm >> 63) != 0) {
                        /* This can happen after rounding */
-                       SETCX(IEEE754_INVALID_OPERATION);
+                       ieee754_setcx(IEEE754_INVALID_OPERATION);
                        return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x);
                }
                if (round || sticky)
-                       SETCX(IEEE754_INEXACT);
+                       ieee754_setcx(IEEE754_INEXACT);
        }
        if (xs)
                return -xm;
index 141f0cb40df492ac4a6a83514a347cc59ec44641..26f785edb60cd418fba7ef90e9dcecc1f7629dd3 100644 (file)
@@ -101,7 +101,7 @@ int __cold ieee754si_xcpt(int r, const char *op, ...)
 {
        struct ieee754xctx ax;
 
-       if (!TSTX())
+       if (!ieee754_tstx())
                return r;
        ax.op = op;
        ax.rt = IEEE754_RT_SI;
@@ -116,7 +116,7 @@ s64 __cold ieee754di_xcpt(s64 r, const char *op, ...)
 {
        struct ieee754xctx ax;
 
-       if (!TSTX())
+       if (!ieee754_tstx())
                return r;
        ax.op = op;
        ax.rt = IEEE754_RT_DI;
index 05705fa785c37b279098a21af0fc7546e315416f..a1970894094b9d4f152b5c35833736ec52e25641 100644 (file)
@@ -170,12 +170,14 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x);
 
 /* 5 types of floating point number
 */
-#define IEEE754_CLASS_NORM     0x00
-#define IEEE754_CLASS_ZERO     0x01
-#define IEEE754_CLASS_DNORM    0x02
-#define IEEE754_CLASS_INF      0x03
-#define IEEE754_CLASS_SNAN     0x04
-#define IEEE754_CLASS_QNAN     0x05
+enum {
+       IEEE754_CLASS_NORM      = 0x00,
+       IEEE754_CLASS_ZERO      = 0x01,
+       IEEE754_CLASS_DNORM     = 0x02,
+       IEEE754_CLASS_INF       = 0x03,
+       IEEE754_CLASS_SNAN      = 0x04,
+       IEEE754_CLASS_QNAN      = 0x05,
+};
 
 /* exception numbers */
 #define IEEE754_INEXACT                        0x01
index 43fb7fefb6cc5b401ff2c56dfb9923d0b7783718..53dbb1cb52a932cd6de3cce141e9ca428c94bc84 100644 (file)
@@ -49,7 +49,7 @@ int ieee754dp_issnan(union ieee754dp x)
 union ieee754dp __cold ieee754dp_xcpt(union ieee754dp r, const char *op, ...)
 {
        struct ieee754xctx ax;
-       if (!TSTX())
+       if (!ieee754_tstx())
                return r;
 
        ax.op = op;
@@ -70,7 +70,7 @@ union ieee754dp __cold ieee754dp_nanxcpt(union ieee754dp r, const char *op, ...)
        if (!ieee754dp_issnan(r))       /* QNAN does not cause invalid op !! */
                return r;
 
-       if (!SETANDTESTCX(IEEE754_INVALID_OPERATION)) {
+       if (!ieee754_setandtestcx(IEEE754_INVALID_OPERATION)) {
                /* not enabled convert to a quiet NaN */
                DPMANT(r) &= (~DP_MBIT(DP_MBITS-1));
                if (ieee754dp_isnan(r))
@@ -143,8 +143,8 @@ union ieee754dp ieee754dp_format(int sn, int xe, u64 xm)
                int es = DP_EMIN - xe;
 
                if (ieee754_csr.nod) {
-                       SETCX(IEEE754_UNDERFLOW);
-                       SETCX(IEEE754_INEXACT);
+                       ieee754_setcx(IEEE754_UNDERFLOW);
+                       ieee754_setcx(IEEE754_INEXACT);
 
                        switch(ieee754_csr.rm) {
                        case IEEE754_RN:
@@ -167,7 +167,7 @@ union ieee754dp ieee754dp_format(int sn, int xe, u64 xm)
                                && get_rounding(sn, xm) >> (DP_MBITS + 1 + 3))
                {
                        /* Not tiny after rounding */
-                       SETCX(IEEE754_INEXACT);
+                       ieee754_setcx(IEEE754_INEXACT);
                        xm = get_rounding(sn, xm);
                        xm >>= 1;
                        /* Clear grs bits */
@@ -184,9 +184,9 @@ union ieee754dp ieee754dp_format(int sn, int xe, u64 xm)
                }
        }
        if (xm & (DP_MBIT(3) - 1)) {
-               SETCX(IEEE754_INEXACT);
+               ieee754_setcx(IEEE754_INEXACT);
                if ((xm & (DP_HIDDEN_BIT << 3)) == 0) {
-                       SETCX(IEEE754_UNDERFLOW);
+                       ieee754_setcx(IEEE754_UNDERFLOW);
                }
 
                /* inexact must round of 3 bits
@@ -207,8 +207,8 @@ union ieee754dp ieee754dp_format(int sn, int xe, u64 xm)
        assert(xe >= DP_EMIN);
 
        if (xe > DP_EMAX) {
-               SETCX(IEEE754_OVERFLOW);
-               SETCX(IEEE754_INEXACT);
+               ieee754_setcx(IEEE754_OVERFLOW);
+               ieee754_setcx(IEEE754_INEXACT);
                /* -O can be table indexed by (rm,sn) */
                switch (ieee754_csr.rm) {
                case IEEE754_RN:
@@ -233,7 +233,7 @@ union ieee754dp ieee754dp_format(int sn, int xe, u64 xm)
                /* we underflow (tiny/zero) */
                assert(xe == DP_EMIN);
                if (ieee754_csr.mx & IEEE754_UNDERFLOW)
-                       SETCX(IEEE754_UNDERFLOW);
+                       ieee754_setcx(IEEE754_UNDERFLOW);
                return builddp(sn, DP_EMIN - 1 + DP_EBIAS, xm);
        } else {
                assert((xm >> (DP_MBITS + 1)) == 0);    /* no execess */
index 3759f3f35293437289d3261ce5645b9d7f9b722f..1dc205880cba3be7f0bd7e029926f8749615cb44 100644 (file)
@@ -74,7 +74,7 @@ extern union ieee754dp ieee754dp_format(int, int, u64);
 #define DPNORMRET2(s, e, m, name, a0, a1)                              \
 {                                                                      \
        union ieee754dp V = ieee754dp_format(s, e, m);                  \
-       if (TSTX())                                                     \
+       if (ieee754_tstx())                                             \
                return ieee754dp_xcpt(V, name, a0, a1);                 \
        else                                                            \
                return V;                                               \
index 62d0fdbdb44ef1f6e2071b5839bf827620224dc6..39c40d27582525915c087f3543d3c32d4d9ff27f 100644 (file)
 
 #define CLPAIR(x, y)   ((x)*6+(y))
 
-#define CLEARCX \
-       (ieee754_csr.cx = 0)
+static inline void ieee754_clearcx(void)
+{
+       ieee754_csr.cx = 0;
+}
 
-#define SETCX(x) \
-       (ieee754_csr.cx |= (x), ieee754_csr.sx |= (x))
+static inline void ieee754_setcx(const unsigned int flags)
+{
+       ieee754_csr.cx |= flags;
+       ieee754_csr.sx |= flags;
+}
 
-#define SETANDTESTCX(x) \
-       (SETCX(x), ieee754_csr.mx & (x))
+static inline int ieee754_setandtestcx(const unsigned int x)
+{
+       ieee754_setcx(x);
 
-#define TSTX() \
-       (ieee754_csr.cx & ieee754_csr.mx)
+       return ieee754_csr.mx & x;
+}
 
+static inline int ieee754_tstx(void)
+{
+       return ieee754_csr.cx & ieee754_csr.mx;
+}
 
 #define COMPXSP \
        unsigned xm; int xe; int xs __maybe_unused; int xc
 #define FLUSHDP(v, vc, vs, ve, vm)                                     \
        if (vc==IEEE754_CLASS_DNORM) {                                  \
                if (ieee754_csr.nod) {                                  \
-                       SETCX(IEEE754_INEXACT);                         \
+                       ieee754_setcx(IEEE754_INEXACT);                 \
                        vc = IEEE754_CLASS_ZERO;                        \
                        ve = DP_EMIN-1+DP_EBIAS;                        \
                        vm = 0;                                         \
 #define FLUSHSP(v, vc, vs, ve, vm)                                     \
        if (vc==IEEE754_CLASS_DNORM) {                                  \
                if (ieee754_csr.nod) {                                  \
-                       SETCX(IEEE754_INEXACT);                         \
+                       ieee754_setcx(IEEE754_INEXACT);                 \
                        vc = IEEE754_CLASS_ZERO;                        \
                        ve = SP_EMIN-1+SP_EBIAS;                        \
                        vm = 0;                                         \
index a15d2123e05e784a783217747852924f2d587bee..955e474b5b5988c843e106589b6256add9df51f1 100644 (file)
@@ -50,7 +50,7 @@ union ieee754sp __cold ieee754sp_xcpt(union ieee754sp r, const char *op, ...)
 {
        struct ieee754xctx ax;
 
-       if (!TSTX())
+       if (!ieee754_tstx())
                return r;
 
        ax.op = op;
@@ -71,7 +71,7 @@ union ieee754sp __cold ieee754sp_nanxcpt(union ieee754sp r, const char *op, ...)
        if (!ieee754sp_issnan(r))       /* QNAN does not cause invalid op !! */
                return r;
 
-       if (!SETANDTESTCX(IEEE754_INVALID_OPERATION)) {
+       if (!ieee754_setandtestcx(IEEE754_INVALID_OPERATION)) {
                /* not enabled convert to a quiet NaN */
                SPMANT(r) &= (~SP_MBIT(SP_MBITS-1));
                if (ieee754sp_isnan(r))
@@ -144,8 +144,8 @@ union ieee754sp ieee754sp_format(int sn, int xe, unsigned xm)
                int es = SP_EMIN - xe;
 
                if (ieee754_csr.nod) {
-                       SETCX(IEEE754_UNDERFLOW);
-                       SETCX(IEEE754_INEXACT);
+                       ieee754_setcx(IEEE754_UNDERFLOW);
+                       ieee754_setcx(IEEE754_INEXACT);
 
                        switch(ieee754_csr.rm) {
                        case IEEE754_RN:
@@ -168,7 +168,7 @@ union ieee754sp ieee754sp_format(int sn, int xe, unsigned xm)
                                && get_rounding(sn, xm) >> (SP_MBITS + 1 + 3))
                {
                        /* Not tiny after rounding */
-                       SETCX(IEEE754_INEXACT);
+                       ieee754_setcx(IEEE754_INEXACT);
                        xm = get_rounding(sn, xm);
                        xm >>= 1;
                        /* Clear grs bits */
@@ -183,9 +183,9 @@ union ieee754sp ieee754sp_format(int sn, int xe, unsigned xm)
                }
        }
        if (xm & (SP_MBIT(3) - 1)) {
-               SETCX(IEEE754_INEXACT);
+               ieee754_setcx(IEEE754_INEXACT);
                if ((xm & (SP_HIDDEN_BIT << 3)) == 0) {
-                       SETCX(IEEE754_UNDERFLOW);
+                       ieee754_setcx(IEEE754_UNDERFLOW);
                }
 
                /* inexact must round of 3 bits
@@ -206,8 +206,8 @@ union ieee754sp ieee754sp_format(int sn, int xe, unsigned xm)
        assert(xe >= SP_EMIN);
 
        if (xe > SP_EMAX) {
-               SETCX(IEEE754_OVERFLOW);
-               SETCX(IEEE754_INEXACT);
+               ieee754_setcx(IEEE754_OVERFLOW);
+               ieee754_setcx(IEEE754_INEXACT);
                /* -O can be table indexed by (rm,sn) */
                switch (ieee754_csr.rm) {
                case IEEE754_RN:
@@ -232,7 +232,7 @@ union ieee754sp ieee754sp_format(int sn, int xe, unsigned xm)
                /* we underflow (tiny/zero) */
                assert(xe == SP_EMIN);
                if (ieee754_csr.mx & IEEE754_UNDERFLOW)
-                       SETCX(IEEE754_UNDERFLOW);
+                       ieee754_setcx(IEEE754_UNDERFLOW);
                return buildsp(sn, SP_EMIN - 1 + SP_EBIAS, xm);
        } else {
                assert((xm >> (SP_MBITS + 1)) == 0);    /* no execess */
index f007c47086cb82a6329236d8d2e06e323fa60ac3..011d034fd86e3ccc2dc646cf6415ff9f48093b4e 100644 (file)
@@ -81,7 +81,7 @@ extern union ieee754sp ieee754sp_format(int, int, unsigned);
 {                                                                      \
        union ieee754sp V = ieee754sp_format(s, e, m);                  \
                                                                        \
-       if (TSTX())                                                     \
+       if (ieee754_tstx())                                             \
                return ieee754sp_xcpt(V, name, a0, a1);                 \
        else                                                            \
                return V;                                               \
index 4938d8f1d4bcffeb41dfdd7c7dae3d2aee25094c..e67f11af4acfc98df38c19b1ac3aa246d8565b1d 100644 (file)
@@ -34,7 +34,7 @@ union ieee754sp ieee754sp_add(union ieee754sp x, union ieee754sp y)
        EXPLODEXSP;
        EXPLODEYSP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        FLUSHXSP;
        FLUSHYSP;
@@ -51,7 +51,7 @@ union ieee754sp ieee754sp_add(union ieee754sp x, union ieee754sp y)
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754sp_nanxcpt(ieee754sp_indef(), "add", x, y);
 
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
@@ -74,7 +74,7 @@ union ieee754sp ieee754sp_add(union ieee754sp x, union ieee754sp y)
        case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
                if (xs == ys)
                        return x;
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754sp_xcpt(ieee754sp_indef(), "add", x, y);
 
        case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
index b98d68617cfe2fa7638eb48d0ab762457682dc3c..adf30766ecab4130116ae8b1245a00534a5c39e6 100644 (file)
@@ -35,15 +35,15 @@ int ieee754sp_cmp(union ieee754sp x, union ieee754sp y, int cmp, int sig)
        EXPLODEYSP;
        FLUSHXSP;
        FLUSHYSP;
-       CLEARCX;        /* Even clear inexact flag here */
+       ieee754_clearcx();      /* Even clear inexact flag here */
 
        if (ieee754sp_isnan(x) || ieee754sp_isnan(y)) {
                if (sig || xc == IEEE754_CLASS_SNAN || yc == IEEE754_CLASS_SNAN)
-                       SETCX(IEEE754_INVALID_OPERATION);
+                       ieee754_setcx(IEEE754_INVALID_OPERATION);
                if (cmp & IEEE754_CUN)
                        return 1;
                if (cmp & (IEEE754_CLT | IEEE754_CGT)) {
-                       if (sig && SETANDTESTCX(IEEE754_INVALID_OPERATION))
+                       if (sig && ieee754_setandtestcx(IEEE754_INVALID_OPERATION))
                                return ieee754si_xcpt(0, "fcmpf", x);
                }
                return 0;
index 1f62865ffcbdced89cf14bb69a335d97b83820f1..4caac973e2a622d75e17225eeb0f240fb4b3e3ac 100644 (file)
@@ -34,7 +34,7 @@ union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y)
        EXPLODEXSP;
        EXPLODEYSP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        FLUSHXSP;
        FLUSHYSP;
@@ -51,7 +51,7 @@ union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y)
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754sp_nanxcpt(ieee754sp_indef(), "div", x, y);
 
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
@@ -72,7 +72,7 @@ union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y)
                 */
 
        case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754sp_xcpt(ieee754sp_indef(), "div", x, y);
 
        case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
@@ -89,12 +89,12 @@ union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y)
                 */
 
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO):
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754sp_xcpt(ieee754sp_indef(), "div", x, y);
 
        case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO):
        case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
-               SETCX(IEEE754_ZERO_DIVIDE);
+               ieee754_setcx(IEEE754_ZERO_DIVIDE);
                return ieee754sp_xcpt(ieee754sp_inf(xs ^ ys), "div", x, y);
 
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM):
index cbefb88a14efabafd526575b3168fe34cc362cfd..569878d7cb98c036d8cfd53706c64403989512ec 100644 (file)
@@ -33,13 +33,13 @@ union ieee754sp ieee754sp_fdp(union ieee754dp x)
 
        EXPLODEXDP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        FLUSHXDP;
 
        switch (xc) {
        case IEEE754_CLASS_SNAN:
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754sp_nanxcpt(ieee754sp_indef(), "fdp");
        case IEEE754_CLASS_QNAN:
                nan = buildsp(xs, SP_EMAX + 1 + SP_EBIAS, (u32)
@@ -53,8 +53,8 @@ union ieee754sp ieee754sp_fdp(union ieee754dp x)
                return ieee754sp_zero(xs);
        case IEEE754_CLASS_DNORM:
                /* can't possibly be sp representable */
-               SETCX(IEEE754_UNDERFLOW);
-               SETCX(IEEE754_INEXACT);
+               ieee754_setcx(IEEE754_UNDERFLOW);
+               ieee754_setcx(IEEE754_INEXACT);
                if ((ieee754_csr.rm == IEEE754_RU && !xs) ||
                                (ieee754_csr.rm == IEEE754_RD && xs))
                        return ieee754sp_xcpt(ieee754sp_mind(xs), "fdp", x);
index 7ba2b40348c46d299a7577574163aff0217af982..74619e73796c8f135463141fa76521a109aebabb 100644 (file)
@@ -32,7 +32,7 @@ union ieee754sp ieee754sp_fint(int x)
        int xe;
        int xs;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        if (x == 0)
                return ieee754sp_zero(0);
index c457a9f8a148d27e45a15f940c0344933e6576a9..ea065ae147669cfac5115f4936ec9cd6a10791e1 100644 (file)
@@ -32,7 +32,7 @@ union ieee754sp ieee754sp_flong(s64 x)
        int xe;
        int xs;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        if (x == 0)
                return ieee754sp_zero(0);
index 668252bca5131f4e0cc6bd5e0f778937133d5c39..72cedb08850626246baa985ed4164837a33d6d9c 100644 (file)
@@ -31,7 +31,7 @@
 union ieee754sp ieee754sp_frexp(union ieee754sp x, int *eptr)
 {
        COMPXSP;
-       CLEARCX;
+       ieee754_clearcx();
        EXPLODEXSP;
 
        switch (xc) {
index 4dfe5386e89d513aad198160224cee808a42717f..82c122c9a447fa59bb23e1b4d637c8732d6ce525 100644 (file)
@@ -30,7 +30,7 @@ union ieee754sp ieee754sp_logb(union ieee754sp x)
 {
        COMPXSP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        EXPLODEXSP;
 
index 30d53ec1f7eb4d1fbf0487ba2a5eecfbc79165f9..22f19a22ab0229fc5226d1ffe5a96e5716d928f3 100644 (file)
@@ -32,7 +32,7 @@ union ieee754sp ieee754sp_modf(union ieee754sp x, union ieee754sp *ip)
 {
        COMPXSP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        EXPLODEXSP;
 
index c628f3c495dcacedf474562f1111a4b6c0b1d55d..844b3bde0ab665e71a772bc150bd34cdfa4762f5 100644 (file)
@@ -34,7 +34,7 @@ union ieee754sp ieee754sp_mul(union ieee754sp x, union ieee754sp y)
        EXPLODEXSP;
        EXPLODEYSP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        FLUSHXSP;
        FLUSHYSP;
@@ -51,7 +51,7 @@ union ieee754sp ieee754sp_mul(union ieee754sp x, union ieee754sp y)
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754sp_nanxcpt(ieee754sp_indef(), "mul", x, y);
 
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
@@ -72,7 +72,7 @@ union ieee754sp ieee754sp_mul(union ieee754sp x, union ieee754sp y)
 
        case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754sp_xcpt(ieee754sp_indef(), "mul", x, y);
 
        case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
index 9831d428af6fafa26336226cf52de63839e510fb..cc8f1b82d2a9b07b2134ac5a247f3f1368b385a2 100644 (file)
@@ -30,7 +30,7 @@ union ieee754sp ieee754sp_scalb(union ieee754sp x, int n)
 {
        COMPXSP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        EXPLODEXSP;
 
index 633c7a54cf1e52faa48267183741a4773fcb7a7c..4da597b6a1f76ec89bc504049badb872f3b24f59 100644 (file)
@@ -33,7 +33,7 @@ int ieee754sp_finite(union ieee754sp x)
 
 union ieee754sp ieee754sp_copysign(union ieee754sp x, union ieee754sp y)
 {
-       CLEARCX;
+       ieee754_clearcx();
        SPSIGN(x) = SPSIGN(y);
        return x;
 }
@@ -44,7 +44,7 @@ union ieee754sp ieee754sp_neg(union ieee754sp x)
        COMPXSP;
 
        EXPLODEXSP;
-       CLEARCX;
+       ieee754_clearcx();
        FLUSHXSP;
 
        /*
@@ -56,7 +56,7 @@ union ieee754sp ieee754sp_neg(union ieee754sp x)
 
        if (xc == IEEE754_CLASS_SNAN) {
                union ieee754sp y = ieee754sp_indef();
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                SPSIGN(y) = SPSIGN(x);
                return ieee754sp_nanxcpt(y, "neg");
        }
@@ -70,14 +70,14 @@ union ieee754sp ieee754sp_abs(union ieee754sp x)
        COMPXSP;
 
        EXPLODEXSP;
-       CLEARCX;
+       ieee754_clearcx();
        FLUSHXSP;
 
        /* Clear sign ALWAYS, irrespective of NaN */
        SPSIGN(x) = 0;
 
        if (xc == IEEE754_CLASS_SNAN) {
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754sp_nanxcpt(ieee754sp_indef(), "abs");
        }
 
index 4c60d91961f4f31933bc7e1ba40e9c56f462e343..7e87f469b979fe2c62ce149bf2f38b72fbd2ce39 100644 (file)
@@ -35,7 +35,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x)
        /* take care of Inf and NaN */
 
        EXPLODEXSP;
-       CLEARCX;
+       ieee754_clearcx();
        FLUSHXSP;
 
        /* x == INF or NAN? */
@@ -44,7 +44,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x)
                /* sqrt(Nan) = Nan */
                return ieee754sp_nanxcpt(x, "sqrt");
        case IEEE754_CLASS_SNAN:
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt");
        case IEEE754_CLASS_ZERO:
                /* sqrt(0) = 0 */
@@ -52,7 +52,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x)
        case IEEE754_CLASS_INF:
                if (xs) {
                        /* sqrt(-Inf) = Nan */
-                       SETCX(IEEE754_INVALID_OPERATION);
+                       ieee754_setcx(IEEE754_INVALID_OPERATION);
                        return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt");
                }
                /* sqrt(+Inf) = Inf */
@@ -61,7 +61,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x)
        case IEEE754_CLASS_NORM:
                if (xs) {
                        /* sqrt(-x) = Nan */
-                       SETCX(IEEE754_INVALID_OPERATION);
+                       ieee754_setcx(IEEE754_INVALID_OPERATION);
                        return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt");
                }
                break;
@@ -99,7 +99,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x)
        }
 
        if (ix != 0) {
-               SETCX(IEEE754_INEXACT);
+               ieee754_setcx(IEEE754_INEXACT);
                switch (ieee754_csr.rm) {
                case IEEE754_RP:
                        q += 2;
index ed67acfb114fe2d6438056698c920c6fe4ab8d88..7e45ba3c2a385bbc1663d00681033774a7b453dd 100644 (file)
@@ -34,7 +34,7 @@ union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y)
        EXPLODEXSP;
        EXPLODEYSP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        FLUSHXSP;
        FLUSHYSP;
@@ -51,7 +51,7 @@ union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y)
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
        case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754sp_nanxcpt(ieee754sp_indef(), "sub", x, y);
 
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
@@ -74,7 +74,7 @@ union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y)
        case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
                if (xs != ys)
                        return x;
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754sp_xcpt(ieee754sp_indef(), "sub", x, y);
 
        case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
index a69dfe5dda3a7680d88e1e0c1cc4974cfa9ca924..febcf5cc4fbc8de6e83d4cee211d3005b00e3761 100644 (file)
@@ -30,7 +30,7 @@ int ieee754sp_tint(union ieee754sp x)
 {
        COMPXSP;
 
-       CLEARCX;
+       ieee754_clearcx();
 
        EXPLODEXSP;
        FLUSHXSP;
@@ -39,7 +39,7 @@ int ieee754sp_tint(union ieee754sp x)
        case IEEE754_CLASS_SNAN:
        case IEEE754_CLASS_QNAN:
        case IEEE754_CLASS_INF:
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x);
        case IEEE754_CLASS_ZERO:
                return 0;
@@ -53,7 +53,7 @@ int ieee754sp_tint(union ieee754sp x)
                        return -0x80000000;
                /* Set invalid. We will only use overflow for floating
                   point overflow */
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x);
        }
        /* oh gawd */
@@ -99,11 +99,11 @@ int ieee754sp_tint(union ieee754sp x)
                }
                if ((xm >> 31) != 0) {
                        /* This can happen after rounding */
-                       SETCX(IEEE754_INVALID_OPERATION);
+                       ieee754_setcx(IEEE754_INVALID_OPERATION);
                        return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x);
                }
                if (round || sticky)
-                       SETCX(IEEE754_INEXACT);
+                       ieee754_setcx(IEEE754_INEXACT);
        }
        if (xs)
                return -xm;
index da412d38d5ef28c10e32dd2336cdad8aa5fb332a..a05d09318fb152b7522de24aae98c975f9936cb8 100644 (file)
@@ -30,7 +30,7 @@ s64 ieee754sp_tlong(union ieee754sp x)
 {
        COMPXDP;                /* <-- need 64-bit mantissa tmp */
 
-       CLEARCX;
+       ieee754_clearcx();
 
        EXPLODEXSP;
        FLUSHXSP;
@@ -39,7 +39,7 @@ s64 ieee754sp_tlong(union ieee754sp x)
        case IEEE754_CLASS_SNAN:
        case IEEE754_CLASS_QNAN:
        case IEEE754_CLASS_INF:
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x);
        case IEEE754_CLASS_ZERO:
                return 0;
@@ -53,7 +53,7 @@ s64 ieee754sp_tlong(union ieee754sp x)
                        return -0x8000000000000000LL;
                /* Set invalid. We will only use overflow for floating
                   point overflow */
-               SETCX(IEEE754_INVALID_OPERATION);
+               ieee754_setcx(IEEE754_INVALID_OPERATION);
                return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x);
        }
        /* oh gawd */
@@ -95,11 +95,11 @@ s64 ieee754sp_tlong(union ieee754sp x)
                }
                if ((xm >> 63) != 0) {
                        /* This can happen after rounding */
-                       SETCX(IEEE754_INVALID_OPERATION);
+                       ieee754_setcx(IEEE754_INVALID_OPERATION);
                        return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x);
                }
                if (round || sticky)
-                       SETCX(IEEE754_INEXACT);
+                       ieee754_setcx(IEEE754_INEXACT);
        }
        if (xs)
                return -xm;