From b3519e7c8a1c3822a3f5ad2a861ffeae45bf98cb Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 6 Nov 2007 11:19:23 -0800 Subject: [PATCH] re PR target/30961 (redundant reg/mem stores/moves) gcc/ 2007-11-06 Ulrich Weigand PR target/30961 * reload1.c (find_reloads): Also check in_reg when handling a simple move with an input reload and a destination of a hard register. gcc/testsuite/ 2007-11-06 H.J. Lu PR target/30961 * gcc.target/i386/pr30961-1.c: New. From-SVN: r129943 --- gcc/ChangeLog | 7 +++++++ gcc/reload.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr30961-1.c | 13 +++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr30961-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 96f7129af90..c576ae9117d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2007-11-06 Ulrich Weigand + + PR target/30961 + * reload1.c (find_reloads): Also check in_reg when handling a + simple move with an input reload and a destination of a hard + register. + 2007-11-06 Maxim Kuvyrkov * config/m68k/m68k.c (sched-int.h, insn-codes.h): New includes. diff --git a/gcc/reload.c b/gcc/reload.c index c9c5fc5c5c0..871f1718301 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -4462,7 +4462,8 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, if (rld[i].when_needed == RELOAD_FOR_INPUT && GET_CODE (PATTERN (insn)) == SET && REG_P (SET_DEST (PATTERN (insn))) - && SET_SRC (PATTERN (insn)) == rld[i].in + && (SET_SRC (PATTERN (insn)) == rld[i].in + || SET_SRC (PATTERN (insn)) == rld[i].in_reg) && !elimination_target_reg_p (SET_DEST (PATTERN (insn)))) { rtx dest = SET_DEST (PATTERN (insn)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 405068cd2ad..f33553365b0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-11-06 H.J. Lu + + PR target/30961 + * gcc.target/i386/pr30961-1.c: New. + 2007-11-06 Tom Tromey PR c++/32368: diff --git a/gcc/testsuite/gcc.target/i386/pr30961-1.c b/gcc/testsuite/gcc.target/i386/pr30961-1.c new file mode 100644 index 00000000000..c2259433554 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr30961-1.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-options "-O2" } */ + +double +convert (long long in) +{ + double f; + __builtin_memcpy( &f, &in, sizeof( in ) ); + return f; +} + +/* { dg-final { scan-assembler-not "movapd" } } */