From: Paolo Bonzini Date: Sun, 6 Aug 2006 12:06:31 +0000 (+0000) Subject: re PR debug/26827 ("GNAT BUG DETECTED" on compile GPS 1.3.1/gtkada) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bab1de0adbbf48be61d056c7fc62a719798b4781;p=gcc.git re PR debug/26827 ("GNAT BUG DETECTED" on compile GPS 1.3.1/gtkada) 2006-08-06 Paolo Bonzini PR target/26827 * config/i386/i386.md: Add peephole2 to avoid "fld %st" instructions. 2006-08-06 Paolo Bonzini PR target/26827 * gcc.target/i386/pr27827.c: New testcase. From-SVN: r115969 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e1156df1c9f..2f0a1ec0e05 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2006-08-06 Paolo Bonzini + + PR target/27827 + + * conffig/i386/i386.md: Add peephole2 to avoid "fld %st" + instructions. + 2006-08-06 Andreas Schwab * 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 4808853e655..a608b7416c7 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 bdce8cac5de..5fef813e612 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-08-06 Paolo Bonzini + + PR target/27827 + * gcc.target/i386/pr27827.c: New testcase. + 2006-08-06 Paul Thomas 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 00000000000..b3b377ae9d1 --- /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" } } */