From c07a0a226b6904995d785662bab74c2c68481539 Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Fri, 22 Mar 2019 16:59:21 +0000 Subject: [PATCH] re PR rtl-optimization/89676 (Redundant moves for long long shift on 32bit x86) 2019-03-22 Vladimir Makarov PR rtl-optimization/89676 * lra-constraints.c (curr_insn_transform): Do match reload for early clobbers even if the match was successful. 2019-03-22 Vladimir Makarov PR rtl-optimization/89676 * gcc.target/i386/pr89676.c: New. From-SVN: r269878 --- gcc/ChangeLog | 6 ++++++ gcc/lra-constraints.c | 14 ++++++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr89676.c | 10 ++++++++++ 4 files changed, 35 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr89676.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aa5530eb11f..c10c4c745a5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-22 Vladimir Makarov + + PR rtl-optimization/89676 + * lra-constraints.c (curr_insn_transform): Do match reload for + early clobbers even if the match was successful. + 2019-03-22 Jakub Jelinek PR c++/87481 diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index cba87eb718e..78932cc1538 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -4256,6 +4256,20 @@ curr_insn_transform (bool check_only_p) || MEM_P (SET_DEST (curr_insn_set)) || GET_CODE (SET_DEST (curr_insn_set)) == SUBREG)))) optional_p = true; + else if (goal_alt_matched[i][0] != -1 + && curr_static_id->operand[i].type == OP_OUT + && (curr_static_id->operand_alternative + [goal_alt_number * n_operands + i].earlyclobber)) + { + /* Generate reloads for output and matched inputs. This + is the easiest way to avoid creation of non-existing + conflicts in lra-lives.c. */ + match_reload (i, goal_alt_matched[i], outputs, goal_alt[i], &before, + &after, TRUE); + outputs[n_outputs++] = i; + outputs[n_outputs] = -1; + continue; + } else continue; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8324702d242..5626696d166 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-22 Vladimir Makarov + + PR rtl-optimization/89676 + * gcc.target/i386/pr89676.c: New. + 2019-03-22 Jakub Jelinek PR c++/60702 diff --git a/gcc/testsuite/gcc.target/i386/pr89676.c b/gcc/testsuite/gcc.target/i386/pr89676.c new file mode 100644 index 00000000000..90865d85865 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89676.c @@ -0,0 +1,10 @@ +/* PR rtl-optimization/89676 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -m32 -march=i686" } */ +unsigned long long +foo (unsigned long long i) +{ + return i << 3; +} + +/* { dg-final { scan-assembler-times "movl" 2 } } */ -- 2.30.2