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.
+
+2014-11-17 Richard Henderson <rth@redhat.com>
+
+ * 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.
+
2014-11-14 Roland McGrath <roland@hack.frob.com>
* signal/signal.h [__USE_MISC]
/* 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)
{
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);
}
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)))
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;
{
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);
}
{
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);
}
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
#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);
}
_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;
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
{
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);
}
{
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);
}
_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;
{
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);
}