* [PATCH, i386}: Committed: cleanup output_387_reg_move() calls
@ 2007-04-06 11:03 Uros Bizjak
0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2007-04-06 11:03 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 677 bytes --]
Hello!
Attached patch enhances output_387_reg_move() to handle reg->mem
moves. This enables further cleanups through i386.md.
Patch was bootstrapped and regression tested on i686-pc-linux-gnu for
all default languages. Patch is committed to SVN mainline.
2007-04-06 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.c (output_387_reg_move): Handle memory operand[0].
* config/i386/i386.md (*movsf_1, *movdf_nointeger,
*movdf_integer_rex64, *movdf_integer, *movxf_nointeger,
*movxf_integer): Use output_387_reg_move() for x87 reg->mem
alternative.
(*extendsfdf2_mixed, *extendsfdf2_i387, *extendsfxf2_i387,
*extenddfxf2_i387, *truncdfsf_fast_mixed): Ditto.
Uros.
[-- Attachment #2: i386-387reg.diff --]
[-- Type: application/octet-stream, Size: 6789 bytes --]
Index: i386.md
===================================================================
--- i386.md (revision 123612)
+++ i386.md (working copy)
@@ -2343,14 +2343,9 @@
switch (which_alternative)
{
case 0:
+ case 1:
return output_387_reg_move (insn, operands);
- case 1:
- if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- return "fstp%z0\t%y0";
- else
- return "fst%z0\t%y0";
-
case 2:
return standard_80387_constant_opcode (operands[1]);
@@ -2512,14 +2507,9 @@
switch (which_alternative)
{
case 0:
+ case 1:
return output_387_reg_move (insn, operands);
- case 1:
- if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- return "fstp%z0\t%y0";
- else
- return "fst%z0\t%y0";
-
case 2:
return standard_80387_constant_opcode (operands[1]);
@@ -2633,14 +2623,9 @@
switch (which_alternative)
{
case 0:
+ case 1:
return output_387_reg_move (insn, operands);
- case 1:
- if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- return "fstp%z0\t%y0";
- else
- return "fst%z0\t%y0";
-
case 2:
return standard_80387_constant_opcode (operands[1]);
@@ -2760,14 +2745,9 @@
switch (which_alternative)
{
case 0:
+ case 1:
return output_387_reg_move (insn, operands);
- case 1:
- if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- return "fstp%z0\t%y0";
- else
- return "fst%z0\t%y0";
-
case 2:
return standard_80387_constant_opcode (operands[1]);
@@ -2972,16 +2952,9 @@
switch (which_alternative)
{
case 0:
+ case 1:
return output_387_reg_move (insn, operands);
- case 1:
- /* There is no non-popping store to memory for XFmode. So if
- we need one, follow the store with a load. */
- if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- return "fstp%z0\t%y0\;fld%z0\t%y0";
- else
- return "fstp%z0\t%y0";
-
case 2:
return standard_80387_constant_opcode (operands[1]);
@@ -3007,16 +2980,9 @@
switch (which_alternative)
{
case 0:
+ case 1:
return output_387_reg_move (insn, operands);
- case 1:
- /* There is no non-popping store to memory for XFmode. So if
- we need one, follow the store with a load. */
- if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- return "fstp%z0\t%y0\;fld%z0\t%y0";
- else
- return "fstp%z0\t%y0";
-
case 2:
return standard_80387_constant_opcode (operands[1]);
@@ -3789,14 +3755,9 @@
switch (which_alternative)
{
case 0:
+ case 1:
return output_387_reg_move (insn, operands);
- case 1:
- if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- return "fstp%z0\t%y0";
- else
- return "fst%z0\t%y0";
-
case 2:
return "cvtss2sd\t{%1, %0|%0, %1}";
@@ -3819,22 +3780,7 @@
[(set (match_operand:DF 0 "nonimmediate_operand" "=f,m")
(float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
"TARGET_80387"
-{
- switch (which_alternative)
- {
- case 0:
- return output_387_reg_move (insn, operands);
-
- case 1:
- if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- return "fstp%z0\t%y0";
- else
- return "fst%z0\t%y0";
-
- default:
- gcc_unreachable ();
- }
-}
+ "* return output_387_reg_move (insn, operands);"
[(set_attr "type" "fmov")
(set_attr "mode" "SF,XF")])
@@ -3862,24 +3808,7 @@
[(set (match_operand:XF 0 "nonimmediate_operand" "=f,m")
(float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
"TARGET_80387"
-{
- switch (which_alternative)
- {
- case 0:
- return output_387_reg_move (insn, operands);
-
- case 1:
- /* There is no non-popping store to memory for XFmode. So if
- we need one, follow the store with a load. */
- if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- return "fstp%z0\t%y0";
- else
- return "fstp%z0\t%y0\n\tfld%z0\t%y0";
-
- default:
- gcc_unreachable ();
- }
-}
+ "* return output_387_reg_move (insn, operands);"
[(set_attr "type" "fmov")
(set_attr "mode" "SF,XF")])
@@ -3907,24 +3836,7 @@
[(set (match_operand:XF 0 "nonimmediate_operand" "=f,m")
(float_extend:XF (match_operand:DF 1 "nonimmediate_operand" "fm,f")))]
"TARGET_80387"
-{
- switch (which_alternative)
- {
- case 0:
- return output_387_reg_move (insn, operands);
-
- case 1:
- /* There is no non-popping store to memory for XFmode. So if
- we need one, follow the store with a load. */
- if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- return "fstp%z0\t%y0\n\tfld%z0\t%y0";
- else
- return "fstp%z0\t%y0";
-
- default:
- gcc_unreachable ();
- }
-}
+ "* return output_387_reg_move (insn, operands);"
[(set_attr "type" "fmov")
(set_attr "mode" "DF,XF")])
@@ -3969,10 +3881,6 @@
switch (which_alternative)
{
case 0:
- if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- return "fstp%z0\t%y0";
- else
- return "fst%z0\t%y0";
case 1:
return output_387_reg_move (insn, operands);
case 2:
Index: i386.c
===================================================================
--- i386.c (revision 123612)
+++ i386.c (working copy)
@@ -21089,16 +21089,36 @@
const char *
output_387_reg_move (rtx insn, rtx *operands)
{
- if (REG_P (operands[1])
- && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
+ if (REG_P (operands[0]))
{
- if (REGNO (operands[0]) == FIRST_STACK_REG)
- return output_387_ffreep (operands, 0);
- return "fstp\t%y0";
+ if (REG_P (operands[1])
+ && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
+ {
+ if (REGNO (operands[0]) == FIRST_STACK_REG)
+ return output_387_ffreep (operands, 0);
+ return "fstp\t%y0";
+ }
+ if (STACK_TOP_P (operands[0]))
+ return "fld%z1\t%y1";
+ return "fst\t%y0";
}
- if (STACK_TOP_P (operands[0]))
- return "fld%z1\t%y1";
- return "fst\t%y0";
+ else if (MEM_P (operands[0]))
+ {
+ gcc_assert (REG_P (operands[1]));
+ if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
+ return "fstp%z0\t%y0";
+ else
+ {
+ /* There is no non-popping store to memory for XFmode.
+ So if we need one, follow the store with a load. */
+ if (GET_MODE (operands[0]) == XFmode)
+ return "fstp%z0\t%y0\n\tfld%z0\t%y0";
+ else
+ return "fst%z0\t%y0";
+ }
+ }
+ else
+ gcc_unreachable();
}
/* Output code to perform a conditional jump to LABEL, if C2 flag in
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-04-06 11:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-06 11:03 [PATCH, i386}: Committed: cleanup output_387_reg_move() calls Uros Bizjak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).