glibc/sysdeps/alpha/soft-fp/local-soft-fp.h
Richard Henderson 4886f34179 alpha: Fix soft-fp breakage
Commit 5c0508a318 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 09:20:02 -08:00

56 lines
1.6 KiB
C

#include <stdlib.h>
#include <soft-fp.h>
#include <quad.h>
/* Helpers for the Ots functions which receive long double arguments
in two integer registers, and return values in $16+$17. */
#define AXP_UNPACK_RAW_Q(X, val) \
do { \
union _FP_UNION_Q _flo; \
_flo.longs.a = val##l; \
_flo.longs.b = val##h; \
FP_UNPACK_RAW_QP(X, &_flo); \
} while (0)
#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 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 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)