diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2006-08-06 12:06:31 +0000 |
---|---|---|
committer | Paolo Bonzini <bonzini@gcc.gnu.org> | 2006-08-06 12:06:31 +0000 |
commit | bab1de0adbbf48be61d056c7fc62a719798b4781 (patch) | |
tree | 49aacf6d95098aca0b4fe222f21878d54978d9c0 | |
parent | 884b74f0f460fca76b373c218a532e38b1593331 (diff) | |
download | gcc-bab1de0adbbf48be61d056c7fc62a719798b4781.zip gcc-bab1de0adbbf48be61d056c7fc62a719798b4781.tar.gz gcc-bab1de0adbbf48be61d056c7fc62a719798b4781.tar.bz2 |
re PR debug/26827 ("GNAT BUG DETECTED" on compile GPS 1.3.1/gtkada)
2006-08-06 Paolo Bonzini <bonzini@gnu.org>
PR target/26827
* config/i386/i386.md: Add peephole2 to avoid "fld %st"
instructions.
2006-08-06 Paolo Bonzini <bonzini@gnu.org>
PR target/26827
* gcc.target/i386/pr27827.c: New testcase.
From-SVN: r115969
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/i386/i386.md | 26 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr27827.c | 12 |
4 files changed, 50 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e1156df..2f0a1ec 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2006-08-06 Paolo Bonzini <bonzini@gnu.org> + + PR target/27827 + + * conffig/i386/i386.md: Add peephole2 to avoid "fld %st" + instructions. + 2006-08-06 Andreas Schwab <schwab@suse.de> * config/m68k/m68k.c (m68k_output_function_epilogue): Fix format diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 4808853..a608b74 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -18757,6 +18757,32 @@ [(set_attr "type" "sseadd") (set_attr "mode" "DF")]) +;; Make two stack loads independent: +;; fld aa fld aa +;; fld %st(0) -> fld bb +;; fmul bb fmul %st(1), %st +;; +;; Actually we only match the last two instructions for simplicity. +(define_peephole2 + [(set (match_operand 0 "fp_register_operand" "") + (match_operand 1 "fp_register_operand" "")) + (set (match_dup 0) + (match_operator 2 "binary_fp_operator" + [(match_dup 0) + (match_operand 3 "memory_operand" "")]))] + "REGNO (operands[0]) != REGNO (operands[1])" + [(set (match_dup 0) (match_dup 3)) + (set (match_dup 0) (match_dup 4))] + + ;; The % modifier is not operational anymore in peephole2's, so we have to + ;; swap the operands manually in the case of addition and multiplication. + "if (COMMUTATIVE_ARITH_P (operands[2])) + operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[2]), GET_MODE (operands[2]), + operands[0], operands[1]); + else + operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[2]), GET_MODE (operands[2]), + operands[1], operands[0]);") + ;; Conditional addition patterns (define_expand "addqicc" [(match_operand:QI 0 "register_operand" "") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bdce8ca..5fef813 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-08-06 Paolo Bonzini <bonzini@gnu.org> + + PR target/27827 + * gcc.target/i386/pr27827.c: New testcase. + 2006-08-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/28590 diff --git a/gcc/testsuite/gcc.target/i386/pr27827.c b/gcc/testsuite/gcc.target/i386/pr27827.c new file mode 100644 index 0000000..b3b377a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr27827.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +double a, b; +double f(double c) +{ + double x = a * b; + return x + c * a; +} + +/* { dg-final { scan-assembler-not "fld\[ \t\]*%st" } } */ +/* { dg-final { scan-assembler "fmul\[ \t\]*%st" } } */ |