diff options
author | Bernd Schmidt <bernd.schmidt@codesourcery.com> | 2010-03-19 18:18:54 +0000 |
---|---|---|
committer | Bernd Schmidt <bernds@gcc.gnu.org> | 2010-03-19 18:18:54 +0000 |
commit | 002b2dee5d23dff9cc0a7f3196838534bc084da4 (patch) | |
tree | ede6feafa04bf138a041b65d50a1d8c03a3989ec /gcc | |
parent | f9ceed32dc9196ddcd2551526637369910a8407b (diff) | |
download | gcc-002b2dee5d23dff9cc0a7f3196838534bc084da4.zip gcc-002b2dee5d23dff9cc0a7f3196838534bc084da4.tar.gz gcc-002b2dee5d23dff9cc0a7f3196838534bc084da4.tar.bz2 |
re PR rtl-optimization/42258 (redundant register move around mul instruction)
gcc/
PR rtl-optimization/42258
* ira-lives.c (check_and_make_def_conflict): Ignore conflict for a
use that may match DEF.
testsuite/
PR rtl-optimization/42258
* gcc.target/arm/thumb1-mul-moves.c: New test.
From-SVN: r157581
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ira-lives.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/arm/thumb1-mul-moves.c | 11 |
4 files changed, 40 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c255935..bdc8dae 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-03-19 Bernd Schmidt <bernd.schmidt@codesourcery.com> + + PR rtl-optimization/42258 + * ira-lives.c (check_and_make_def_conflict): Ignore conflict for a + use that may match DEF. + 2010-03-19 Michael Matz <matz@suse.de> PR c++/43116 diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c index ac69e22..b88082a 100644 --- a/gcc/ira-lives.c +++ b/gcc/ira-lives.c @@ -499,6 +499,8 @@ check_and_make_def_conflict (int alt, int def, enum reg_class def_cl) for (use = 0; use < recog_data.n_operands; use++) { + int alt1; + if (use == def || recog_data.operand_type[use] == OP_OUT) continue; @@ -507,6 +509,22 @@ check_and_make_def_conflict (int alt, int def, enum reg_class def_cl) else use_cl = recog_op_alt[use][alt].cl; + /* If there's any alternative that allows USE to match DEF, do not + record a conflict. If that causes us to create an invalid + instruction due to the earlyclobber, reload must fix it up. */ + for (alt1 = 0; alt1 < recog_data.n_alternatives; alt1++) + if (recog_op_alt[use][alt1].matches == def + || (use < recog_data.n_operands - 1 + && recog_data.constraints[use][0] == '%' + && recog_op_alt[use + 1][alt1].matches == def) + || (use >= 1 + && recog_data.constraints[use - 1][0] == '%' + && recog_op_alt[use - 1][alt1].matches == def)) + break; + + if (alt1 < recog_data.n_alternatives) + continue; + advance_p = check_and_make_def_use_conflict (dreg, def_cl, use, use_cl, advance_p); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 758456e..a13e712 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-03-19 Bernd Schmidt <bernd.schmidt@codesourcery.com> + + PR rtl-optimization/42258 + * gcc.target/arm/thumb1-mul-moves.c: New test. + 2010-03-19 Michael Matz <matz@suse.de> PR c++/43116 diff --git a/gcc/testsuite/gcc.target/arm/thumb1-mul-moves.c b/gcc/testsuite/gcc.target/arm/thumb1-mul-moves.c new file mode 100644 index 0000000..6235774 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/thumb1-mul-moves.c @@ -0,0 +1,11 @@ +/* Check for unnecessary register moves. */ +/* { dg-options "-mthumb -Os" } */ +/* { dg-require-effective-target arm_thumb1_ok } */ + +int f(int x) +{ + return x*42; +} + +/* { dg-final { scan-assembler-not "mov\[\\t \]*r0," } } */ + |