From 5c0508a318af0a6c8be2a4cb2e3b76896218bf35 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 9 Oct 2014 17:05:26 +0000 Subject: soft-fp: Use parentheses around macro arguments. This patch cleans up the soft-fp code to use parentheses around macro arguments (where possible; many macro arguments are identifiers used with ## rather than arbitrary expressions, so cannot be put in parentheses). (I'm not aware of any bugs caused by the lack of parentheses, but this is generally good practice. The patch is not exhaustive regarding internal macros where the arguments always come directly from the mantissa of a floating-point number, although probably those should be cleaned up in this regard as well.) Tested for powerpc-nofpu that the installed shared libraries are unchanged by this patch. * soft-fp/double.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_D): Use parentheses around macro arguments. [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_DP): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_D): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_DP): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_D): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_DP): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_D): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_DP): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_D): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_DP): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_D): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_DP): Likewise. [_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_D): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_CMP_D): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_D): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_D): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_TO_INT_D): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_D): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_D): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_DP): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_D): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_DP): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_D): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_DP): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_D): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_DP): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_D): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_DP): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_D): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_DP): Likewise. [_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_D): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_CMP_D): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_D): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_D): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_D): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_D): Likewise. * soft-fp/extended.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_E): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_EP): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_E): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_EP): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_E): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_EP): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_E): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_EP): Likewise. [_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_E): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_CMP_E): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_E): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_E): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_TO_INT_E): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_E): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_E): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_EP): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_E): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_EP): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_E): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_EP): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_E): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_EP): Likewise. [_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_E): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_CMP_E): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_E): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_E): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_E): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_E): Likewise. * soft-fp/op-1.h (_FP_FRAC_SRST_1): Likewise. (_FP_FRAC_SRS_1): Likewise. (_FP_FRAC_CLZ_1): Likewise. (_FP_MUL_MEAT_1_imm): Likewise. (_FP_MUL_MEAT_1_wide): Likewise. (_FP_MUL_MEAT_1_hard): Likewise. (_FP_SQRT_MEAT_1): Likewise. (_FP_FRAC_ASSEMBLE_1): Likewise. (_FP_FRAC_DISASSEMBLE_1): Likewise. * soft-fp/op-2.h (_FP_FRAC_CLZ_2): Likewise. (__FP_CLZ_2): Likewise. (_FP_MUL_MEAT_2_wide): Likewise. (_FP_MUL_MEAT_2_wide_3mul): Likewise. (_FP_MUL_MEAT_2_gmp): Likewise. (_FP_MUL_MEAT_2_120_240_double): Likewise. (_FP_SQRT_MEAT_2): Likewise. (_FP_FRAC_ASSEMBLE_2): Likewise. (_FP_FRAC_DISASSEMBLE_2): Likewise. * soft-fp/op-4.h (_FP_FRAC_SRS_4): Likewise. (_FP_FRAC_CLZ_4): Likewise. (_FP_MUL_MEAT_4_wide): Likewise. (_FP_MUL_MEAT_4_gmp): Likewise. (_FP_SQRT_MEAT_4): Likewise. (_FP_FRAC_ASSEMBLE_4): Likewise. (_FP_FRAC_DISASSEMBLE_4): Likewise. * soft-fp/op-common.h (_FP_CMP): Likewise. (_FP_CMP_EQ): Likewise. (_FP_CMP_UNORD): Likewise. (_FP_TO_INT): Likewise. (_FP_FROM_INT): Likewise. [!__FP_CLZ] (__FP_CLZ): Likewise. (_FP_DIV_HELP_imm): Likewise. * soft-fp/quad.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_Q): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_QP): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_Q): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_QP): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_Q): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_QP): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_Q): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_QP): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_Q): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_QP): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_Q): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_QP): Likewise. [_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_Q): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_CMP_Q): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_Q): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_Q): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_TO_INT_Q): Likewise. [_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_Q): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_Q): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_QP): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_Q): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_QP): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_Q): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_QP): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_Q): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_QP): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_Q): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_QP): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_Q): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_QP): Likewise. [_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_Q): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_CMP_Q): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_Q): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_Q): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_Q): Likewise. [_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_Q): Likewise. * soft-fp/single.h (FP_UNPACK_RAW_S): Likewise. (FP_UNPACK_RAW_SP): Likewise. (FP_PACK_RAW_S): Likewise. (FP_PACK_RAW_SP): Likewise. (FP_UNPACK_S): Likewise. (FP_UNPACK_SP): Likewise. (FP_UNPACK_SEMIRAW_S): Likewise. (FP_UNPACK_SEMIRAW_SP): Likewise. (FP_PACK_S): Likewise. (FP_PACK_SP): Likewise. (FP_PACK_SEMIRAW_S): Likewise. (FP_PACK_SEMIRAW_SP): Likewise. (_FP_SQRT_MEAT_S): Likewise. (FP_CMP_S): Likewise. (FP_CMP_EQ_S): Likewise. (FP_CMP_UNORD_S): Likewise. (FP_TO_INT_S): Likewise. (FP_FROM_INT_S): Likewise. --- ChangeLog | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++ soft-fp/double.h | 72 ++++++++++++------------ soft-fp/extended.h | 82 ++++++++++++++-------------- soft-fp/op-1.h | 52 +++++++++--------- soft-fp/op-2.h | 72 ++++++++++++------------ soft-fp/op-4.h | 122 +++++++++++++++++++++++------------------ soft-fp/op-common.h | 125 +++++++++++++++++++++--------------------- soft-fp/quad.h | 72 ++++++++++++------------ soft-fp/single.h | 36 ++++++------ 9 files changed, 482 insertions(+), 305 deletions(-) diff --git a/ChangeLog b/ChangeLog index f8f2221d7c..d41aba674e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,159 @@ 2014-10-09 Joseph Myers + * soft-fp/double.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_D): Use + parentheses around macro arguments. + [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_DP): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_D): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_DP): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_D): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_DP): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_D): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_DP): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_D): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_DP): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_D): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_DP): Likewise. + [_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_D): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_CMP_D): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_D): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_D): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_TO_INT_D): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_D): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_D): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_DP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_D): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_DP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_D): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_DP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_D): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_DP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_D): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_DP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_D): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_DP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_D): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_CMP_D): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_D): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_D): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_D): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_D): Likewise. + * soft-fp/extended.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_E): + Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_EP): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_E): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_EP): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_E): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_EP): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_E): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_EP): Likewise. + [_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_E): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_CMP_E): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_E): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_E): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_TO_INT_E): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_E): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_E): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_EP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_E): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_EP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_E): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_EP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_E): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_EP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_E): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_CMP_E): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_E): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_E): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_E): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_E): Likewise. + * soft-fp/op-1.h (_FP_FRAC_SRST_1): Likewise. + (_FP_FRAC_SRS_1): Likewise. + (_FP_FRAC_CLZ_1): Likewise. + (_FP_MUL_MEAT_1_imm): Likewise. + (_FP_MUL_MEAT_1_wide): Likewise. + (_FP_MUL_MEAT_1_hard): Likewise. + (_FP_SQRT_MEAT_1): Likewise. + (_FP_FRAC_ASSEMBLE_1): Likewise. + (_FP_FRAC_DISASSEMBLE_1): Likewise. + * soft-fp/op-2.h (_FP_FRAC_CLZ_2): Likewise. + (__FP_CLZ_2): Likewise. + (_FP_MUL_MEAT_2_wide): Likewise. + (_FP_MUL_MEAT_2_wide_3mul): Likewise. + (_FP_MUL_MEAT_2_gmp): Likewise. + (_FP_MUL_MEAT_2_120_240_double): Likewise. + (_FP_SQRT_MEAT_2): Likewise. + (_FP_FRAC_ASSEMBLE_2): Likewise. + (_FP_FRAC_DISASSEMBLE_2): Likewise. + * soft-fp/op-4.h (_FP_FRAC_SRS_4): Likewise. + (_FP_FRAC_CLZ_4): Likewise. + (_FP_MUL_MEAT_4_wide): Likewise. + (_FP_MUL_MEAT_4_gmp): Likewise. + (_FP_SQRT_MEAT_4): Likewise. + (_FP_FRAC_ASSEMBLE_4): Likewise. + (_FP_FRAC_DISASSEMBLE_4): Likewise. + * soft-fp/op-common.h (_FP_CMP): Likewise. + (_FP_CMP_EQ): Likewise. + (_FP_CMP_UNORD): Likewise. + (_FP_TO_INT): Likewise. + (_FP_FROM_INT): Likewise. + [!__FP_CLZ] (__FP_CLZ): Likewise. + (_FP_DIV_HELP_imm): Likewise. + * soft-fp/quad.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_Q): + Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_QP): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_Q): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_QP): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_Q): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_QP): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_Q): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_QP): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_Q): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_QP): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_Q): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_QP): Likewise. + [_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_Q): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_CMP_Q): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_Q): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_Q): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_TO_INT_Q): Likewise. + [_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_Q): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_Q): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_QP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_Q): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_QP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_Q): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_QP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_Q): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_QP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_Q): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_QP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_Q): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_QP): Likewise. + [_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_Q): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_CMP_Q): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_Q): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_Q): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_Q): Likewise. + [_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_Q): Likewise. + * soft-fp/single.h (FP_UNPACK_RAW_S): Likewise. + (FP_UNPACK_RAW_SP): Likewise. + (FP_PACK_RAW_S): Likewise. + (FP_PACK_RAW_SP): Likewise. + (FP_UNPACK_S): Likewise. + (FP_UNPACK_SP): Likewise. + (FP_UNPACK_SEMIRAW_S): Likewise. + (FP_UNPACK_SEMIRAW_SP): Likewise. + (FP_PACK_S): Likewise. + (FP_PACK_SP): Likewise. + (FP_PACK_SEMIRAW_S): Likewise. + (FP_PACK_SEMIRAW_SP): Likewise. + (_FP_SQRT_MEAT_S): Likewise. + (FP_CMP_S): Likewise. + (FP_CMP_EQ_S): Likewise. + (FP_CMP_UNORD_S): Likewise. + (FP_TO_INT_S): Likewise. + (FP_FROM_INT_S): Likewise. + * soft-fp/op-common.h (_FP_TO_INT): Handle rsigned == 2. * soft-fp/soft-fp.h (FP_EX_INVALID_SNAN): New macro. diff --git a/soft-fp/double.h b/soft-fp/double.h index 1e6283e655..36a11a5452 100644 --- a/soft-fp/double.h +++ b/soft-fp/double.h @@ -90,21 +90,21 @@ union _FP_UNION_D }; # define FP_DECL_D(X) _FP_DECL (2, X) -# define FP_UNPACK_RAW_D(X, val) _FP_UNPACK_RAW_2 (D, X, val) -# define FP_UNPACK_RAW_DP(X, val) _FP_UNPACK_RAW_2_P (D, X, val) -# define FP_PACK_RAW_D(val, X) _FP_PACK_RAW_2 (D, val, X) +# define FP_UNPACK_RAW_D(X, val) _FP_UNPACK_RAW_2 (D, X, (val)) +# define FP_UNPACK_RAW_DP(X, val) _FP_UNPACK_RAW_2_P (D, X, (val)) +# define FP_PACK_RAW_D(val, X) _FP_PACK_RAW_2 (D, (val), X) # define FP_PACK_RAW_DP(val, X) \ do \ { \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_2_P (D, val, X); \ + _FP_PACK_RAW_2_P (D, (val), X); \ } \ while (0) # define FP_UNPACK_D(X, val) \ do \ { \ - _FP_UNPACK_RAW_2 (D, X, val); \ + _FP_UNPACK_RAW_2 (D, X, (val)); \ _FP_UNPACK_CANONICAL (D, 2, X); \ } \ while (0) @@ -112,7 +112,7 @@ union _FP_UNION_D # define FP_UNPACK_DP(X, val) \ do \ { \ - _FP_UNPACK_RAW_2_P (D, X, val); \ + _FP_UNPACK_RAW_2_P (D, X, (val)); \ _FP_UNPACK_CANONICAL (D, 2, X); \ } \ while (0) @@ -120,7 +120,7 @@ union _FP_UNION_D # define FP_UNPACK_SEMIRAW_D(X, val) \ do \ { \ - _FP_UNPACK_RAW_2 (D, X, val); \ + _FP_UNPACK_RAW_2 (D, X, (val)); \ _FP_UNPACK_SEMIRAW (D, 2, X); \ } \ while (0) @@ -128,7 +128,7 @@ union _FP_UNION_D # define FP_UNPACK_SEMIRAW_DP(X, val) \ do \ { \ - _FP_UNPACK_RAW_2_P (D, X, val); \ + _FP_UNPACK_RAW_2_P (D, X, (val)); \ _FP_UNPACK_SEMIRAW (D, 2, X); \ } \ while (0) @@ -137,7 +137,7 @@ union _FP_UNION_D do \ { \ _FP_PACK_CANONICAL (D, 2, X); \ - _FP_PACK_RAW_2 (D, val, X); \ + _FP_PACK_RAW_2 (D, (val), X); \ } \ while (0) @@ -146,7 +146,7 @@ union _FP_UNION_D { \ _FP_PACK_CANONICAL (D, 2, X); \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_2_P (D, val, X); \ + _FP_PACK_RAW_2_P (D, (val), X); \ } \ while (0) @@ -154,7 +154,7 @@ union _FP_UNION_D do \ { \ _FP_PACK_SEMIRAW (D, 2, X); \ - _FP_PACK_RAW_2 (D, val, X); \ + _FP_PACK_RAW_2 (D, (val), X); \ } \ while (0) @@ -163,7 +163,7 @@ union _FP_UNION_D { \ _FP_PACK_SEMIRAW (D, 2, X); \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_2_P (D, val, X); \ + _FP_PACK_RAW_2_P (D, (val), X); \ } \ while (0) @@ -174,15 +174,15 @@ union _FP_UNION_D # define FP_MUL_D(R, X, Y) _FP_MUL (D, 2, R, X, Y) # define FP_DIV_D(R, X, Y) _FP_DIV (D, 2, R, X, Y) # define FP_SQRT_D(R, X) _FP_SQRT (D, 2, R, X) -# define _FP_SQRT_MEAT_D(R, S, T, X, Q) _FP_SQRT_MEAT_2 (R, S, T, X, Q) +# define _FP_SQRT_MEAT_D(R, S, T, X, Q) _FP_SQRT_MEAT_2 (R, S, T, X, (Q)) # define FP_FMA_D(R, X, Y, Z) _FP_FMA (D, 2, 4, R, X, Y, Z) -# define FP_CMP_D(r, X, Y, un, ex) _FP_CMP (D, 2, r, X, Y, un, ex) -# define FP_CMP_EQ_D(r, X, Y, ex) _FP_CMP_EQ (D, 2, r, X, Y, ex) -# define FP_CMP_UNORD_D(r, X, Y, ex) _FP_CMP_UNORD (D, 2, r, X, Y, ex) +# define FP_CMP_D(r, X, Y, un, ex) _FP_CMP (D, 2, (r), X, Y, (un), (ex)) +# define FP_CMP_EQ_D(r, X, Y, ex) _FP_CMP_EQ (D, 2, (r), X, Y, (ex)) +# define FP_CMP_UNORD_D(r, X, Y, ex) _FP_CMP_UNORD (D, 2, (r), X, Y, (ex)) -# define FP_TO_INT_D(r, X, rsz, rsg) _FP_TO_INT (D, 2, r, X, rsz, rsg) -# define FP_FROM_INT_D(X, r, rs, rt) _FP_FROM_INT (D, 2, X, r, rs, rt) +# define FP_TO_INT_D(r, X, rsz, rsg) _FP_TO_INT (D, 2, (r), X, (rsz), (rsg)) +# define FP_FROM_INT_D(X, r, rs, rt) _FP_FROM_INT (D, 2, X, (r), (rs), rt) # define _FP_FRAC_HIGH_D(X) _FP_FRAC_HIGH_2 (X) # define _FP_FRAC_HIGH_RAW_D(X) _FP_FRAC_HIGH_2 (X) @@ -209,21 +209,21 @@ union _FP_UNION_D }; # define FP_DECL_D(X) _FP_DECL (1, X) -# define FP_UNPACK_RAW_D(X, val) _FP_UNPACK_RAW_1 (D, X, val) -# define FP_UNPACK_RAW_DP(X, val) _FP_UNPACK_RAW_1_P (D, X, val) -# define FP_PACK_RAW_D(val, X) _FP_PACK_RAW_1 (D, val, X) +# define FP_UNPACK_RAW_D(X, val) _FP_UNPACK_RAW_1 (D, X, (val)) +# define FP_UNPACK_RAW_DP(X, val) _FP_UNPACK_RAW_1_P (D, X, (val)) +# define FP_PACK_RAW_D(val, X) _FP_PACK_RAW_1 (D, (val), X) # define FP_PACK_RAW_DP(val, X) \ do \ { \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_1_P (D, val, X); \ + _FP_PACK_RAW_1_P (D, (val), X); \ } \ while (0) # define FP_UNPACK_D(X, val) \ do \ { \ - _FP_UNPACK_RAW_1 (D, X, val); \ + _FP_UNPACK_RAW_1 (D, X, (val)); \ _FP_UNPACK_CANONICAL (D, 1, X); \ } \ while (0) @@ -231,7 +231,7 @@ union _FP_UNION_D # define FP_UNPACK_DP(X, val) \ do \ { \ - _FP_UNPACK_RAW_1_P (D, X, val); \ + _FP_UNPACK_RAW_1_P (D, X, (val)); \ _FP_UNPACK_CANONICAL (D, 1, X); \ } \ while (0) @@ -239,7 +239,7 @@ union _FP_UNION_D # define FP_UNPACK_SEMIRAW_D(X, val) \ do \ { \ - _FP_UNPACK_RAW_1 (D, X, val); \ + _FP_UNPACK_RAW_1 (D, X, (val)); \ _FP_UNPACK_SEMIRAW (D, 1, X); \ } \ while (0) @@ -247,7 +247,7 @@ union _FP_UNION_D # define FP_UNPACK_SEMIRAW_DP(X, val) \ do \ { \ - _FP_UNPACK_RAW_1_P (D, X, val); \ + _FP_UNPACK_RAW_1_P (D, X, (val)); \ _FP_UNPACK_SEMIRAW (D, 1, X); \ } \ while (0) @@ -256,7 +256,7 @@ union _FP_UNION_D do \ { \ _FP_PACK_CANONICAL (D, 1, X); \ - _FP_PACK_RAW_1 (D, val, X); \ + _FP_PACK_RAW_1 (D, (val), X); \ } \ while (0) @@ -265,7 +265,7 @@ union _FP_UNION_D { \ _FP_PACK_CANONICAL (D, 1, X); \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_1_P (D, val, X); \ + _FP_PACK_RAW_1_P (D, (val), X); \ } \ while (0) @@ -273,7 +273,7 @@ union _FP_UNION_D do \ { \ _FP_PACK_SEMIRAW (D, 1, X); \ - _FP_PACK_RAW_1 (D, val, X); \ + _FP_PACK_RAW_1 (D, (val), X); \ } \ while (0) @@ -282,7 +282,7 @@ union _FP_UNION_D { \ _FP_PACK_SEMIRAW (D, 1, X); \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_1_P (D, val, X); \ + _FP_PACK_RAW_1_P (D, (val), X); \ } \ while (0) @@ -293,18 +293,18 @@ union _FP_UNION_D # define FP_MUL_D(R, X, Y) _FP_MUL (D, 1, R, X, Y) # define FP_DIV_D(R, X, Y) _FP_DIV (D, 1, R, X, Y) # define FP_SQRT_D(R, X) _FP_SQRT (D, 1, R, X) -# define _FP_SQRT_MEAT_D(R, S, T, X, Q) _FP_SQRT_MEAT_1 (R, S, T, X, Q) +# define _FP_SQRT_MEAT_D(R, S, T, X, Q) _FP_SQRT_MEAT_1 (R, S, T, X, (Q)) # define FP_FMA_D(R, X, Y, Z) _FP_FMA (D, 1, 2, R, X, Y, Z) /* The implementation of _FP_MUL_D and _FP_DIV_D should be chosen by the target machine. */ -# define FP_CMP_D(r, X, Y, un, ex) _FP_CMP (D, 1, r, X, Y, un, ex) -# define FP_CMP_EQ_D(r, X, Y, ex) _FP_CMP_EQ (D, 1, r, X, Y, ex) -# define FP_CMP_UNORD_D(r, X, Y, ex) _FP_CMP_UNORD (D, 1, r, X, Y, ex) +# define FP_CMP_D(r, X, Y, un, ex) _FP_CMP (D, 1, (r), X, Y, (un), (ex)) +# define FP_CMP_EQ_D(r, X, Y, ex) _FP_CMP_EQ (D, 1, (r), X, Y, (ex)) +# define FP_CMP_UNORD_D(r, X, Y, ex) _FP_CMP_UNORD (D, 1, (r), X, Y, (ex)) -# define FP_TO_INT_D(r, X, rsz, rsg) _FP_TO_INT (D, 1, r, X, rsz, rsg) -# define FP_FROM_INT_D(X, r, rs, rt) _FP_FROM_INT (D, 1, X, r, rs, rt) +# define FP_TO_INT_D(r, X, rsz, rsg) _FP_TO_INT (D, 1, (r), X, (rsz), (rsg)) +# define FP_FROM_INT_D(X, r, rs, rt) _FP_FROM_INT (D, 1, X, (r), (rs), rt) # define _FP_FRAC_HIGH_D(X) _FP_FRAC_HIGH_1 (X) # define _FP_FRAC_HIGH_RAW_D(X) _FP_FRAC_HIGH_1 (X) diff --git a/soft-fp/extended.h b/soft-fp/extended.h index 0dd6a87083..d16fa66174 100644 --- a/soft-fp/extended.h +++ b/soft-fp/extended.h @@ -162,7 +162,7 @@ union _FP_UNION_E # define FP_UNPACK_E(X, val) \ do \ { \ - FP_UNPACK_RAW_E (X, val); \ + FP_UNPACK_RAW_E (X, (val)); \ _FP_UNPACK_CANONICAL (E, 4, X); \ } \ while (0) @@ -170,7 +170,7 @@ union _FP_UNION_E # define FP_UNPACK_EP(X, val) \ do \ { \ - FP_UNPACK_RAW_EP (X, val); \ + FP_UNPACK_RAW_EP (X, (val)); \ _FP_UNPACK_CANONICAL (E, 4, X); \ } \ while (0) @@ -178,7 +178,7 @@ union _FP_UNION_E # define FP_UNPACK_SEMIRAW_E(X, val) \ do \ { \ - FP_UNPACK_RAW_E (X, val); \ + FP_UNPACK_RAW_E (X, (val)); \ _FP_UNPACK_SEMIRAW (E, 4, X); \ } \ while (0) @@ -186,7 +186,7 @@ union _FP_UNION_E # define FP_UNPACK_SEMIRAW_EP(X, val) \ do \ { \ - FP_UNPACK_RAW_EP (X, val); \ + FP_UNPACK_RAW_EP (X, (val)); \ _FP_UNPACK_SEMIRAW (E, 4, X); \ } \ while (0) @@ -195,7 +195,7 @@ union _FP_UNION_E do \ { \ _FP_PACK_CANONICAL (E, 4, X); \ - FP_PACK_RAW_E (val, X); \ + FP_PACK_RAW_E ((val), X); \ } \ while (0) @@ -203,7 +203,7 @@ union _FP_UNION_E do \ { \ _FP_PACK_CANONICAL (E, 4, X); \ - FP_PACK_RAW_EP (val, X); \ + FP_PACK_RAW_EP ((val), X); \ } \ while (0) @@ -211,7 +211,7 @@ union _FP_UNION_E do \ { \ _FP_PACK_SEMIRAW (E, 4, X); \ - FP_PACK_RAW_E (val, X); \ + FP_PACK_RAW_E ((val), X); \ } \ while (0) @@ -219,7 +219,7 @@ union _FP_UNION_E do \ { \ _FP_PACK_SEMIRAW (E, 4, X); \ - FP_PACK_RAW_EP (val, X); \ + FP_PACK_RAW_EP ((val), X); \ } \ while (0) @@ -244,36 +244,36 @@ union _FP_UNION_E # define _FP_SQRT_MEAT_E(R, S, T, X, q) \ do \ { \ - q = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \ + (q) = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \ _FP_FRAC_SRL_4 (X, (_FP_WORKBITS)); \ while (q) \ { \ - T##_f[1] = S##_f[1] + q; \ + T##_f[1] = S##_f[1] + (q); \ if (T##_f[1] <= X##_f[1]) \ { \ - S##_f[1] = T##_f[1] + q; \ + S##_f[1] = T##_f[1] + (q); \ X##_f[1] -= T##_f[1]; \ - R##_f[1] += q; \ + R##_f[1] += (q); \ } \ _FP_FRAC_SLL_2 (X, 1); \ - q >>= 1; \ + (q) >>= 1; \ } \ - q = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \ + (q) = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \ while (q) \ { \ - T##_f[0] = S##_f[0] + q; \ + T##_f[0] = S##_f[0] + (q); \ T##_f[1] = S##_f[1]; \ if (T##_f[1] < X##_f[1] \ || (T##_f[1] == X##_f[1] \ && T##_f[0] <= X##_f[0])) \ { \ - S##_f[0] = T##_f[0] + q; \ + S##_f[0] = T##_f[0] + (q); \ S##_f[1] += (T##_f[0] > S##_f[0]); \ _FP_FRAC_DEC_2 (X, T); \ - R##_f[0] += q; \ + R##_f[0] += (q); \ } \ _FP_FRAC_SLL_2 (X, 1); \ - q >>= 1; \ + (q) >>= 1; \ } \ _FP_FRAC_SLL_4 (R, (_FP_WORKBITS)); \ if (X##_f[0] | X##_f[1]) \ @@ -287,12 +287,12 @@ union _FP_UNION_E } \ while (0) -# define FP_CMP_E(r, X, Y, un, ex) _FP_CMP (E, 4, r, X, Y, un, ex) -# define FP_CMP_EQ_E(r, X, Y, ex) _FP_CMP_EQ (E, 4, r, X, Y, ex) -# define FP_CMP_UNORD_E(r, X, Y, ex) _FP_CMP_UNORD (E, 4, r, X, Y, ex) +# define FP_CMP_E(r, X, Y, un, ex) _FP_CMP (E, 4, (r), X, Y, (un), (ex)) +# define FP_CMP_EQ_E(r, X, Y, ex) _FP_CMP_EQ (E, 4, (r), X, Y, (ex)) +# define FP_CMP_UNORD_E(r, X, Y, ex) _FP_CMP_UNORD (E, 4, (r), X, Y, (ex)) -# define FP_TO_INT_E(r, X, rsz, rsg) _FP_TO_INT (E, 4, r, X, rsz, rsg) -# define FP_FROM_INT_E(X, r, rs, rt) _FP_FROM_INT (E, 4, X, r, rs, rt) +# define FP_TO_INT_E(r, X, rsz, rsg) _FP_TO_INT (E, 4, (r), X, (rsz), (rsg)) +# define FP_FROM_INT_E(X, r, rs, rt) _FP_FROM_INT (E, 4, X, (r), (rs), rt) # define _FP_FRAC_HIGH_E(X) (X##_f[2]) # define _FP_FRAC_HIGH_RAW_E(X) (X##_f[1]) @@ -386,7 +386,7 @@ union _FP_UNION_E # define FP_UNPACK_E(X, val) \ do \ { \ - FP_UNPACK_RAW_E (X, val); \ + FP_UNPACK_RAW_E (X, (val)); \ _FP_UNPACK_CANONICAL (E, 2, X); \ } \ while (0) @@ -394,7 +394,7 @@ union _FP_UNION_E # define FP_UNPACK_EP(X, val) \ do \ { \ - FP_UNPACK_RAW_EP (X, val); \ + FP_UNPACK_RAW_EP (X, (val)); \ _FP_UNPACK_CANONICAL (E, 2, X); \ } \ while (0) @@ -402,7 +402,7 @@ union _FP_UNION_E # define FP_UNPACK_SEMIRAW_E(X, val) \ do \ { \ - FP_UNPACK_RAW_E (X, val); \ + FP_UNPACK_RAW_E (X, (val)); \ _FP_UNPACK_SEMIRAW (E, 2, X); \ } \ while (0) @@ -410,7 +410,7 @@ union _FP_UNION_E # define FP_UNPACK_SEMIRAW_EP(X, val) \ do \ { \ - FP_UNPACK_RAW_EP (X, val); \ + FP_UNPACK_RAW_EP (X, (val)); \ _FP_UNPACK_SEMIRAW (E, 2, X); \ } \ while (0) @@ -419,7 +419,7 @@ union _FP_UNION_E do \ { \ _FP_PACK_CANONICAL (E, 2, X); \ - FP_PACK_RAW_E (val, X); \ + FP_PACK_RAW_E ((val), X); \ } \ while (0) @@ -427,7 +427,7 @@ union _FP_UNION_E do \ { \ _FP_PACK_CANONICAL (E, 2, X); \ - FP_PACK_RAW_EP (val, X); \ + FP_PACK_RAW_EP ((val), X); \ } \ while (0) @@ -435,7 +435,7 @@ union _FP_UNION_E do \ { \ _FP_PACK_SEMIRAW (E, 2, X); \ - FP_PACK_RAW_E (val, X); \ + FP_PACK_RAW_E ((val), X); \ } \ while (0) @@ -443,7 +443,7 @@ union _FP_UNION_E do \ { \ _FP_PACK_SEMIRAW (E, 2, X); \ - FP_PACK_RAW_EP (val, X); \ + FP_PACK_RAW_EP ((val), X); \ } \ while (0) @@ -465,19 +465,19 @@ union _FP_UNION_E # define _FP_SQRT_MEAT_E(R, S, T, X, q) \ do \ { \ - q = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \ + (q) = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \ _FP_FRAC_SRL_2 (X, (_FP_WORKBITS)); \ while (q) \ { \ - T##_f0 = S##_f0 + q; \ + T##_f0 = S##_f0 + (q); \ if (T##_f0 <= X##_f0) \ { \ - S##_f0 = T##_f0 + q; \ + S##_f0 = T##_f0 + (q); \ X##_f0 -= T##_f0; \ - R##_f0 += q; \ + R##_f0 += (q); \ } \ _FP_FRAC_SLL_1 (X, 1); \ - q >>= 1; \ + (q) >>= 1; \ } \ _FP_FRAC_SLL_2 (R, (_FP_WORKBITS)); \ if (X##_f0) \ @@ -489,12 +489,12 @@ union _FP_UNION_E } \ while (0) -# define FP_CMP_E(r, X, Y, un, ex) _FP_CMP (E, 2, r, X, Y, un, ex) -# define FP_CMP_EQ_E(r, X, Y, ex) _FP_CMP_EQ (E, 2, r, X, Y, ex) -# define FP_CMP_UNORD_E(r, X, Y, ex) _FP_CMP_UNORD (E, 2, r, X, Y, ex) +# define FP_CMP_E(r, X, Y, un, ex) _FP_CMP (E, 2, (r), X, Y, (un), (ex)) +# define FP_CMP_EQ_E(r, X, Y, ex) _FP_CMP_EQ (E, 2, (r), X, Y, (ex)) +# define FP_CMP_UNORD_E(r, X, Y, ex) _FP_CMP_UNORD (E, 2, (r), X, Y, (ex)) -# define FP_TO_INT_E(r, X, rsz, rsg) _FP_TO_INT (E, 2, r, X, rsz, rsg) -# define FP_FROM_INT_E(X, r, rs, rt) _FP_FROM_INT (E, 2, X, r, rs, rt) +# define FP_TO_INT_E(r, X, rsz, rsg) _FP_TO_INT (E, 2, (r), X, (rsz), (rsg)) +# define FP_FROM_INT_E(X, r, rs, rt) _FP_FROM_INT (E, 2, X, (r), (rs), rt) # define _FP_FRAC_HIGH_E(X) (X##_f1) # define _FP_FRAC_HIGH_RAW_E(X) (X##_f0) diff --git a/soft-fp/op-1.h b/soft-fp/op-1.h index fa68269910..177705caa3 100644 --- a/soft-fp/op-1.h +++ b/soft-fp/op-1.h @@ -50,8 +50,8 @@ #define _FP_FRAC_SRL_1(X, N) (X##_f >>= N) /* Right shift with sticky-lsb. */ -#define _FP_FRAC_SRST_1(X, S, N, sz) __FP_FRAC_SRST_1 (X##_f, S, N, sz) -#define _FP_FRAC_SRS_1(X, N, sz) __FP_FRAC_SRS_1 (X##_f, N, sz) +#define _FP_FRAC_SRST_1(X, S, N, sz) __FP_FRAC_SRST_1 (X##_f, S, (N), (sz)) +#define _FP_FRAC_SRS_1(X, N, sz) __FP_FRAC_SRS_1 (X##_f, (N), (sz)) #define __FP_FRAC_SRST_1(X, S, N, sz) \ do \ @@ -71,7 +71,7 @@ #define _FP_FRAC_ADD_1(R, X, Y) (R##_f = X##_f + Y##_f) #define _FP_FRAC_SUB_1(R, X, Y) (R##_f = X##_f - Y##_f) #define _FP_FRAC_DEC_1(X, Y) (X##_f -= Y##_f) -#define _FP_FRAC_CLZ_1(z, X) __FP_CLZ (z, X##_f) +#define _FP_FRAC_CLZ_1(z, X) __FP_CLZ ((z), X##_f) /* Predicates. */ #define _FP_FRAC_NEGP_1(X) ((_FP_WS_TYPE) X##_f < 0) @@ -157,11 +157,11 @@ #define _FP_MUL_MEAT_1_imm(wfracbits, R, X, Y) \ do \ { \ - _FP_MUL_MEAT_DW_1_imm (wfracbits, R, X, Y); \ + _FP_MUL_MEAT_DW_1_imm ((wfracbits), R, X, Y); \ /* Normalize since we know where the msb of the multiplicands \ were (bit B), we know that the msb of the of the product is \ at either 2B or 2B-1. */ \ - _FP_FRAC_SRS_1 (R, wfracbits-1, 2*wfracbits); \ + _FP_FRAC_SRS_1 (R, (wfracbits)-1, 2*(wfracbits)); \ } \ while (0) @@ -178,12 +178,13 @@ do \ { \ _FP_FRAC_DECL_2 (_FP_MUL_MEAT_1_wide_Z); \ - _FP_MUL_MEAT_DW_1_wide (wfracbits, _FP_MUL_MEAT_1_wide_Z, \ + _FP_MUL_MEAT_DW_1_wide ((wfracbits), _FP_MUL_MEAT_1_wide_Z, \ X, Y, doit); \ /* Normalize since we know where the msb of the multiplicands \ were (bit B), we know that the msb of the of the product is \ at either 2B or 2B-1. */ \ - _FP_FRAC_SRS_2 (_FP_MUL_MEAT_1_wide_Z, wfracbits-1, 2*wfracbits); \ + _FP_FRAC_SRS_2 (_FP_MUL_MEAT_1_wide_Z, (wfracbits)-1, \ + 2*(wfracbits)); \ R##_f = _FP_MUL_MEAT_1_wide_Z_f0; \ } \ while (0) @@ -225,17 +226,18 @@ } \ while (0) -#define _FP_MUL_MEAT_1_hard(wfracbits, R, X, Y) \ - do \ - { \ - _FP_FRAC_DECL_2 (_FP_MUL_MEAT_1_hard_z); \ - _FP_MUL_MEAT_DW_1_hard (wfracbits, _FP_MUL_MEAT_1_hard_z, X, Y); \ - \ - /* Normalize. */ \ - _FP_FRAC_SRS_2 (_FP_MUL_MEAT_1_hard_z, \ - wfracbits - 1, 2*wfracbits); \ - R##_f = _FP_MUL_MEAT_1_hard_z_f0; \ - } \ +#define _FP_MUL_MEAT_1_hard(wfracbits, R, X, Y) \ + do \ + { \ + _FP_FRAC_DECL_2 (_FP_MUL_MEAT_1_hard_z); \ + _FP_MUL_MEAT_DW_1_hard ((wfracbits), \ + _FP_MUL_MEAT_1_hard_z, X, Y); \ + \ + /* Normalize. */ \ + _FP_FRAC_SRS_2 (_FP_MUL_MEAT_1_hard_z, \ + (wfracbits) - 1, 2*(wfracbits)); \ + R##_f = _FP_MUL_MEAT_1_hard_z_f0; \ + } \ while (0) @@ -329,17 +331,17 @@ #define _FP_SQRT_MEAT_1(R, S, T, X, q) \ do \ { \ - while (q != _FP_WORK_ROUND) \ + while ((q) != _FP_WORK_ROUND) \ { \ - T##_f = S##_f + q; \ + T##_f = S##_f + (q); \ if (T##_f <= X##_f) \ { \ - S##_f = T##_f + q; \ + S##_f = T##_f + (q); \ X##_f -= T##_f; \ - R##_f += q; \ + R##_f += (q); \ } \ _FP_FRAC_SLL_1 (X, 1); \ - q >>= 1; \ + (q) >>= 1; \ } \ if (X##_f) \ { \ @@ -353,8 +355,8 @@ /* Assembly/disassembly for converting to/from integral types. No shifting or overflow handled here. */ -#define _FP_FRAC_ASSEMBLE_1(r, X, rsize) (r = X##_f) -#define _FP_FRAC_DISASSEMBLE_1(X, r, rsize) (X##_f = r) +#define _FP_FRAC_ASSEMBLE_1(r, X, rsize) ((r) = X##_f) +#define _FP_FRAC_DISASSEMBLE_1(X, r, rsize) (X##_f = (r)) /* Convert FP values between word sizes. */ diff --git a/soft-fp/op-2.h b/soft-fp/op-2.h index 6a6f93876b..50028f72d2 100644 --- a/soft-fp/op-2.h +++ b/soft-fp/op-2.h @@ -122,11 +122,11 @@ do \ { \ if (X##_f1) \ - __FP_CLZ (R, X##_f1); \ + __FP_CLZ ((R), X##_f1); \ else \ { \ - __FP_CLZ (R, X##_f0); \ - R += _FP_W_TYPE_SIZE; \ + __FP_CLZ ((R), X##_f0); \ + (R) += _FP_W_TYPE_SIZE; \ } \ } \ while (0) @@ -156,11 +156,11 @@ do \ { \ if (xh) \ - __FP_CLZ (R, xh); \ + __FP_CLZ ((R), xh); \ else \ { \ - __FP_CLZ (R, xl); \ - R += _FP_W_TYPE_SIZE; \ + __FP_CLZ ((R), xl); \ + (R) += _FP_W_TYPE_SIZE; \ } \ } \ while (0) @@ -302,13 +302,14 @@ { \ _FP_FRAC_DECL_4 (_FP_MUL_MEAT_2_wide_z); \ \ - _FP_MUL_MEAT_DW_2_wide (wfracbits, _FP_MUL_MEAT_2_wide_z, \ + _FP_MUL_MEAT_DW_2_wide ((wfracbits), _FP_MUL_MEAT_2_wide_z, \ X, Y, doit); \ \ /* Normalize since we know where the msb of the multiplicands \ were (bit B), we know that the msb of the of the product is \ at either 2B or 2B-1. */ \ - _FP_FRAC_SRS_4 (_FP_MUL_MEAT_2_wide_z, wfracbits-1, 2*wfracbits); \ + _FP_FRAC_SRS_4 (_FP_MUL_MEAT_2_wide_z, (wfracbits)-1, \ + 2*(wfracbits)); \ R##_f0 = _FP_FRAC_WORD_4 (_FP_MUL_MEAT_2_wide_z, 0); \ R##_f1 = _FP_FRAC_WORD_4 (_FP_MUL_MEAT_2_wide_z, 1); \ } \ @@ -375,7 +376,7 @@ { \ _FP_FRAC_DECL_4 (_FP_MUL_MEAT_2_wide_3mul_z); \ \ - _FP_MUL_MEAT_DW_2_wide_3mul (wfracbits, \ + _FP_MUL_MEAT_DW_2_wide_3mul ((wfracbits), \ _FP_MUL_MEAT_2_wide_3mul_z, \ X, Y, doit); \ \ @@ -383,7 +384,7 @@ were (bit B), we know that the msb of the of the product is \ at either 2B or 2B-1. */ \ _FP_FRAC_SRS_4 (_FP_MUL_MEAT_2_wide_3mul_z, \ - wfracbits-1, 2*wfracbits); \ + (wfracbits)-1, 2*(wfracbits)); \ R##_f0 = _FP_FRAC_WORD_4 (_FP_MUL_MEAT_2_wide_3mul_z, 0); \ R##_f1 = _FP_FRAC_WORD_4 (_FP_MUL_MEAT_2_wide_3mul_z, 1); \ } \ @@ -409,12 +410,13 @@ { \ _FP_FRAC_DECL_4 (_FP_MUL_MEAT_2_gmp_z); \ \ - _FP_MUL_MEAT_DW_2_gmp (wfracbits, _FP_MUL_MEAT_2_gmp_z, X, Y); \ + _FP_MUL_MEAT_DW_2_gmp ((wfracbits), _FP_MUL_MEAT_2_gmp_z, X, Y); \ \ /* Normalize since we know where the msb of the multiplicands \ were (bit B), we know that the msb of the of the product is \ at either 2B or 2B-1. */ \ - _FP_FRAC_SRS_4 (_FP_MUL_MEAT_2_gmp_z, wfracbits-1, 2*wfracbits); \ + _FP_FRAC_SRS_4 (_FP_MUL_MEAT_2_gmp_z, (wfracbits)-1, \ + 2*(wfracbits)); \ R##_f0 = _FP_MUL_MEAT_2_gmp_z_f[0]; \ R##_f1 = _FP_MUL_MEAT_2_gmp_z_f[1]; \ } \ @@ -452,7 +454,7 @@ _p240, _q240, _r240, _s240; \ UDItype _t240, _u240, _v240, _w240, _x240, _y240 = 0; \ \ - if (wfracbits < 106 || wfracbits > 120) \ + if ((wfracbits) < 106 || (wfracbits) > 120) \ abort (); \ \ setfetz; \ @@ -629,31 +631,31 @@ { \ while (q) \ { \ - T##_f1 = S##_f1 + q; \ + T##_f1 = S##_f1 + (q); \ if (T##_f1 <= X##_f1) \ { \ - S##_f1 = T##_f1 + q; \ + S##_f1 = T##_f1 + (q); \ X##_f1 -= T##_f1; \ - R##_f1 += q; \ + R##_f1 += (q); \ } \ _FP_FRAC_SLL_2 (X, 1); \ - q >>= 1; \ + (q) >>= 1; \ } \ - q = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \ - while (q != _FP_WORK_ROUND) \ + (q) = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \ + while ((q) != _FP_WORK_ROUND) \ { \ - T##_f0 = S##_f0 + q; \ + T##_f0 = S##_f0 + (q); \ T##_f1 = S##_f1; \ if (T##_f1 < X##_f1 \ || (T##_f1 == X##_f1 && T##_f0 <= X##_f0)) \ { \ - S##_f0 = T##_f0 + q; \ + S##_f0 = T##_f0 + (q); \ S##_f1 += (T##_f0 > S##_f0); \ _FP_FRAC_DEC_2 (X, T); \ - R##_f0 += q; \ + R##_f0 += (q); \ } \ _FP_FRAC_SLL_2 (X, 1); \ - q >>= 1; \ + (q) >>= 1; \ } \ if (X##_f0 | X##_f1) \ { \ @@ -670,20 +672,22 @@ No shifting or overflow handled here. */ #define _FP_FRAC_ASSEMBLE_2(r, X, rsize) \ - (void) ((rsize <= _FP_W_TYPE_SIZE) \ - ? ({ r = X##_f0; }) \ + (void) (((rsize) <= _FP_W_TYPE_SIZE) \ + ? ({ (r) = X##_f0; }) \ : ({ \ - r = X##_f1; \ - r <<= _FP_W_TYPE_SIZE; \ - r += X##_f0; \ + (r) = X##_f1; \ + (r) <<= _FP_W_TYPE_SIZE; \ + (r) += X##_f0; \ })) -#define _FP_FRAC_DISASSEMBLE_2(X, r, rsize) \ - do \ - { \ - X##_f0 = r; \ - X##_f1 = (rsize <= _FP_W_TYPE_SIZE ? 0 : r >> _FP_W_TYPE_SIZE); \ - } \ +#define _FP_FRAC_DISASSEMBLE_2(X, r, rsize) \ + do \ + { \ + X##_f0 = (r); \ + X##_f1 = ((rsize) <= _FP_W_TYPE_SIZE \ + ? 0 \ + : (r) >> _FP_W_TYPE_SIZE); \ + } \ while (0) /* Convert FP values between word sizes. */ diff --git a/soft-fp/op-4.h b/soft-fp/op-4.h index 12731e2e78..d65c08afcc 100644 --- a/soft-fp/op-4.h +++ b/soft-fp/op-4.h @@ -151,7 +151,7 @@ do \ { \ int _FP_FRAC_SRS_4_sticky; \ - _FP_FRAC_SRST_4 (X, _FP_FRAC_SRS_4_sticky, N, size); \ + _FP_FRAC_SRST_4 (X, _FP_FRAC_SRS_4_sticky, (N), (size)); \ X##_f[0] |= _FP_FRAC_SRS_4_sticky; \ } \ while (0) @@ -211,21 +211,21 @@ do \ { \ if (X##_f[3]) \ - __FP_CLZ (R, X##_f[3]); \ + __FP_CLZ ((R), X##_f[3]); \ else if (X##_f[2]) \ { \ - __FP_CLZ (R, X##_f[2]); \ - R += _FP_W_TYPE_SIZE; \ + __FP_CLZ ((R), X##_f[2]); \ + (R) += _FP_W_TYPE_SIZE; \ } \ else if (X##_f[1]) \ { \ - __FP_CLZ (R, X##_f[1]); \ - R += _FP_W_TYPE_SIZE*2; \ + __FP_CLZ ((R), X##_f[1]); \ + (R) += _FP_W_TYPE_SIZE*2; \ } \ else \ { \ - __FP_CLZ (R, X##_f[0]); \ - R += _FP_W_TYPE_SIZE*3; \ + __FP_CLZ ((R), X##_f[0]); \ + (R) += _FP_W_TYPE_SIZE*3; \ } \ } \ while (0) @@ -425,13 +425,14 @@ { \ _FP_FRAC_DECL_8 (_FP_MUL_MEAT_4_wide_z); \ \ - _FP_MUL_MEAT_DW_4_wide (wfracbits, _FP_MUL_MEAT_4_wide_z, \ + _FP_MUL_MEAT_DW_4_wide ((wfracbits), _FP_MUL_MEAT_4_wide_z, \ X, Y, doit); \ \ /* Normalize since we know where the msb of the multiplicands \ were (bit B), we know that the msb of the of the product is \ at either 2B or 2B-1. */ \ - _FP_FRAC_SRS_8 (_FP_MUL_MEAT_4_wide_z, wfracbits-1, 2*wfracbits); \ + _FP_FRAC_SRS_8 (_FP_MUL_MEAT_4_wide_z, (wfracbits)-1, \ + 2*(wfracbits)); \ __FP_FRAC_SET_4 (R, _FP_FRAC_WORD_8 (_FP_MUL_MEAT_4_wide_z, 3), \ _FP_FRAC_WORD_8 (_FP_MUL_MEAT_4_wide_z, 2), \ _FP_FRAC_WORD_8 (_FP_MUL_MEAT_4_wide_z, 1), \ @@ -451,12 +452,13 @@ { \ _FP_FRAC_DECL_8 (_FP_MUL_MEAT_4_gmp_z); \ \ - _FP_MUL_MEAT_DW_4_gmp (wfracbits, _FP_MUL_MEAT_4_gmp_z, X, Y); \ + _FP_MUL_MEAT_DW_4_gmp ((wfracbits), _FP_MUL_MEAT_4_gmp_z, X, Y); \ \ /* Normalize since we know where the msb of the multiplicands \ were (bit B), we know that the msb of the of the product is \ at either 2B or 2B-1. */ \ - _FP_FRAC_SRS_8 (_FP_MUL_MEAT_4_gmp_z, wfracbits-1, 2*wfracbits); \ + _FP_FRAC_SRS_8 (_FP_MUL_MEAT_4_gmp_z, (wfracbits)-1, \ + 2*(wfracbits)); \ __FP_FRAC_SET_4 (R, _FP_FRAC_WORD_8 (_FP_MUL_MEAT_4_gmp_z, 3), \ _FP_FRAC_WORD_8 (_FP_MUL_MEAT_4_gmp_z, 2), \ _FP_FRAC_WORD_8 (_FP_MUL_MEAT_4_gmp_z, 1), \ @@ -570,37 +572,37 @@ { \ while (q) \ { \ - T##_f[3] = S##_f[3] + q; \ + T##_f[3] = S##_f[3] + (q); \ if (T##_f[3] <= X##_f[3]) \ { \ - S##_f[3] = T##_f[3] + q; \ + S##_f[3] = T##_f[3] + (q); \ X##_f[3] -= T##_f[3]; \ - R##_f[3] += q; \ + R##_f[3] += (q); \ } \ _FP_FRAC_SLL_4 (X, 1); \ - q >>= 1; \ + (q) >>= 1; \ } \ - q = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \ + (q) = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \ while (q) \ { \ - T##_f[2] = S##_f[2] + q; \ + T##_f[2] = S##_f[2] + (q); \ T##_f[3] = S##_f[3]; \ if (T##_f[3] < X##_f[3] \ || (T##_f[3] == X##_f[3] && T##_f[2] <= X##_f[2])) \ { \ - S##_f[2] = T##_f[2] + q; \ + S##_f[2] = T##_f[2] + (q); \ S##_f[3] += (T##_f[2] > S##_f[2]); \ __FP_FRAC_DEC_2 (X##_f[3], X##_f[2], \ T##_f[3], T##_f[2]); \ - R##_f[2] += q; \ + R##_f[2] += (q); \ } \ _FP_FRAC_SLL_4 (X, 1); \ - q >>= 1; \ + (q) >>= 1; \ } \ - q = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \ + (q) = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \ while (q) \ { \ - T##_f[1] = S##_f[1] + q; \ + T##_f[1] = S##_f[1] + (q); \ T##_f[2] = S##_f[2]; \ T##_f[3] = S##_f[3]; \ if (T##_f[3] < X##_f[3] \ @@ -609,34 +611,34 @@ || (T##_f[2] == X##_f[2] \ && T##_f[1] <= X##_f[1])))) \ { \ - S##_f[1] = T##_f[1] + q; \ + S##_f[1] = T##_f[1] + (q); \ S##_f[2] += (T##_f[1] > S##_f[1]); \ S##_f[3] += (T##_f[2] > S##_f[2]); \ __FP_FRAC_DEC_3 (X##_f[3], X##_f[2], X##_f[1], \ T##_f[3], T##_f[2], T##_f[1]); \ - R##_f[1] += q; \ + R##_f[1] += (q); \ } \ _FP_FRAC_SLL_4 (X, 1); \ - q >>= 1; \ + (q) >>= 1; \ } \ - q = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \ - while (q != _FP_WORK_ROUND) \ + (q) = (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE - 1); \ + while ((q) != _FP_WORK_ROUND) \ { \ - T##_f[0] = S##_f[0] + q; \ + T##_f[0] = S##_f[0] + (q); \ T##_f[1] = S##_f[1]; \ T##_f[2] = S##_f[2]; \ T##_f[3] = S##_f[3]; \ if (_FP_FRAC_GE_4 (X, T)) \ { \ - S##_f[0] = T##_f[0] + q; \ + S##_f[0] = T##_f[0] + (q); \ S##_f[1] += (T##_f[0] > S##_f[0]); \ S##_f[2] += (T##_f[1] > S##_f[1]); \ S##_f[3] += (T##_f[2] > S##_f[2]); \ _FP_FRAC_DEC_4 (X, T); \ - R##_f[0] += q; \ + R##_f[0] += (q); \ } \ _FP_FRAC_SLL_4 (X, 1); \ - q >>= 1; \ + (q) >>= 1; \ } \ if (!_FP_FRAC_ZEROP_4 (X)) \ { \ @@ -797,25 +799,33 @@ #define _FP_FRAC_ASSEMBLE_4(r, X, rsize) \ do \ { \ - if (rsize <= _FP_W_TYPE_SIZE) \ - r = X##_f[0]; \ - else if (rsize <= 2*_FP_W_TYPE_SIZE) \ + if ((rsize) <= _FP_W_TYPE_SIZE) \ + (r) = X##_f[0]; \ + else if ((rsize) <= 2*_FP_W_TYPE_SIZE) \ { \ - r = X##_f[1]; \ - r = (rsize <= _FP_W_TYPE_SIZE ? 0 : r << _FP_W_TYPE_SIZE); \ - r += X##_f[0]; \ + (r) = X##_f[1]; \ + (r) = ((rsize) <= _FP_W_TYPE_SIZE \ + ? 0 \ + : (r) << _FP_W_TYPE_SIZE); \ + (r) += X##_f[0]; \ } \ else \ { \ /* I'm feeling lazy so we deal with int == 3words \ (implausible) and int == 4words as a single case. */ \ - r = X##_f[3]; \ - r = (rsize <= _FP_W_TYPE_SIZE ? 0 : r << _FP_W_TYPE_SIZE); \ - r += X##_f[2]; \ - r = (rsize <= _FP_W_TYPE_SIZE ? 0 : r << _FP_W_TYPE_SIZE); \ - r += X##_f[1]; \ - r = (rsize <= _FP_W_TYPE_SIZE ? 0 : r << _FP_W_TYPE_SIZE); \ - r += X##_f[0]; \ + (r) = X##_f[3]; \ + (r) = ((rsize) <= _FP_W_TYPE_SIZE \ + ? 0 \ + : (r) << _FP_W_TYPE_SIZE); \ + (r) += X##_f[2]; \ + (r) = ((rsize) <= _FP_W_TYPE_SIZE \ + ? 0 \ + : (r) << _FP_W_TYPE_SIZE); \ + (r) += X##_f[1]; \ + (r) = ((rsize) <= _FP_W_TYPE_SIZE \ + ? 0 \ + : (r) << _FP_W_TYPE_SIZE); \ + (r) += X##_f[0]; \ } \ } \ while (0) @@ -824,14 +834,20 @@ /* Move an integer of size rsize into X's fractional part. We rely on the _f[] array consisting of words of size _FP_W_TYPE_SIZE to avoid having to mask the values we store into it. */ -#define _FP_FRAC_DISASSEMBLE_4(X, r, rsize) \ - do \ - { \ - X##_f[0] = r; \ - X##_f[1] = (rsize <= _FP_W_TYPE_SIZE ? 0 : r >> _FP_W_TYPE_SIZE); \ - X##_f[2] = (rsize <= 2*_FP_W_TYPE_SIZE ? 0 : r >> 2*_FP_W_TYPE_SIZE); \ - X##_f[3] = (rsize <= 3*_FP_W_TYPE_SIZE ? 0 : r >> 3*_FP_W_TYPE_SIZE); \ - } \ +#define _FP_FRAC_DISASSEMBLE_4(X, r, rsize) \ + do \ + { \ + X##_f[0] = (r); \ + X##_f[1] = ((rsize) <= _FP_W_TYPE_SIZE \ + ? 0 \ + : (r) >> _FP_W_TYPE_SIZE); \ + X##_f[2] = ((rsize) <= 2*_FP_W_TYPE_SIZE \ + ? 0 \ + : (r) >> 2*_FP_W_TYPE_SIZE); \ + X##_f[3] = ((rsize) <= 3*_FP_W_TYPE_SIZE \ + ? 0 \ + : (r) >> 3*_FP_W_TYPE_SIZE); \ + } \ while (0) #define _FP_FRAC_COPY_4_1(D, S) \ diff --git a/soft-fp/op-common.h b/soft-fp/op-common.h index 3591c47efb..73fbe7af25 100644 --- a/soft-fp/op-common.h +++ b/soft-fp/op-common.h @@ -1259,8 +1259,8 @@ if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (X)) \ || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (Y))) \ { \ - ret = un; \ - _FP_CMP_CHECK_NAN (fs, wc, X, Y, ex); \ + (ret) = (un); \ + _FP_CMP_CHECK_NAN (fs, wc, X, Y, (ex)); \ } \ else \ { \ @@ -1276,23 +1276,23 @@ = (!Y##_e && _FP_FRAC_ZEROP_##wc (Y)) ? 1 : 0; \ \ if (_FP_CMP_is_zero_x && _FP_CMP_is_zero_y) \ - ret = 0; \ + (ret) = 0; \ else if (_FP_CMP_is_zero_x) \ - ret = Y##_s ? 1 : -1; \ + (ret) = Y##_s ? 1 : -1; \ else if (_FP_CMP_is_zero_y) \ - ret = X##_s ? -1 : 1; \ + (ret) = X##_s ? -1 : 1; \ else if (X##_s != Y##_s) \ - ret = X##_s ? -1 : 1; \ + (ret) = X##_s ? -1 : 1; \ else if (X##_e > Y##_e) \ - ret = X##_s ? -1 : 1; \ + (ret) = X##_s ? -1 : 1; \ else if (X##_e < Y##_e) \ - ret = X##_s ? 1 : -1; \ + (ret) = X##_s ? 1 : -1; \ else if (_FP_FRAC_GT_##wc (X, Y)) \ - ret = X##_s ? -1 : 1; \ + (ret) = X##_s ? -1 : 1; \ else if (_FP_FRAC_GT_##wc (Y, X)) \ - ret = X##_s ? 1 : -1; \ + (ret) = X##_s ? 1 : -1; \ else \ - ret = 0; \ + (ret) = 0; \ } \ } \ while (0) @@ -1307,17 +1307,18 @@ if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (X)) \ || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (Y))) \ { \ - ret = 1; \ - _FP_CMP_CHECK_NAN (fs, wc, X, Y, ex); \ + (ret) = 1; \ + _FP_CMP_CHECK_NAN (fs, wc, X, Y, (ex)); \ } \ else \ { \ _FP_CHECK_FLUSH_ZERO (fs, wc, X); \ _FP_CHECK_FLUSH_ZERO (fs, wc, Y); \ \ - ret = !(X##_e == Y##_e \ - && _FP_FRAC_EQ_##wc (X, Y) \ - && (X##_s == Y##_s || (!X##_e && _FP_FRAC_ZEROP_##wc (X)))); \ + (ret) = !(X##_e == Y##_e \ + && _FP_FRAC_EQ_##wc (X, Y) \ + && (X##_s == Y##_s \ + || (!X##_e && _FP_FRAC_ZEROP_##wc (X)))); \ } \ } \ while (0) @@ -1327,10 +1328,10 @@ #define _FP_CMP_UNORD(fs, wc, ret, X, Y, ex) \ do \ { \ - ret = ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (X)) \ - || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (Y))); \ + (ret) = ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (X)) \ + || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (Y))); \ if (ret) \ - _FP_CMP_CHECK_NAN (fs, wc, X, Y, ex); \ + _FP_CMP_CHECK_NAN (fs, wc, X, Y, (ex)); \ } \ while (0) @@ -1409,7 +1410,7 @@ { \ if (X##_e < _FP_EXPBIAS_##fs) \ { \ - r = 0; \ + (r) = 0; \ if (X##_e == 0) \ { \ if (!_FP_FRAC_ZEROP_##wc (X)) \ @@ -1422,15 +1423,15 @@ else \ FP_SET_EXCEPTION (FP_EX_INEXACT); \ } \ - else if (rsigned == 2 \ + else if ((rsigned) == 2 \ && (X##_e \ >= ((_FP_EXPMAX_##fs \ - < _FP_EXPBIAS_##fs + _FP_FRACBITS_##fs + rsize - 1) \ + < _FP_EXPBIAS_##fs + _FP_FRACBITS_##fs + (rsize) - 1) \ ? _FP_EXPMAX_##fs \ - : _FP_EXPBIAS_##fs + _FP_FRACBITS_##fs + rsize - 1))) \ + : _FP_EXPBIAS_##fs + _FP_FRACBITS_##fs + (rsize) - 1))) \ { \ /* Overflow resulting in 0. */ \ - r = 0; \ + (r) = 0; \ FP_SET_EXCEPTION (FP_EX_INVALID \ | FP_EX_INVALID_CVI \ | ((FP_EX_INVALID_SNAN \ @@ -1438,39 +1439,39 @@ ? FP_EX_INVALID_SNAN \ : 0)); \ } \ - else if (rsigned != 2 \ - && (X##_e >= (_FP_EXPMAX_##fs < _FP_EXPBIAS_##fs + rsize \ + else if ((rsigned) != 2 \ + && (X##_e >= (_FP_EXPMAX_##fs < _FP_EXPBIAS_##fs + (rsize) \ ? _FP_EXPMAX_##fs \ - : (_FP_EXPBIAS_##fs + rsize \ - - (rsigned > 0 || X##_s))) \ - || (!rsigned && X##_s))) \ + : (_FP_EXPBIAS_##fs + (rsize) \ + - ((rsigned) > 0 || X##_s))) \ + || (!(rsigned) && X##_s))) \ { \ /* Overflow or converting to the most negative integer. */ \ if (rsigned) \ { \ - r = 1; \ - r <<= rsize - 1; \ - r -= 1 - X##_s; \ + (r) = 1; \ + (r) <<= (rsize) - 1; \ + (r) -= 1 - X##_s; \ } \ else \ { \ - r = 0; \ + (r) = 0; \ if (!X##_s) \ - r = ~r; \ + (r) = ~(r); \ } \ \ - if (_FP_EXPBIAS_##fs + rsize - 1 < _FP_EXPMAX_##fs \ - && rsigned \ + if (_FP_EXPBIAS_##fs + (rsize) - 1 < _FP_EXPMAX_##fs \ + && (rsigned) \ && X##_s \ - && X##_e == _FP_EXPBIAS_##fs + rsize - 1) \ + && X##_e == _FP_EXPBIAS_##fs + (rsize) - 1) \ { \ /* Possibly converting to most negative integer; check the \ mantissa. */ \ int _FP_TO_INT_inexact = 0; \ - (void) ((_FP_FRACBITS_##fs > rsize) \ + (void) ((_FP_FRACBITS_##fs > (rsize)) \ ? ({ \ _FP_FRAC_SRST_##wc (X, _FP_TO_INT_inexact, \ - _FP_FRACBITS_##fs - rsize, \ + _FP_FRACBITS_##fs - (rsize), \ _FP_FRACBITS_##fs); \ 0; \ }) \ @@ -1494,8 +1495,8 @@ _FP_FRAC_HIGH_RAW_##fs (X) |= _FP_IMPLBIT_##fs; \ if (X##_e >= _FP_EXPBIAS_##fs + _FP_FRACBITS_##fs - 1) \ { \ - _FP_FRAC_ASSEMBLE_##wc (r, X, rsize); \ - r <<= X##_e - _FP_EXPBIAS_##fs - _FP_FRACBITS_##fs + 1; \ + _FP_FRAC_ASSEMBLE_##wc ((r), X, (rsize)); \ + (r) <<= X##_e - _FP_EXPBIAS_##fs - _FP_FRACBITS_##fs + 1; \ } \ else \ { \ @@ -1503,16 +1504,16 @@ (_FP_FRACBITS_##fs + _FP_EXPBIAS_##fs - 1 \ - X##_e), \ _FP_FRACBITS_##fs); \ - _FP_FRAC_ASSEMBLE_##wc (r, X, rsize); \ + _FP_FRAC_ASSEMBLE_##wc ((r), X, (rsize)); \ } \ - if (rsigned && X##_s) \ - r = -r; \ - if (rsigned == 2 && X##_e >= _FP_EXPBIAS_##fs + rsize - 1) \ + if ((rsigned) && X##_s) \ + (r) = -(r); \ + if ((rsigned) == 2 && X##_e >= _FP_EXPBIAS_##fs + (rsize) - 1) \ { \ /* Overflow or converting to the most negative integer. */ \ - if (X##_e > _FP_EXPBIAS_##fs + rsize - 1 \ + if (X##_e > _FP_EXPBIAS_##fs + (rsize) - 1 \ || !X##_s \ - || r != (((typeof (r)) 1) << (rsize - 1))) \ + || (r) != (((typeof (r)) 1) << ((rsize) - 1))) \ { \ _FP_TO_INT_inexact = 0; \ FP_SET_EXCEPTION (FP_EX_INVALID | FP_EX_INVALID_CVI); \ @@ -1533,11 +1534,11 @@ { \ rtype _FP_FROM_INT_ur; \ \ - if ((X##_s = (r < 0))) \ - r = -(rtype) r; \ + if ((X##_s = ((r) < 0))) \ + (r) = -(rtype) (r); \ \ - _FP_FROM_INT_ur = (rtype) r; \ - (void) ((rsize <= _FP_W_TYPE_SIZE) \ + _FP_FROM_INT_ur = (rtype) (r); \ + (void) (((rsize) <= _FP_W_TYPE_SIZE) \ ? ({ \ int _FP_FROM_INT_lz; \ __FP_CLZ (_FP_FROM_INT_lz, \ @@ -1545,7 +1546,7 @@ X##_e = (_FP_EXPBIAS_##fs + _FP_W_TYPE_SIZE - 1 \ - _FP_FROM_INT_lz); \ }) \ - : ((rsize <= 2 * _FP_W_TYPE_SIZE) \ + : (((rsize) <= 2 * _FP_W_TYPE_SIZE) \ ? ({ \ int _FP_FROM_INT_lz; \ __FP_CLZ_2 (_FP_FROM_INT_lz, \ @@ -1557,7 +1558,7 @@ }) \ : (abort (), 0))); \ \ - if (rsize - 1 + _FP_EXPBIAS_##fs >= _FP_EXPMAX_##fs \ + if ((rsize) - 1 + _FP_EXPBIAS_##fs >= _FP_EXPMAX_##fs \ && X##_e >= _FP_EXPMAX_##fs) \ { \ /* Exponent too big; overflow to infinity. (May also \ @@ -1566,11 +1567,11 @@ goto pack_semiraw; \ } \ \ - if (rsize <= _FP_FRACBITS_##fs \ + if ((rsize) <= _FP_FRACBITS_##fs \ || X##_e < _FP_EXPBIAS_##fs + _FP_FRACBITS_##fs) \ { \ /* Exactly representable; shift left. */ \ - _FP_FRAC_DISASSEMBLE_##wc (X, _FP_FROM_INT_ur, rsize); \ + _FP_FRAC_DISASSEMBLE_##wc (X, _FP_FROM_INT_ur, (rsize)); \ if (_FP_EXPBIAS_##fs + _FP_FRACBITS_##fs - 1 - X##_e > 0) \ _FP_FRAC_SLL_##wc (X, (_FP_EXPBIAS_##fs \ + _FP_FRACBITS_##fs - 1 - X##_e)); \ @@ -1584,10 +1585,10 @@ = ((_FP_FROM_INT_ur >> (X##_e - _FP_EXPBIAS_##fs \ - _FP_WFRACBITS_##fs + 1)) \ | ((_FP_FROM_INT_ur \ - << (rsize - (X##_e - _FP_EXPBIAS_##fs \ - - _FP_WFRACBITS_##fs + 1))) \ + << ((rsize) - (X##_e - _FP_EXPBIAS_##fs \ + - _FP_WFRACBITS_##fs + 1))) \ != 0)); \ - _FP_FRAC_DISASSEMBLE_##wc (X, _FP_FROM_INT_ur, rsize); \ + _FP_FRAC_DISASSEMBLE_##wc (X, _FP_FROM_INT_ur, (rsize)); \ if ((_FP_EXPBIAS_##fs + _FP_WFRACBITS_##fs - 1 - X##_e) > 0) \ _FP_FRAC_SLL_##wc (X, (_FP_EXPBIAS_##fs \ + _FP_WFRACBITS_##fs - 1 - X##_e)); \ @@ -1768,11 +1769,11 @@ do \ { \ if (sizeof (_FP_W_TYPE) == sizeof (unsigned int)) \ - r = __builtin_clz (x); \ + (r) = __builtin_clz (x); \ else if (sizeof (_FP_W_TYPE) == sizeof (unsigned long)) \ - r = __builtin_clzl (x); \ + (r) = __builtin_clzl (x); \ else if (sizeof (_FP_W_TYPE) == sizeof (unsigned long long)) \ - r = __builtin_clzll (x); \ + (r) = __builtin_clzll (x); \ else \ abort (); \ } \ @@ -1782,7 +1783,7 @@ #define _FP_DIV_HELP_imm(q, r, n, d) \ do \ { \ - q = n / d, r = n % d; \ + (q) = (n) / (d), (r) = (n) % (d); \ } \ while (0) diff --git a/soft-fp/quad.h b/soft-fp/quad.h index c2e4133722..b8cd3108a3 100644 --- a/soft-fp/quad.h +++ b/soft-fp/quad.h @@ -95,21 +95,21 @@ union _FP_UNION_Q # define FP_DECL_Q(X) _FP_DECL (4, X) -# define FP_UNPACK_RAW_Q(X, val) _FP_UNPACK_RAW_4 (Q, X, val) -# define FP_UNPACK_RAW_QP(X, val) _FP_UNPACK_RAW_4_P (Q, X, val) -# define FP_PACK_RAW_Q(val, X) _FP_PACK_RAW_4 (Q, val, X) +# define FP_UNPACK_RAW_Q(X, val) _FP_UNPACK_RAW_4 (Q, X, (val)) +# define FP_UNPACK_RAW_QP(X, val) _FP_UNPACK_RAW_4_P (Q, X, (val)) +# define FP_PACK_RAW_Q(val, X) _FP_PACK_RAW_4 (Q, (val), X) # define FP_PACK_RAW_QP(val, X) \ do \ { \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_4_P (Q, val, X); \ + _FP_PACK_RAW_4_P (Q, (val), X); \ } \ while (0) # define FP_UNPACK_Q(X, val) \ do \ { \ - _FP_UNPACK_RAW_4 (Q, X, val); \ + _FP_UNPACK_RAW_4 (Q, X, (val)); \ _FP_UNPACK_CANONICAL (Q, 4, X); \ } \ while (0) @@ -117,7 +117,7 @@ union _FP_UNION_Q # define FP_UNPACK_QP(X, val) \ do \ { \ - _FP_UNPACK_RAW_4_P (Q, X, val); \ + _FP_UNPACK_RAW_4_P (Q, X, (val)); \ _FP_UNPACK_CANONICAL (Q, 4, X); \ } \ while (0) @@ -125,7 +125,7 @@ union _FP_UNION_Q # define FP_UNPACK_SEMIRAW_Q(X, val) \ do \ { \ - _FP_UNPACK_RAW_4 (Q, X, val); \ + _FP_UNPACK_RAW_4 (Q, X, (val)); \ _FP_UNPACK_SEMIRAW (Q, 4, X); \ } \ while (0) @@ -133,7 +133,7 @@ union _FP_UNION_Q # define FP_UNPACK_SEMIRAW_QP(X, val) \ do \ { \ - _FP_UNPACK_RAW_4_P (Q, X, val); \ + _FP_UNPACK_RAW_4_P (Q, X, (val)); \ _FP_UNPACK_SEMIRAW (Q, 4, X); \ } \ while (0) @@ -142,7 +142,7 @@ union _FP_UNION_Q do \ { \ _FP_PACK_CANONICAL (Q, 4, X); \ - _FP_PACK_RAW_4 (Q, val, X); \ + _FP_PACK_RAW_4 (Q, (val), X); \ } \ while (0) @@ -151,7 +151,7 @@ union _FP_UNION_Q { \ _FP_PACK_CANONICAL (Q, 4, X); \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_4_P (Q, val, X); \ + _FP_PACK_RAW_4_P (Q, (val), X); \ } \ while (0) @@ -159,7 +159,7 @@ union _FP_UNION_Q do \ { \ _FP_PACK_SEMIRAW (Q, 4, X); \ - _FP_PACK_RAW_4 (Q, val, X); \ + _FP_PACK_RAW_4 (Q, (val), X); \ } \ while (0) @@ -168,7 +168,7 @@ union _FP_UNION_Q { \ _FP_PACK_SEMIRAW (Q, 4, X); \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_4_P (Q, val, X); \ + _FP_PACK_RAW_4_P (Q, (val), X); \ } \ while (0) @@ -179,15 +179,15 @@ union _FP_UNION_Q # define FP_MUL_Q(R, X, Y) _FP_MUL (Q, 4, R, X, Y) # define FP_DIV_Q(R, X, Y) _FP_DIV (Q, 4, R, X, Y) # define FP_SQRT_Q(R, X) _FP_SQRT (Q, 4, R, X) -# define _FP_SQRT_MEAT_Q(R, S, T, X, Q) _FP_SQRT_MEAT_4 (R, S, T, X, Q) +# define _FP_SQRT_MEAT_Q(R, S, T, X, Q) _FP_SQRT_MEAT_4 (R, S, T, X, (Q)) # define FP_FMA_Q(R, X, Y, Z) _FP_FMA (Q, 4, 8, R, X, Y, Z) -# define FP_CMP_Q(r, X, Y, un, ex) _FP_CMP (Q, 4, r, X, Y, un, ex) -# define FP_CMP_EQ_Q(r, X, Y, ex) _FP_CMP_EQ (Q, 4, r, X, Y, ex) -# define FP_CMP_UNORD_Q(r, X, Y, ex) _FP_CMP_UNORD (Q, 4, r, X, Y, ex) +# define FP_CMP_Q(r, X, Y, un, ex) _FP_CMP (Q, 4, (r), X, Y, (un), (ex)) +# define FP_CMP_EQ_Q(r, X, Y, ex) _FP_CMP_EQ (Q, 4, (r), X, Y, (ex)) +# define FP_CMP_UNORD_Q(r, X, Y, ex) _FP_CMP_UNORD (Q, 4, (r), X, Y, (ex)) -# define FP_TO_INT_Q(r, X, rsz, rsg) _FP_TO_INT (Q, 4, r, X, rsz, rsg) -# define FP_FROM_INT_Q(X, r, rs, rt) _FP_FROM_INT (Q, 4, X, r, rs, rt) +# define FP_TO_INT_Q(r, X, rsz, rsg) _FP_TO_INT (Q, 4, (r), X, (rsz), (rsg)) +# define FP_FROM_INT_Q(X, r, rs, rt) _FP_FROM_INT (Q, 4, X, (r), (rs), rt) # define _FP_FRAC_HIGH_Q(X) _FP_FRAC_HIGH_4 (X) # define _FP_FRAC_HIGH_RAW_Q(X) _FP_FRAC_HIGH_4 (X) @@ -219,21 +219,21 @@ union _FP_UNION_Q }; # define FP_DECL_Q(X) _FP_DECL (2, X) -# define FP_UNPACK_RAW_Q(X, val) _FP_UNPACK_RAW_2 (Q, X, val) -# define FP_UNPACK_RAW_QP(X, val) _FP_UNPACK_RAW_2_P (Q, X, val) -# define FP_PACK_RAW_Q(val, X) _FP_PACK_RAW_2 (Q, val, X) +# define FP_UNPACK_RAW_Q(X, val) _FP_UNPACK_RAW_2 (Q, X, (val)) +# define FP_UNPACK_RAW_QP(X, val) _FP_UNPACK_RAW_2_P (Q, X, (val)) +# define FP_PACK_RAW_Q(val, X) _FP_PACK_RAW_2 (Q, (val), X) # define FP_PACK_RAW_QP(val, X) \ do \ { \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_2_P (Q, val, X); \ + _FP_PACK_RAW_2_P (Q, (val), X); \ } \ while (0) # define FP_UNPACK_Q(X, val) \ do \ { \ - _FP_UNPACK_RAW_2 (Q, X, val); \ + _FP_UNPACK_RAW_2 (Q, X, (val)); \ _FP_UNPACK_CANONICAL (Q, 2, X); \ } \ while (0) @@ -241,7 +241,7 @@ union _FP_UNION_Q # define FP_UNPACK_QP(X, val) \ do \ { \ - _FP_UNPACK_RAW_2_P (Q, X, val); \ + _FP_UNPACK_RAW_2_P (Q, X, (val)); \ _FP_UNPACK_CANONICAL (Q, 2, X); \ } \ while (0) @@ -249,7 +249,7 @@ union _FP_UNION_Q # define FP_UNPACK_SEMIRAW_Q(X, val) \ do \ { \ - _FP_UNPACK_RAW_2 (Q, X, val); \ + _FP_UNPACK_RAW_2 (Q, X, (val)); \ _FP_UNPACK_SEMIRAW (Q, 2, X); \ } \ while (0) @@ -257,7 +257,7 @@ union _FP_UNION_Q # define FP_UNPACK_SEMIRAW_QP(X, val) \ do \ { \ - _FP_UNPACK_RAW_2_P (Q, X, val); \ + _FP_UNPACK_RAW_2_P (Q, X, (val)); \ _FP_UNPACK_SEMIRAW (Q, 2, X); \ } \ while (0) @@ -266,7 +266,7 @@ union _FP_UNION_Q do \ { \ _FP_PACK_CANONICAL (Q, 2, X); \ - _FP_PACK_RAW_2 (Q, val, X); \ + _FP_PACK_RAW_2 (Q, (val), X); \ } \ while (0) @@ -275,7 +275,7 @@ union _FP_UNION_Q { \ _FP_PACK_CANONICAL (Q, 2, X); \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_2_P (Q, val, X); \ + _FP_PACK_RAW_2_P (Q, (val), X); \ } \ while (0) @@ -283,7 +283,7 @@ union _FP_UNION_Q do \ { \ _FP_PACK_SEMIRAW (Q, 2, X); \ - _FP_PACK_RAW_2 (Q, val, X); \ + _FP_PACK_RAW_2 (Q, (val), X); \ } \ while (0) @@ -292,7 +292,7 @@ union _FP_UNION_Q { \ _FP_PACK_SEMIRAW (Q, 2, X); \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_2_P (Q, val, X); \ + _FP_PACK_RAW_2_P (Q, (val), X); \ } \ while (0) @@ -303,15 +303,15 @@ union _FP_UNION_Q # define FP_MUL_Q(R, X, Y) _FP_MUL (Q, 2, R, X, Y) # define FP_DIV_Q(R, X, Y) _FP_DIV (Q, 2, R, X, Y) # define FP_SQRT_Q(R, X) _FP_SQRT (Q, 2, R, X) -# define _FP_SQRT_MEAT_Q(R, S, T, X, Q) _FP_SQRT_MEAT_2 (R, S, T, X, Q) +# define _FP_SQRT_MEAT_Q(R, S, T, X, Q) _FP_SQRT_MEAT_2 (R, S, T, X, (Q)) # define FP_FMA_Q(R, X, Y, Z) _FP_FMA (Q, 2, 4, R, X, Y, Z) -# define FP_CMP_Q(r, X, Y, un, ex) _FP_CMP (Q, 2, r, X, Y, un, ex) -# define FP_CMP_EQ_Q(r, X, Y, ex) _FP_CMP_EQ (Q, 2, r, X, Y, ex) -# define FP_CMP_UNORD_Q(r, X, Y, ex) _FP_CMP_UNORD (Q, 2, r, X, Y, ex) +# define FP_CMP_Q(r, X, Y, un, ex) _FP_CMP (Q, 2, (r), X, Y, (un), (ex)) +# define FP_CMP_EQ_Q(r, X, Y, ex) _FP_CMP_EQ (Q, 2, (r), X, Y, (ex)) +# define FP_CMP_UNORD_Q(r, X, Y, ex) _FP_CMP_UNORD (Q, 2, (r), X, Y, (ex)) -# define FP_TO_INT_Q(r, X, rsz, rsg) _FP_TO_INT (Q, 2, r, X, rsz, rsg) -# define FP_FROM_INT_Q(X, r, rs, rt) _FP_FROM_INT (Q, 2, X, r, rs, rt) +# define FP_TO_INT_Q(r, X, rsz, rsg) _FP_TO_INT (Q, 2, (r), X, (rsz), (rsg)) +# define FP_FROM_INT_Q(X, r, rs, rt) _FP_FROM_INT (Q, 2, X, (r), (rs), rt) # define _FP_FRAC_HIGH_Q(X) _FP_FRAC_HIGH_2 (X) # define _FP_FRAC_HIGH_RAW_Q(X) _FP_FRAC_HIGH_2 (X) diff --git a/soft-fp/single.h b/soft-fp/single.h index efa8294662..086a558b9e 100644 --- a/soft-fp/single.h +++ b/soft-fp/single.h @@ -83,21 +83,21 @@ union _FP_UNION_S }; #define FP_DECL_S(X) _FP_DECL (1, X) -#define FP_UNPACK_RAW_S(X, val) _FP_UNPACK_RAW_1 (S, X, val) -#define FP_UNPACK_RAW_SP(X, val) _FP_UNPACK_RAW_1_P (S, X, val) -#define FP_PACK_RAW_S(val, X) _FP_PACK_RAW_1 (S, val, X) +#define FP_UNPACK_RAW_S(X, val) _FP_UNPACK_RAW_1 (S, X, (val)) +#define FP_UNPACK_RAW_SP(X, val) _FP_UNPACK_RAW_1_P (S, X, (val)) +#define FP_PACK_RAW_S(val, X) _FP_PACK_RAW_1 (S, (val), X) #define FP_PACK_RAW_SP(val, X) \ do \ { \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_1_P (S, val, X); \ + _FP_PACK_RAW_1_P (S, (val), X); \ } \ while (0) #define FP_UNPACK_S(X, val) \ do \ { \ - _FP_UNPACK_RAW_1 (S, X, val); \ + _FP_UNPACK_RAW_1 (S, X, (val)); \ _FP_UNPACK_CANONICAL (S, 1, X); \ } \ while (0) @@ -105,7 +105,7 @@ union _FP_UNION_S #define FP_UNPACK_SP(X, val) \ do \ { \ - _FP_UNPACK_RAW_1_P (S, X, val); \ + _FP_UNPACK_RAW_1_P (S, X, (val)); \ _FP_UNPACK_CANONICAL (S, 1, X); \ } \ while (0) @@ -113,7 +113,7 @@ union _FP_UNION_S #define FP_UNPACK_SEMIRAW_S(X, val) \ do \ { \ - _FP_UNPACK_RAW_1 (S, X, val); \ + _FP_UNPACK_RAW_1 (S, X, (val)); \ _FP_UNPACK_SEMIRAW (S, 1, X); \ } \ while (0) @@ -121,7 +121,7 @@ union _FP_UNION_S #define FP_UNPACK_SEMIRAW_SP(X, val) \ do \ { \ - _FP_UNPACK_RAW_1_P (S, X, val); \ + _FP_UNPACK_RAW_1_P (S, X, (val)); \ _FP_UNPACK_SEMIRAW (S, 1, X); \ } \ while (0) @@ -130,7 +130,7 @@ union _FP_UNION_S do \ { \ _FP_PACK_CANONICAL (S, 1, X); \ - _FP_PACK_RAW_1 (S, val, X); \ + _FP_PACK_RAW_1 (S, (val), X); \ } \ while (0) @@ -139,7 +139,7 @@ union _FP_UNION_S { \ _FP_PACK_CANONICAL (S, 1, X); \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_1_P (S, val, X); \ + _FP_PACK_RAW_1_P (S, (val), X); \ } \ while (0) @@ -147,7 +147,7 @@ union _FP_UNION_S do \ { \ _FP_PACK_SEMIRAW (S, 1, X); \ - _FP_PACK_RAW_1 (S, val, X); \ + _FP_PACK_RAW_1 (S, (val), X); \ } \ while (0) @@ -156,7 +156,7 @@ union _FP_UNION_S { \ _FP_PACK_SEMIRAW (S, 1, X); \ if (!FP_INHIBIT_RESULTS) \ - _FP_PACK_RAW_1_P (S, val, X); \ + _FP_PACK_RAW_1_P (S, (val), X); \ } \ while (0) @@ -167,7 +167,7 @@ union _FP_UNION_S #define FP_MUL_S(R, X, Y) _FP_MUL (S, 1, R, X, Y) #define FP_DIV_S(R, X, Y) _FP_DIV (S, 1, R, X, Y) #define FP_SQRT_S(R, X) _FP_SQRT (S, 1, R, X) -#define _FP_SQRT_MEAT_S(R, S, T, X, Q) _FP_SQRT_MEAT_1 (R, S, T, X, Q) +#define _FP_SQRT_MEAT_S(R, S, T, X, Q) _FP_SQRT_MEAT_1 (R, S, T, X, (Q)) #if _FP_W_TYPE_SIZE < 64 # define FP_FMA_S(R, X, Y, Z) _FP_FMA (S, 1, 2, R, X, Y, Z) @@ -175,12 +175,12 @@ union _FP_UNION_S # define FP_FMA_S(R, X, Y, Z) _FP_FMA (S, 1, 1, R, X, Y, Z) #endif -#define FP_CMP_S(r, X, Y, un, ex) _FP_CMP (S, 1, r, X, Y, un, ex) -#define FP_CMP_EQ_S(r, X, Y, ex) _FP_CMP_EQ (S, 1, r, X, Y, ex) -#define FP_CMP_UNORD_S(r, X, Y, ex) _FP_CMP_UNORD (S, 1, r, X, Y, ex) +#define FP_CMP_S(r, X, Y, un, ex) _FP_CMP (S, 1, (r), X, Y, (un), (ex)) +#define FP_CMP_EQ_S(r, X, Y, ex) _FP_CMP_EQ (S, 1, (r), X, Y, (ex)) +#define FP_CMP_UNORD_S(r, X, Y, ex) _FP_CMP_UNORD (S, 1, (r), X, Y, (ex)) -#define FP_TO_INT_S(r, X, rsz, rsg) _FP_TO_INT (S, 1, r, X, rsz, rsg) -#define FP_FROM_INT_S(X, r, rs, rt) _FP_FROM_INT (S, 1, X, r, rs, rt) +#define FP_TO_INT_S(r, X, rsz, rsg) _FP_TO_INT (S, 1, (r), X, (rsz), (rsg)) +#define FP_FROM_INT_S(X, r, rs, rt) _FP_FROM_INT (S, 1, X, (r), (rs), rt) #define _FP_FRAC_HIGH_S(X) _FP_FRAC_HIGH_1 (X) #define _FP_FRAC_HIGH_RAW_S(X) _FP_FRAC_HIGH_1 (X) -- cgit 1.4.1