From: Dominik Vogt Date: Mon, 6 Feb 2017 11:42:07 +0000 (+0000) Subject: S/390: Use macros from hwint.h where possible. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=406fde6e17b0a4b4f9d0c602e6a827d0592db420;p=gcc.git S/390: Use macros from hwint.h where possible. gcc/ChangeLog: 2017-02-06 Dominik Vogt * config/s390/predicates.md ("larl_operand"): Use macros from hwint.h. * config/s390/s390.c (s390_const_operand_ok) (s390_canonicalize_comparison, s390_extract_part) (s390_single_part, s390_contiguous_bitmask_nowrap_p) (s390_contiguous_bitmask_p, s390_rtx_costs) (legitimize_pic_address): Likewise. * config/s390/s390.md ("clzdi2", "clztidi2"): Likewise. * config/s390/vx-builtins.md ("vec_genbytemaskv16qi") ("vec_permi", "vfae", "*vfaes", "vstrc") ("*vstrcs"): Use UINTVAL() to set unsigned HOST_WIDE_INT. * config/s390/vector.md ("vec_vfenes"): Likewise. From-SVN: r245207 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9b9657df517..17f415a5ff3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2017-02-06 Dominik Vogt + + * config/s390/predicates.md ("larl_operand"): Use macros from hwint.h. + * config/s390/s390.c (s390_const_operand_ok) + (s390_canonicalize_comparison, s390_extract_part) + (s390_single_part, s390_contiguous_bitmask_nowrap_p) + (s390_contiguous_bitmask_p, s390_rtx_costs) + (legitimize_pic_address): Likewise. + * config/s390/s390.md ("clzdi2", "clztidi2"): Likewise. + * config/s390/vx-builtins.md ("vec_genbytemaskv16qi") + ("vec_permi", "vfae", "*vfaes", "vstrc") + ("*vstrcs"): Use UINTVAL() to set unsigned HOST_WIDE_INT. + * config/s390/vector.md ("vec_vfenes"): Likewise. + 2017-02-06 Georg-Johann Lay * config/avr/avr.md (*addhi3_zero_extend): Add alternative where diff --git a/gcc/config/s390/predicates.md b/gcc/config/s390/predicates.md index a233aaf9f83..0c82efc01cd 100644 --- a/gcc/config/s390/predicates.md +++ b/gcc/config/s390/predicates.md @@ -147,8 +147,8 @@ if (GET_CODE (XEXP (op, 1)) != CONST_INT || (INTVAL (XEXP (op, 1)) & 1) != 0) return false; - if (INTVAL (XEXP (op, 1)) >= (HOST_WIDE_INT)1 << 31 - || INTVAL (XEXP (op, 1)) < -((HOST_WIDE_INT)1 << 31)) + if (INTVAL (XEXP (op, 1)) >= HOST_WIDE_INT_1 << 31 + || INTVAL (XEXP (op, 1)) < -(HOST_WIDE_INT_1 << 31)) return false; op = XEXP (op, 0); } diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index b7b93accae8..9c4e641e5ad 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -750,12 +750,12 @@ s390_const_operand_ok (tree arg, int argnum, int op_flags, tree decl) int bitwidth = bitwidths[op_flags - O_U1]; if (!tree_fits_uhwi_p (arg) - || tree_to_uhwi (arg) > ((unsigned HOST_WIDE_INT)1 << bitwidth) - 1) + || tree_to_uhwi (arg) > (HOST_WIDE_INT_1U << bitwidth) - 1) { error("constant argument %d for builtin %qF is out of range (0.." HOST_WIDE_INT_PRINT_UNSIGNED ")", argnum, decl, - ((unsigned HOST_WIDE_INT)1 << bitwidth) - 1); + (HOST_WIDE_INT_1U << bitwidth) - 1); return false; } } @@ -766,15 +766,15 @@ s390_const_operand_ok (tree arg, int argnum, int op_flags, tree decl) int bitwidth = bitwidths[op_flags - O_S2]; if (!tree_fits_shwi_p (arg) - || tree_to_shwi (arg) < -((HOST_WIDE_INT)1 << (bitwidth - 1)) - || tree_to_shwi (arg) > (((HOST_WIDE_INT)1 << (bitwidth - 1)) - 1)) + || tree_to_shwi (arg) < -(HOST_WIDE_INT_1 << (bitwidth - 1)) + || tree_to_shwi (arg) > ((HOST_WIDE_INT_1 << (bitwidth - 1)) - 1)) { error("constant argument %d for builtin %qF is out of range (" HOST_WIDE_INT_PRINT_DEC ".." HOST_WIDE_INT_PRINT_DEC ")", argnum, decl, - -((HOST_WIDE_INT)1 << (bitwidth - 1)), - ((HOST_WIDE_INT)1 << (bitwidth - 1)) - 1); + -(HOST_WIDE_INT_1 << (bitwidth - 1)), + (HOST_WIDE_INT_1 << (bitwidth - 1)) - 1); return false; } } @@ -1561,7 +1561,7 @@ s390_canonicalize_comparison (int *code, rtx *op0, rtx *op1, && modesize <= HOST_BITS_PER_WIDE_INT) { unsigned HOST_WIDE_INT block; - block = ((unsigned HOST_WIDE_INT) 1 << len) - 1; + block = (HOST_WIDE_INT_1U << len) - 1; block <<= modesize - pos - len; *op0 = gen_rtx_AND (GET_MODE (inner), inner, @@ -1610,7 +1610,7 @@ s390_canonicalize_comparison (int *code, rtx *op0, rtx *op1, && INTVAL (*op1) == 0xffff && SCALAR_INT_MODE_P (GET_MODE (*op0)) && (nonzero_bits (*op0, GET_MODE (*op0)) - & ~(unsigned HOST_WIDE_INT) 0xffff) == 0) + & ~HOST_WIDE_INT_UC (0xffff)) == 0) { *op0 = gen_lowpart (HImode, *op0); *op1 = constm1_rtx; @@ -2212,14 +2212,13 @@ s390_extract_part (rtx op, machine_mode mode, int def) unsigned HOST_WIDE_INT value = 0; int max_parts = HOST_BITS_PER_WIDE_INT / GET_MODE_BITSIZE (mode); int part_bits = GET_MODE_BITSIZE (mode); - unsigned HOST_WIDE_INT part_mask - = ((unsigned HOST_WIDE_INT)1 << part_bits) - 1; + unsigned HOST_WIDE_INT part_mask = (HOST_WIDE_INT_1U << part_bits) - 1; int i; for (i = 0; i < max_parts; i++) { if (i == 0) - value = (unsigned HOST_WIDE_INT) INTVAL (op); + value = UINTVAL (op); else value >>= part_bits; @@ -2243,7 +2242,7 @@ s390_single_part (rtx op, unsigned HOST_WIDE_INT value = 0; int n_parts = GET_MODE_SIZE (mode) / GET_MODE_SIZE (part_mode); unsigned HOST_WIDE_INT part_mask - = ((unsigned HOST_WIDE_INT)1 << GET_MODE_BITSIZE (part_mode)) - 1; + = (HOST_WIDE_INT_1U << GET_MODE_BITSIZE (part_mode)) - 1; int i, part = -1; if (GET_CODE (op) != CONST_INT) @@ -2252,7 +2251,7 @@ s390_single_part (rtx op, for (i = 0; i < n_parts; i++) { if (i == 0) - value = (unsigned HOST_WIDE_INT) INTVAL (op); + value = UINTVAL (op); else value >>= GET_MODE_BITSIZE (part_mode); @@ -2282,9 +2281,9 @@ s390_contiguous_bitmask_nowrap_p (unsigned HOST_WIDE_INT in, int size, { int start; int end = -1; - int lowbit = sizeof (HOST_WIDE_INT) * BITS_PER_UNIT - 1; - int highbit = sizeof (HOST_WIDE_INT) * BITS_PER_UNIT - size; - unsigned HOST_WIDE_INT bitmask = 1ULL; + int lowbit = HOST_BITS_PER_WIDE_INT - 1; + int highbit = HOST_BITS_PER_WIDE_INT - size; + unsigned HOST_WIDE_INT bitmask = HOST_WIDE_INT_1U; gcc_assert (!!pstart == !!pend); for (start = lowbit; start >= highbit; bitmask <<= 1, start--) @@ -2314,7 +2313,8 @@ s390_contiguous_bitmask_nowrap_p (unsigned HOST_WIDE_INT in, int size, unsigned HOST_WIDE_INT mask; /* Calculate a mask for all bits beyond the contiguous bits. */ - mask = ((~(0ULL) >> highbit) & (~(0ULL) << (lowbit - start + 1))); + mask = ((~HOST_WIDE_INT_0U >> highbit) + & (~HOST_WIDE_INT_0U << (lowbit - start + 1))); if (mask & in) /* There are more bits set beyond the first range of one bits. */ return false; @@ -2343,11 +2343,11 @@ bool s390_contiguous_bitmask_p (unsigned HOST_WIDE_INT in, bool wrap_p, int size, int *start, int *end) { - int bs = sizeof (HOST_WIDE_INT) * BITS_PER_UNIT; + int bs = HOST_BITS_PER_WIDE_INT; bool b; gcc_assert (!!start == !!end); - if ((in & ((~(0ULL)) >> (bs - size))) == 0) + if ((in & ((~HOST_WIDE_INT_0U) >> (bs - size))) == 0) /* This cannot be expressed as a contiguous bitmask. Exit early because the second call of s390_contiguous_bitmask_nowrap_p would accept this as a valid bitmask. */ @@ -2406,10 +2406,8 @@ s390_contiguous_bitmask_vector_p (rtx op, int *start, int *end) { if (start) { - int bs = sizeof (HOST_WIDE_INT) * BITS_PER_UNIT; - - *start -= (bs - size); - *end -= (bs - size); + *start -= (HOST_BITS_PER_WIDE_INT - size); + *end -= (HOST_BITS_PER_WIDE_INT - size); } return true; } @@ -3470,7 +3468,7 @@ s390_rtx_costs (rtx x, machine_mode mode, int outer_code, && CONST_INT_P (XEXP (XEXP (x, 0), 1)) && CONST_INT_P (XEXP (XEXP (x, 1), 1)) && (UINTVAL (XEXP (XEXP (x, 0), 1)) == - (1UL << UINTVAL (XEXP (XEXP (x, 1), 1))) - 1)) + (HOST_WIDE_INT_1U << UINTVAL (XEXP (XEXP (x, 1), 1))) - 1)) { *total = COSTS_N_INSNS (2); return true; @@ -4596,8 +4594,8 @@ legitimize_pic_address (rtx orig, rtx reg) if (TARGET_CPU_ZARCH && larl_operand (const_addr, VOIDmode) - && INTVAL (addend) < (HOST_WIDE_INT)1 << 31 - && INTVAL (addend) >= -((HOST_WIDE_INT)1 << 31)) + && INTVAL (addend) < HOST_WIDE_INT_1 << 31 + && INTVAL (addend) >= -(HOST_WIDE_INT_1 << 31)) { if (INTVAL (addend) & 1) { diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index 9bbd7e0dc30..cbf8c0a1ed6 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -8626,7 +8626,7 @@ rtx_insn *insn; rtx clz_equal; rtx wide_reg = gen_reg_rtx (TImode); - rtx msb = gen_rtx_CONST_INT (DImode, (unsigned HOST_WIDE_INT) 1 << 63); + rtx msb = gen_rtx_CONST_INT (DImode, HOST_WIDE_INT_1U << 63); clz_equal = gen_rtx_CLZ (DImode, operands[1]); @@ -8650,8 +8650,7 @@ (const_int 64)) (zero_extend:TI (clz:DI (match_dup 1))))) (clobber (reg:CC CC_REGNUM))] - "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) - == (unsigned HOST_WIDE_INT) 1 << 63 + "UINTVAL (operands[2]) == HOST_WIDE_INT_1U << 63 && TARGET_EXTIMM && TARGET_ZARCH" "flogr\t%0,%1" [(set_attr "op_type" "RRE")]) diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md index c4bbffce55e..4b5d43bf5d4 100644 --- a/gcc/config/s390/vector.md +++ b/gcc/config/s390/vector.md @@ -1118,7 +1118,7 @@ UNSPEC_VEC_VFENECC))] "TARGET_VX" { - unsigned HOST_WIDE_INT flags = INTVAL (operands[3]); + unsigned HOST_WIDE_INT flags = UINTVAL (operands[3]); gcc_assert (!(flags & ~(VSTRING_FLAG_ZS | VSTRING_FLAG_CS))); flags &= ~VSTRING_FLAG_CS; diff --git a/gcc/config/s390/vx-builtins.md b/gcc/config/s390/vx-builtins.md index 900a8ad3483..1e9010ac909 100644 --- a/gcc/config/s390/vx-builtins.md +++ b/gcc/config/s390/vx-builtins.md @@ -126,7 +126,7 @@ int i; unsigned mask = 0x8000; rtx const_vec[16]; - unsigned HOST_WIDE_INT byte_mask = INTVAL (operands[1]); + unsigned HOST_WIDE_INT byte_mask = UINTVAL (operands[1]); for (i = 0; i < 16; i++) { @@ -1232,7 +1232,7 @@ UNSPEC_VEC_VFAE))] "TARGET_VX" { - unsigned HOST_WIDE_INT flags = INTVAL (operands[3]); + unsigned HOST_WIDE_INT flags = UINTVAL (operands[3]); if (flags & VSTRING_FLAG_ZS) { @@ -1259,7 +1259,7 @@ UNSPEC_VEC_VFAECC))] "TARGET_VX" { - unsigned HOST_WIDE_INT flags = INTVAL (operands[3]); + unsigned HOST_WIDE_INT flags = UINTVAL (operands[3]); if (flags & VSTRING_FLAG_ZS) { @@ -1338,7 +1338,7 @@ UNSPEC_VEC_VFEECC))] "TARGET_VX" { - unsigned HOST_WIDE_INT flags = INTVAL (operands[3]); + unsigned HOST_WIDE_INT flags = UINTVAL (operands[3]); gcc_assert (!(flags & ~(VSTRING_FLAG_ZS | VSTRING_FLAG_CS))); flags &= ~VSTRING_FLAG_CS; @@ -1515,7 +1515,7 @@ UNSPEC_VEC_VSTRC))] "TARGET_VX" { - unsigned HOST_WIDE_INT flags = INTVAL (operands[4]); + unsigned HOST_WIDE_INT flags = UINTVAL (operands[4]); if (flags & VSTRING_FLAG_ZS) { @@ -1544,7 +1544,7 @@ UNSPEC_VEC_VSTRCCC))] "TARGET_VX" { - unsigned HOST_WIDE_INT flags = INTVAL (operands[4]); + unsigned HOST_WIDE_INT flags = UINTVAL (operands[4]); if (flags & VSTRING_FLAG_ZS) {