diff options
author | Richard Henderson <rth@twiddle.net> | 2014-11-17 09:20:02 -0800 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2014-11-17 09:20:02 -0800 |
commit | 4886f3417970e84d491d134d9c5983582ed7ed18 (patch) | |
tree | a82f32dbc63a2df215a982a972aab7a00ffc54f7 /sysdeps/alpha | |
parent | 0781a7772ae1385fe8d7a734fdb35df81b1e6590 (diff) | |
download | glibc-4886f3417970e84d491d134d9c5983582ed7ed18.zip glibc-4886f3417970e84d491d134d9c5983582ed7ed18.tar.gz glibc-4886f3417970e84d491d134d9c5983582ed7ed18.tar.bz2 |
alpha: Fix soft-fp breakage
Commit 5c0508a318af0a6c8be2a4cb2e3b76896218bf35 broke the Alpha
port, as the extra parenthesis got in the way of some token pasting
that we were doing in a redefined raw unpack macro.
Avoid this situation in the future by not attempting to redefine a
basic macro, but rather work from the outermost public interface.
The compiler does in fact see through the added indirection.
* sysdeps/alpha/soft-fp/local-soft-fp.h (_FP_UNPACK_RAW_2): Remove.
(_FP_PACK_RAW_2): Remove.
(AXP_DECL_RETURN_Q): Rename from FP_DECL_RETURN, use _FP_UNION_Q.
(AXP_RETURN_Q): Rename from FP_RETURN, use _FP_UNION_Q.
(AXP_UNPACK_RAW_Q, AXP_UNPACK_SEMIRAW_Q, AXP_UNPACK_Q): New.
(AXP_PACK_RAW_Q, AXP_PACK_SEMIRAW_Q, AXP_PACK_Q): New.
* sysdeps/alpha/soft-fp/ots_add.c (_OtsAddX): Update to match.
* sysdeps/alpha/soft-fp/ots_cmp.c (internal_equality): Likewise.
* sysdeps/alpha/soft-fp/ots_cmpe.c (internal_compare): Likewise.
* sysdeps/alpha/soft-fp/ots_cvtqux.c (_OtsCvtQUX): Likewise.
* sysdeps/alpha/soft-fp/ots_cvtqx.c (_OtsCvtQX): Likewise.
* sysdeps/alpha/soft-fp/ots_cvttx.c (_OtsConvertFloatTX): Likewise.
* sysdeps/alpha/soft-fp/ots_cvtxq.c (_OtsCvtXQ): Likewise.
* sysdeps/alpha/soft-fp/ots_cvtxt.c (_OtsConvertFloatXT): Likewise.
* sysdeps/alpha/soft-fp/ots_div.c (_OtsDivX): Likewise.
* sysdeps/alpha/soft-fp/ots_mul.c (_OtsMulX): Likewise.
* sysdeps/alpha/soft-fp/ots_nintxq.c (_OtsNintXQ): Likewise.
* sysdeps/alpha/soft-fp/ots_sub.c (_OtsSubX): Likewise.
Diffstat (limited to 'sysdeps/alpha')
-rw-r--r-- | sysdeps/alpha/soft-fp/local-soft-fp.h | 63 | ||||
-rw-r--r-- | sysdeps/alpha/soft-fp/ots_add.c | 10 | ||||
-rw-r--r-- | sysdeps/alpha/soft-fp/ots_cmp.c | 4 | ||||
-rw-r--r-- | sysdeps/alpha/soft-fp/ots_cmpe.c | 4 | ||||
-rw-r--r-- | sysdeps/alpha/soft-fp/ots_cvtqux.c | 6 | ||||
-rw-r--r-- | sysdeps/alpha/soft-fp/ots_cvtqx.c | 6 | ||||
-rw-r--r-- | sysdeps/alpha/soft-fp/ots_cvttx.c | 6 | ||||
-rw-r--r-- | sysdeps/alpha/soft-fp/ots_cvtxq.c | 2 | ||||
-rw-r--r-- | sysdeps/alpha/soft-fp/ots_cvtxt.c | 2 | ||||
-rw-r--r-- | sysdeps/alpha/soft-fp/ots_div.c | 10 | ||||
-rw-r--r-- | sysdeps/alpha/soft-fp/ots_mul.c | 10 | ||||
-rw-r--r-- | sysdeps/alpha/soft-fp/ots_nintxq.c | 2 | ||||
-rw-r--r-- | sysdeps/alpha/soft-fp/ots_sub.c | 10 |
13 files changed, 73 insertions, 62 deletions
diff --git a/sysdeps/alpha/soft-fp/local-soft-fp.h b/sysdeps/alpha/soft-fp/local-soft-fp.h index e93a2ad..d562e08 100644 --- a/sysdeps/alpha/soft-fp/local-soft-fp.h +++ b/sysdeps/alpha/soft-fp/local-soft-fp.h @@ -5,40 +5,51 @@ /* Helpers for the Ots functions which receive long double arguments in two integer registers, and return values in $16+$17. */ -#undef _FP_UNPACK_RAW_2 -#define _FP_UNPACK_RAW_2(fs, X, val) \ - do { \ - union _FP_UNION_##fs _flo; \ +#define AXP_UNPACK_RAW_Q(X, val) \ + do { \ + union _FP_UNION_Q _flo; \ _flo.longs.a = val##l; \ _flo.longs.b = val##h; \ - X##_f0 = _flo.bits.frac0; \ - X##_f1 = _flo.bits.frac1; \ - X##_e = _flo.bits.exp; \ - X##_s = _flo.bits.sign; \ + FP_UNPACK_RAW_QP(X, &_flo); \ } while (0) -#undef _FP_PACK_RAW_2 -#define _FP_PACK_RAW_2(fs, val, X) \ - do { \ - union _FP_UNION_##fs _flo; \ - _flo.bits.frac0 = X##_f0; \ - _flo.bits.frac1 = X##_f1; \ - _flo.bits.exp = X##_e; \ - _flo.bits.sign = X##_s; \ - val##l = _flo.longs.a; \ - val##h = _flo.longs.b; \ +#define AXP_UNPACK_SEMIRAW_Q(X, val) \ + do { \ + union _FP_UNION_Q _flo; \ + _flo.longs.a = val##l; \ + _flo.longs.b = val##h; \ + FP_UNPACK_SEMIRAW_QP(X, &_flo); \ + } while (0) + +#define AXP_UNPACK_Q(X, val) \ + do { \ + AXP_UNPACK_RAW_Q(X, val); \ + _FP_UNPACK_CANONICAL(Q, 2, X); \ + } while (0) + +#define AXP_PACK_RAW_Q(val, X) FP_PACK_RAW_QP(&val##_flo, X) + +#define AXP_PACK_SEMIRAW_Q(val, X) \ + do { \ + _FP_PACK_SEMIRAW(Q, 2, X); \ + AXP_PACK_RAW_Q(val, X); \ } while (0) -#define FP_DECL_RETURN(X) \ - long X##l, X##h +#define AXP_PACK_Q(val, X) \ + do { \ + _FP_PACK_CANONICAL(Q, 2, X); \ + AXP_PACK_RAW_Q(val, X); \ + } while (0) + +#define AXP_DECL_RETURN_Q(X) union _FP_UNION_Q X##_flo /* ??? We don't have a real way to tell the compiler that we're wanting to return values in $16+$17. Instead use a volatile asm to make sure that the values are live, and just hope that nothing kills the values in between here and the end of the function. */ -#define FP_RETURN(X) \ -do { \ - register long r16 __asm__("16") = X##l; \ - register long r17 __asm__("17") = X##h; \ - asm volatile ("" : : "r"(r16), "r"(r17)); \ -} while (0) +#define AXP_RETURN_Q(X) \ + do { \ + register long r16 __asm__("16") = X##_flo.longs.a; \ + register long r17 __asm__("17") = X##_flo.longs.b; \ + asm volatile ("" : : "r"(r16), "r"(r17)); \ + } while (0) diff --git a/sysdeps/alpha/soft-fp/ots_add.c b/sysdeps/alpha/soft-fp/ots_add.c index 9cd5655..fc85747 100644 --- a/sysdeps/alpha/soft-fp/ots_add.c +++ b/sysdeps/alpha/soft-fp/ots_add.c @@ -25,14 +25,14 @@ _OtsAddX(long al, long ah, long bl, long bh, long _round) { FP_DECL_EX; FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); - FP_DECL_RETURN(c); + AXP_DECL_RETURN_Q(c); FP_INIT_ROUNDMODE; - FP_UNPACK_SEMIRAW_Q(A, a); - FP_UNPACK_SEMIRAW_Q(B, b); + AXP_UNPACK_SEMIRAW_Q(A, a); + AXP_UNPACK_SEMIRAW_Q(B, b); FP_ADD_Q(C, A, B); - FP_PACK_SEMIRAW_Q(c, C); + AXP_PACK_SEMIRAW_Q(c, C); FP_HANDLE_EXCEPTIONS; - FP_RETURN(c); + AXP_RETURN_Q(c); } diff --git a/sysdeps/alpha/soft-fp/ots_cmp.c b/sysdeps/alpha/soft-fp/ots_cmp.c index c28aa4f..a441a92 100644 --- a/sysdeps/alpha/soft-fp/ots_cmp.c +++ b/sysdeps/alpha/soft-fp/ots_cmp.c @@ -27,8 +27,8 @@ internal_equality (long al, long ah, long bl, long bh, long neq) FP_DECL_Q(A); FP_DECL_Q(B); long r; - FP_UNPACK_RAW_Q(A, a); - FP_UNPACK_RAW_Q(B, b); + AXP_UNPACK_RAW_Q(A, a); + AXP_UNPACK_RAW_Q(B, b); if ((A_e == _FP_EXPMAX_Q && !_FP_FRAC_ZEROP_2(A)) || (B_e == _FP_EXPMAX_Q && !_FP_FRAC_ZEROP_2(B))) diff --git a/sysdeps/alpha/soft-fp/ots_cmpe.c b/sysdeps/alpha/soft-fp/ots_cmpe.c index 41586ee..97f9e7e 100644 --- a/sysdeps/alpha/soft-fp/ots_cmpe.c +++ b/sysdeps/alpha/soft-fp/ots_cmpe.c @@ -27,8 +27,8 @@ internal_compare (long al, long ah, long bl, long bh) FP_DECL_Q(A); FP_DECL_Q(B); long r; - FP_UNPACK_RAW_Q(A, a); - FP_UNPACK_RAW_Q(B, b); + AXP_UNPACK_RAW_Q(A, a); + AXP_UNPACK_RAW_Q(B, b); FP_CMP_Q (r, A, B, 2, 2); FP_HANDLE_EXCEPTIONS; diff --git a/sysdeps/alpha/soft-fp/ots_cvtqux.c b/sysdeps/alpha/soft-fp/ots_cvtqux.c index 5562098..677b0b1 100644 --- a/sysdeps/alpha/soft-fp/ots_cvtqux.c +++ b/sysdeps/alpha/soft-fp/ots_cvtqux.c @@ -30,10 +30,10 @@ _OtsCvtQUX (unsigned long a) { FP_DECL_EX; FP_DECL_Q(C); - FP_DECL_RETURN(c); + AXP_DECL_RETURN_Q(c); FP_FROM_INT_Q(C, a, 64, unsigned long); - FP_PACK_RAW_Q(c, C); + AXP_PACK_RAW_Q(c, C); - FP_RETURN(c); + AXP_RETURN_Q(c); } diff --git a/sysdeps/alpha/soft-fp/ots_cvtqx.c b/sysdeps/alpha/soft-fp/ots_cvtqx.c index f062a08..ab81149 100644 --- a/sysdeps/alpha/soft-fp/ots_cvtqx.c +++ b/sysdeps/alpha/soft-fp/ots_cvtqx.c @@ -30,9 +30,9 @@ _OtsCvtQX (long a) { FP_DECL_EX; FP_DECL_Q(C); - FP_DECL_RETURN(c); + AXP_DECL_RETURN_Q(c); FP_FROM_INT_Q(C, a, 64, unsigned long); - FP_PACK_RAW_Q(c, C); - FP_RETURN(c); + AXP_PACK_RAW_Q(c, C); + AXP_RETURN_Q(c); } diff --git a/sysdeps/alpha/soft-fp/ots_cvttx.c b/sysdeps/alpha/soft-fp/ots_cvttx.c index a01cd95..2376e8a 100644 --- a/sysdeps/alpha/soft-fp/ots_cvttx.c +++ b/sysdeps/alpha/soft-fp/ots_cvttx.c @@ -32,7 +32,7 @@ _OtsConvertFloatTX(double a) FP_DECL_EX; FP_DECL_D(A); FP_DECL_Q(C); - FP_DECL_RETURN(c); + AXP_DECL_RETURN_Q(c); FP_UNPACK_RAW_D(A, a); #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q @@ -40,8 +40,8 @@ _OtsConvertFloatTX(double a) #else FP_EXTEND(Q,D,2,1,C,A); #endif - FP_PACK_RAW_Q(c, C); + AXP_PACK_RAW_Q(c, C); FP_HANDLE_EXCEPTIONS; - FP_RETURN(c); + AXP_RETURN_Q(c); } diff --git a/sysdeps/alpha/soft-fp/ots_cvtxq.c b/sysdeps/alpha/soft-fp/ots_cvtxq.c index 2447a38..9eb2a0d 100644 --- a/sysdeps/alpha/soft-fp/ots_cvtxq.c +++ b/sysdeps/alpha/soft-fp/ots_cvtxq.c @@ -33,7 +33,7 @@ _OtsCvtXQ (long al, long ah, long _round) _round = _round & 3; FP_INIT_ROUNDMODE; - FP_UNPACK_RAW_Q(A, a); + AXP_UNPACK_RAW_Q(A, a); FP_TO_INT_Q(r, A, 64, s); FP_HANDLE_EXCEPTIONS; diff --git a/sysdeps/alpha/soft-fp/ots_cvtxt.c b/sysdeps/alpha/soft-fp/ots_cvtxt.c index 94e3f31..bfc8b7b 100644 --- a/sysdeps/alpha/soft-fp/ots_cvtxt.c +++ b/sysdeps/alpha/soft-fp/ots_cvtxt.c @@ -30,7 +30,7 @@ _OtsConvertFloatXT (long al, long ah, long _round) double r; FP_INIT_ROUNDMODE; - FP_UNPACK_SEMIRAW_Q(A, a); + AXP_UNPACK_SEMIRAW_Q(A, a); #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q FP_TRUNC(D,Q,2,4,R,A); #else diff --git a/sysdeps/alpha/soft-fp/ots_div.c b/sysdeps/alpha/soft-fp/ots_div.c index 4d1c8543..c57cec9 100644 --- a/sysdeps/alpha/soft-fp/ots_div.c +++ b/sysdeps/alpha/soft-fp/ots_div.c @@ -25,14 +25,14 @@ _OtsDivX(long al, long ah, long bl, long bh, long _round) { FP_DECL_EX; FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); - FP_DECL_RETURN(c); + AXP_DECL_RETURN_Q(c); FP_INIT_ROUNDMODE; - FP_UNPACK_Q(A, a); - FP_UNPACK_Q(B, b); + AXP_UNPACK_Q(A, a); + AXP_UNPACK_Q(B, b); FP_DIV_Q(C, A, B); - FP_PACK_Q(c, C); + AXP_PACK_Q(c, C); FP_HANDLE_EXCEPTIONS; - FP_RETURN(c); + AXP_RETURN_Q(c); } diff --git a/sysdeps/alpha/soft-fp/ots_mul.c b/sysdeps/alpha/soft-fp/ots_mul.c index 39fe823..5ae1e68 100644 --- a/sysdeps/alpha/soft-fp/ots_mul.c +++ b/sysdeps/alpha/soft-fp/ots_mul.c @@ -25,14 +25,14 @@ _OtsMulX(long al, long ah, long bl, long bh, long _round) { FP_DECL_EX; FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); - FP_DECL_RETURN(c); + AXP_DECL_RETURN_Q(c); FP_INIT_ROUNDMODE; - FP_UNPACK_Q(A, a); - FP_UNPACK_Q(B, b); + AXP_UNPACK_Q(A, a); + AXP_UNPACK_Q(B, b); FP_MUL_Q(C, A, B); - FP_PACK_Q(c, C); + AXP_PACK_Q(c, C); FP_HANDLE_EXCEPTIONS; - FP_RETURN(c); + AXP_RETURN_Q(c); } diff --git a/sysdeps/alpha/soft-fp/ots_nintxq.c b/sysdeps/alpha/soft-fp/ots_nintxq.c index cfdf386..6bfedca 100644 --- a/sysdeps/alpha/soft-fp/ots_nintxq.c +++ b/sysdeps/alpha/soft-fp/ots_nintxq.c @@ -33,7 +33,7 @@ _OtsNintXQ (long al, long ah, long _round) _round = _round & 3; FP_INIT_ROUNDMODE; - FP_UNPACK_SEMIRAW_Q(A, a); + AXP_UNPACK_SEMIRAW_Q(A, a); /* Build 0.5 * sign(A) */ B_e = _FP_EXPBIAS_Q; diff --git a/sysdeps/alpha/soft-fp/ots_sub.c b/sysdeps/alpha/soft-fp/ots_sub.c index 6deb9d9..41938cf 100644 --- a/sysdeps/alpha/soft-fp/ots_sub.c +++ b/sysdeps/alpha/soft-fp/ots_sub.c @@ -25,14 +25,14 @@ _OtsSubX(long al, long ah, long bl, long bh, long _round) { FP_DECL_EX; FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); - FP_DECL_RETURN(c); + AXP_DECL_RETURN_Q(c); FP_INIT_ROUNDMODE; - FP_UNPACK_SEMIRAW_Q(A, a); - FP_UNPACK_SEMIRAW_Q(B, b); + AXP_UNPACK_SEMIRAW_Q(A, a); + AXP_UNPACK_SEMIRAW_Q(B, b); FP_SUB_Q(C, A, B); - FP_PACK_SEMIRAW_Q(c, C); + AXP_PACK_SEMIRAW_Q(c, C); FP_HANDLE_EXCEPTIONS; - FP_RETURN(c); + AXP_RETURN_Q(c); } |