diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-11-25 20:35:47 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-11-25 20:35:47 +0100 |
commit | e95be6330d3621d46cc6acc3dd4c45da5fd3f4b6 (patch) | |
tree | 837ff96e857d02a1e51428a14240c34fe0a2c869 | |
parent | 5a2707633bb664bd8a0f489dc9e311ab0a747d54 (diff) | |
download | gcc-e95be6330d3621d46cc6acc3dd4c45da5fd3f4b6.zip gcc-e95be6330d3621d46cc6acc3dd4c45da5fd3f4b6.tar.gz gcc-e95be6330d3621d46cc6acc3dd4c45da5fd3f4b6.tar.bz2 |
re PR rtl-optimization/81553 (ICE in immed_wide_int_const, at emit-rtl.c:607)
PR rtl-optimization/81553
* combine.c (simplify_if_then_else): In (if_then_else COND (OP Z C1) Z)
to (OP Z (mult COND (C1 * STORE_FLAG_VALUE))) optimization, if OP
is a shift where C1 has different mode than the whole shift, use C1's
mode for MULT rather than the shift's mode.
* gcc.c-torture/compile/pr81553.c: New test.
From-SVN: r255150
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/combine.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr81553.c | 10 |
4 files changed, 28 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5e8b538..3445e3e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2017-11-25 Jakub Jelinek <jakub@redhat.com> + PR rtl-optimization/81553 + * combine.c (simplify_if_then_else): In (if_then_else COND (OP Z C1) Z) + to (OP Z (mult COND (C1 * STORE_FLAG_VALUE))) optimization, if OP + is a shift where C1 has different mode than the whole shift, use C1's + mode for MULT rather than the shift's mode. + PR target/82848 * config/rs6000/rs6000.c (rs6000_gimple_fold_builtin): Don't fold builtins not enabled in the currently selected ISA. diff --git a/gcc/combine.c b/gcc/combine.c index ab51543..0ce0751 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -6639,11 +6639,15 @@ simplify_if_then_else (rtx x) if (z) { - temp = subst (simplify_gen_relational (true_code, m, VOIDmode, + machine_mode cm = m; + if ((op == ASHIFT || op == LSHIFTRT || op == ASHIFTRT) + && GET_MODE (c1) != VOIDmode) + cm = GET_MODE (c1); + temp = subst (simplify_gen_relational (true_code, cm, VOIDmode, cond_op0, cond_op1), pc_rtx, pc_rtx, 0, 0, 0); - temp = simplify_gen_binary (MULT, m, temp, - simplify_gen_binary (MULT, m, c1, + temp = simplify_gen_binary (MULT, cm, temp, + simplify_gen_binary (MULT, cm, c1, const_true_rtx)); temp = subst (temp, pc_rtx, pc_rtx, 0, 0, 0); temp = simplify_gen_binary (op, m, gen_lowpart (m, z), temp); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4c4b81e..f016927 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-11-25 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/81553 + * gcc.c-torture/compile/pr81553.c: New test. + 2017-11-25 Andreas Schwab <schwab@linux-m68k.org> * g++.dg/abi/structret1.C (FrameworkObject::action): Return a diff --git a/gcc/testsuite/gcc.c-torture/compile/pr81553.c b/gcc/testsuite/gcc.c-torture/compile/pr81553.c new file mode 100644 index 0000000..ae33b16 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr81553.c @@ -0,0 +1,10 @@ +/* PR rtl-optimization/81553 */ + +int a, b, c, d; + +void +foo (void) +{ + d = 1 >> c >> 1; + b = ~(209883449764912897ULL & d) << (0 >= a) | ~d; +} |