diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-08-30 11:15:46 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:15:46 +0000 |
commit | bf62e687b552f87c36bc5579c65a24de0b4f59b9 (patch) | |
tree | 2e431339af054633d0375b384554024913d45efc /gcc/expr.c | |
parent | e3731c52cf1b60d90f27f81ff0d1e2ad164fed07 (diff) | |
download | gcc-bf62e687b552f87c36bc5579c65a24de0b4f59b9.zip gcc-bf62e687b552f87c36bc5579c65a24de0b4f59b9.tar.gz gcc-bf62e687b552f87c36bc5579c65a24de0b4f59b9.tar.bz2 |
[43/77] Use scalar_int_mode in simplify_comparison
The main loop of simplify_comparison starts with:
if (GET_MODE_CLASS (mode) != MODE_INT
&& ! (mode == VOIDmode
&& (GET_CODE (op0) == COMPARE || COMPARISON_P (op0))))
break;
So VOIDmode is only acceptable when comparing a COMPARE,
EQ, NE, etc. operand against a constant. After this, the loop
calls simplify_compare_const to:
(a) bring the constant op1 closer to 0 where possible and
(b) use nonzero_bits and num_sign_bit_copies to get a simpler
constant.
(a) works for both integer and VOID modes, (b) is specific
to integer modes.
The loop then has a big switch statement that handles further
simplifications. This switch statement checks for COMPARISON_P
codes but not for COMPARE.
This patch uses scalar_int_mode to make the split between
(a) and (b) more explicit. It also takes the COMPARISON_P
handling out of the switch statement and does it first,
so that the rest of the loop can treat the mode as a
scalar_int_mode.
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* combine.c (simplify_compare_const): Check that the mode is a
scalar_int_mode (rather than VOIDmode) before testing its
precision.
(simplify_comparison): Move COMPARISON_P handling out of the
loop and restrict the latter part of the loop to scalar_int_modes.
Check is_a <scalar_int_mode> before calling HWI_COMPUTABLE_MODE_P
and when considering SUBREG_REGs. Use is_int_mode instead of
checking GET_MODE_CLASS against MODE_INT.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251495
Diffstat (limited to 'gcc/expr.c')
0 files changed, 0 insertions, 0 deletions