i386.c (ix86_expand_fp_absneg_operator): When SSE isn't available...
* config/i386/i386.c (ix86_expand_fp_absneg_operator): When SSE isn't available, directly generate the simpler x87 patterns without the (use (const_int 0)). * config/i386/i386.md (*negsf2_1): Enable pre-reload if the SSE implementation isn't available. (*negdf2_1): Likewise. (*negxf2_1): XF mode negation is always done using the x87. (*abssf2_1, *absdf2_1, *absxf2_1): Likewise^3 for fabs. * gcc.target/i386/387-11.c: New test case. From-SVN: r114293
This commit is contained in:
parent
222ae291bb
commit
86ce18257f
5 changed files with 43 additions and 17 deletions
|
@ -1,3 +1,14 @@
|
|||
2006-05-31 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* config/i386/i386.c (ix86_expand_fp_absneg_operator): When SSE
|
||||
isn't available, directly generate the simpler x87 patterns without
|
||||
the (use (const_int 0)).
|
||||
* config/i386/i386.md (*negsf2_1): Enable pre-reload if the SSE
|
||||
implementation isn't available.
|
||||
(*negdf2_1): Likewise.
|
||||
(*negxf2_1): XF mode negation is always done using the x87.
|
||||
(*abssf2_1, *absdf2_1, *absxf2_1): Likewise^3 for fabs.
|
||||
|
||||
2006-05-31 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* builtins.c (fold_builtin_cabs): Delete prototype. Require an
|
||||
|
|
|
@ -9288,22 +9288,17 @@ ix86_expand_fp_absneg_operator (enum rtx_code code, enum machine_mode mode,
|
|||
if (use_sse)
|
||||
mask = ix86_build_signbit_mask (elt_mode, vector_mode, code == ABS);
|
||||
else
|
||||
{
|
||||
/* When not using SSE, we don't use the mask, but prefer to keep the
|
||||
same general form of the insn pattern to reduce duplication when
|
||||
it comes time to split. */
|
||||
mask = const0_rtx;
|
||||
}
|
||||
mask = NULL_RTX;
|
||||
|
||||
dst = operands[0];
|
||||
src = operands[1];
|
||||
|
||||
/* If the destination is memory, and we don't have matching source
|
||||
operands, do things in registers. */
|
||||
operands or we're using the x87, do things in registers. */
|
||||
matching_memory = false;
|
||||
if (MEM_P (dst))
|
||||
{
|
||||
if (rtx_equal_p (dst, src))
|
||||
if (use_sse && rtx_equal_p (dst, src))
|
||||
matching_memory = true;
|
||||
else
|
||||
dst = gen_reg_rtx (mode);
|
||||
|
@ -9321,9 +9316,15 @@ ix86_expand_fp_absneg_operator (enum rtx_code code, enum machine_mode mode,
|
|||
{
|
||||
set = gen_rtx_fmt_e (code, mode, src);
|
||||
set = gen_rtx_SET (VOIDmode, dst, set);
|
||||
use = gen_rtx_USE (VOIDmode, mask);
|
||||
clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
|
||||
emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (3, set, use, clob)));
|
||||
if (mask)
|
||||
{
|
||||
use = gen_rtx_USE (VOIDmode, mask);
|
||||
clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
|
||||
emit_insn (gen_rtx_PARALLEL (VOIDmode,
|
||||
gen_rtvec (3, set, use, clob)));
|
||||
}
|
||||
else
|
||||
emit_insn (set);
|
||||
}
|
||||
|
||||
if (dst != operands[0])
|
||||
|
|
|
@ -9905,7 +9905,7 @@
|
|||
(define_insn "*negsf2_1"
|
||||
[(set (match_operand:SF 0 "register_operand" "=f")
|
||||
(neg:SF (match_operand:SF 1 "register_operand" "0")))]
|
||||
"TARGET_80387 && reload_completed"
|
||||
"TARGET_80387 && (reload_completed || !TARGET_SSE_MATH)"
|
||||
"fchs"
|
||||
[(set_attr "type" "fsgn")
|
||||
(set_attr "mode" "SF")])
|
||||
|
@ -9913,7 +9913,7 @@
|
|||
(define_insn "*negdf2_1"
|
||||
[(set (match_operand:DF 0 "register_operand" "=f")
|
||||
(neg:DF (match_operand:DF 1 "register_operand" "0")))]
|
||||
"TARGET_80387 && reload_completed"
|
||||
"TARGET_80387 && (reload_completed || !TARGET_SSE_MATH)"
|
||||
"fchs"
|
||||
[(set_attr "type" "fsgn")
|
||||
(set_attr "mode" "DF")])
|
||||
|
@ -9921,7 +9921,7 @@
|
|||
(define_insn "*negxf2_1"
|
||||
[(set (match_operand:XF 0 "register_operand" "=f")
|
||||
(neg:XF (match_operand:XF 1 "register_operand" "0")))]
|
||||
"TARGET_80387 && reload_completed"
|
||||
"TARGET_80387"
|
||||
"fchs"
|
||||
[(set_attr "type" "fsgn")
|
||||
(set_attr "mode" "XF")])
|
||||
|
@ -9929,7 +9929,7 @@
|
|||
(define_insn "*abssf2_1"
|
||||
[(set (match_operand:SF 0 "register_operand" "=f")
|
||||
(abs:SF (match_operand:SF 1 "register_operand" "0")))]
|
||||
"TARGET_80387 && reload_completed"
|
||||
"TARGET_80387 && (reload_completed || !TARGET_SSE_MATH)"
|
||||
"fabs"
|
||||
[(set_attr "type" "fsgn")
|
||||
(set_attr "mode" "SF")])
|
||||
|
@ -9937,7 +9937,7 @@
|
|||
(define_insn "*absdf2_1"
|
||||
[(set (match_operand:DF 0 "register_operand" "=f")
|
||||
(abs:DF (match_operand:DF 1 "register_operand" "0")))]
|
||||
"TARGET_80387 && reload_completed"
|
||||
"TARGET_80387 && (reload_completed || !TARGET_SSE_MATH)"
|
||||
"fabs"
|
||||
[(set_attr "type" "fsgn")
|
||||
(set_attr "mode" "DF")])
|
||||
|
@ -9945,7 +9945,7 @@
|
|||
(define_insn "*absxf2_1"
|
||||
[(set (match_operand:XF 0 "register_operand" "=f")
|
||||
(abs:XF (match_operand:XF 1 "register_operand" "0")))]
|
||||
"TARGET_80387 && reload_completed"
|
||||
"TARGET_80387"
|
||||
"fabs"
|
||||
[(set_attr "type" "fsgn")
|
||||
(set_attr "mode" "DF")])
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2006-05-31 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* gcc.target/i386/387-11.c: New test case.
|
||||
|
||||
2006-05-31 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/27801
|
||||
|
|
10
gcc/testsuite/gcc.target/i386/387-11.c
Normal file
10
gcc/testsuite/gcc.target/i386/387-11.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
|
||||
/* { dg-options "-O2 -mfpmath=387" } */
|
||||
|
||||
double foo(double x, double y)
|
||||
{
|
||||
double t = -x * y;
|
||||
return -t;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-not "fchs" } } */
|
Loading…
Add table
Reference in a new issue