aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-08-30 11:15:53 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-08-30 11:15:53 +0000
commit50e2afe76060a1c2e9e8b80621e7cc4c5ae270ae (patch)
treed4f21ac066911541461679069e4314a786f59cd6 /gcc
parentbf62e687b552f87c36bc5579c65a24de0b4f59b9 (diff)
downloadgcc-50e2afe76060a1c2e9e8b80621e7cc4c5ae270ae.zip
gcc-50e2afe76060a1c2e9e8b80621e7cc4c5ae270ae.tar.gz
gcc-50e2afe76060a1c2e9e8b80621e7cc4c5ae270ae.tar.bz2
[44/77] Make simplify_and_const_int take a scalar_int_mode
After previous patches, top-level calls to simplify_and_const_int always pass a scalar_int_mode. The only call site that needs to be updated is the recursive one in simplify_and_const_int_1, at which point we know "varop" has a scalar integer 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_and_const_int): Change the type of the mode parameter to scalar_int_mode. (simplify_and_const_int_1): Likewise. Update recursive call. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251496
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/combine.c35
2 files changed, 26 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5449fa1..8fc7bba 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -2,6 +2,14 @@
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
+ * combine.c (simplify_and_const_int): Change the type of the mode
+ parameter to scalar_int_mode.
+ (simplify_and_const_int_1): Likewise. Update recursive call.
+
+2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
+ Alan Hayward <alan.hayward@arm.com>
+ David Sherwood <david.sherwood@arm.com>
+
* combine.c (simplify_compare_const): Check that the mode is a
scalar_int_mode (rather than VOIDmode) before testing its
precision.
diff --git a/gcc/combine.c b/gcc/combine.c
index 2fbfed4..aa38770 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -459,9 +459,9 @@ static int rtx_equal_for_field_assignment_p (rtx, rtx, bool = false);
static rtx make_field_assignment (rtx);
static rtx apply_distributive_law (rtx);
static rtx distribute_and_simplify_rtx (rtx, int);
-static rtx simplify_and_const_int_1 (machine_mode, rtx,
+static rtx simplify_and_const_int_1 (scalar_int_mode, rtx,
unsigned HOST_WIDE_INT);
-static rtx simplify_and_const_int (rtx, machine_mode, rtx,
+static rtx simplify_and_const_int (rtx, scalar_int_mode, rtx,
unsigned HOST_WIDE_INT);
static int merge_outer_ops (enum rtx_code *, HOST_WIDE_INT *, enum rtx_code,
HOST_WIDE_INT, machine_mode, int *);
@@ -9905,7 +9905,7 @@ distribute_and_simplify_rtx (rtx x, int n)
(const_int CONSTOP)). Otherwise, return NULL_RTX. */
static rtx
-simplify_and_const_int_1 (machine_mode mode, rtx varop,
+simplify_and_const_int_1 (scalar_int_mode mode, rtx varop,
unsigned HOST_WIDE_INT constop)
{
unsigned HOST_WIDE_INT nonzero;
@@ -9965,19 +9965,20 @@ simplify_and_const_int_1 (machine_mode mode, rtx varop,
won't match a pattern either with or without this. */
if (GET_CODE (varop) == IOR || GET_CODE (varop) == XOR)
- return
- gen_lowpart
- (mode,
- apply_distributive_law
- (simplify_gen_binary (GET_CODE (varop), GET_MODE (varop),
- simplify_and_const_int (NULL_RTX,
- GET_MODE (varop),
- XEXP (varop, 0),
- constop),
- simplify_and_const_int (NULL_RTX,
- GET_MODE (varop),
- XEXP (varop, 1),
- constop))));
+ {
+ scalar_int_mode varop_mode = as_a <scalar_int_mode> (GET_MODE (varop));
+ return
+ gen_lowpart
+ (mode,
+ apply_distributive_law
+ (simplify_gen_binary (GET_CODE (varop), varop_mode,
+ simplify_and_const_int (NULL_RTX, varop_mode,
+ XEXP (varop, 0),
+ constop),
+ simplify_and_const_int (NULL_RTX, varop_mode,
+ XEXP (varop, 1),
+ constop))));
+ }
/* If VAROP is PLUS, and the constant is a mask of low bits, distribute
the AND and see if one of the operands simplifies to zero. If so, we
@@ -10020,7 +10021,7 @@ simplify_and_const_int_1 (machine_mode mode, rtx varop,
X is zero, we are to always construct the equivalent form. */
static rtx
-simplify_and_const_int (rtx x, machine_mode mode, rtx varop,
+simplify_and_const_int (rtx x, scalar_int_mode mode, rtx varop,
unsigned HOST_WIDE_INT constop)
{
rtx tem = simplify_and_const_int_1 (mode, varop, constop);