diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-08-30 11:11:32 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:11:32 +0000 |
commit | 7c61657f68cc45bdbbfcfd762dbfd7021f3acb3f (patch) | |
tree | 983ecb0098267a20b4cb1756c1fd29aebe17c9bd /gcc/ifcvt.c | |
parent | 64ab8765d7e45ed19d4a571b2aaba0abf7f834c3 (diff) | |
download | gcc-7c61657f68cc45bdbbfcfd762dbfd7021f3acb3f.zip gcc-7c61657f68cc45bdbbfcfd762dbfd7021f3acb3f.tar.gz gcc-7c61657f68cc45bdbbfcfd762dbfd7021f3acb3f.tar.bz2 |
[25/77] Use is_a <scalar_int_mode> for bitmask optimisations
Explicitly check for scalar_int_mode in code that maps arithmetic
to full-mode bit operations. These operations wouldn't work correctly
for vector modes, for example. In many cases this is enforced also by
checking whether an operand is CONST_INT_P, but there were other cases
where the condition is more indirect.
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* combine.c (combine_simplify_rtx): Add checks for
is_a <scalar_int_mode>.
(simplify_if_then_else): Likewise.
(make_field_assignment): Likewise.
(simplify_comparison): Likewise.
* ifcvt.c (noce_try_bitop): Likewise.
* loop-invariant.c (canonicalize_address_mult): Likewise.
* simplify-rtx.c (simplify_unary_operation_1): Likewise.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251477
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r-- | gcc/ifcvt.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 46a13c4..9a646a6 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -2808,7 +2808,7 @@ noce_try_bitop (struct noce_if_info *if_info) { rtx cond, x, a, result; rtx_insn *seq; - machine_mode mode; + scalar_int_mode mode; enum rtx_code code; int bitnum; @@ -2816,6 +2816,10 @@ noce_try_bitop (struct noce_if_info *if_info) cond = if_info->cond; code = GET_CODE (cond); + /* Check for an integer operation. */ + if (!is_a <scalar_int_mode> (GET_MODE (x), &mode)) + return FALSE; + if (!noce_simple_bbs (if_info)) return FALSE; @@ -2838,7 +2842,6 @@ noce_try_bitop (struct noce_if_info *if_info) || ! rtx_equal_p (x, XEXP (cond, 0))) return FALSE; bitnum = INTVAL (XEXP (cond, 2)); - mode = GET_MODE (x); if (BITS_BIG_ENDIAN) bitnum = GET_MODE_BITSIZE (mode) - 1 - bitnum; if (bitnum < 0 || bitnum >= HOST_BITS_PER_WIDE_INT) |