From: Roger Sayle Date: Mon, 12 Apr 2004 23:23:16 +0000 (+0000) Subject: i386.c (output_387_reg_move): New function. X-Git-Tag: releases/gcc-4.0.0~8953 X-Git-Url: https://gcc.gnu.org/git/?a=commitdiff_plain;h=5ea9cb6ede38250fa0fef5928908d10ba13e63d0;p=gcc.git i386.c (output_387_reg_move): New function. * config/i386/i386.c (output_387_reg_move): New function. * config/i386/i386-protos.h (output_387_reg_move): Prototype here. * config/i386/i386.md (*movsf_1, *movsf1_nointerunit, *movdf_nointeger, *movdf_integer, *movxf_nointeger, *movxf_integer, *extendsfdf2_1, *extendsfxf2_1, *extenddfxf2_1, truncdfsf2_noop, truncxfsf2_noop, truncxfdf2_noop): Call output_387_reg_move. From-SVN: r80631 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 72ec5b5eb423..504da82aea2f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-04-12 Roger Sayle + + * config/i386/i386.c (output_387_reg_move): New function. + * config/i386/i386-protos.h (output_387_reg_move): Prototype here. + * config/i386/i386.md (*movsf_1, *movsf1_nointerunit, + *movdf_nointeger, *movdf_integer, *movxf_nointeger, *movxf_integer, + *extendsfdf2_1, *extendsfxf2_1, *extenddfxf2_1, truncdfsf2_noop, + truncxfsf2_noop, truncxfdf2_noop): Call output_387_reg_move. + 2004-04-12 Richard Kenner * c-decl.c (finish_decl): Make a decl_stmt for a variable-sized diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index 947f15d615cd..d95be60e23f0 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -117,6 +117,7 @@ extern void split_ti (rtx[], int, rtx[], rtx[]); extern const char *output_set_got (rtx); extern const char *output_387_binary_op (rtx, rtx*); +extern const char *output_387_reg_move (rtx, rtx*); extern const char *output_fix_trunc (rtx, rtx*); extern const char *output_fp_compare (rtx, rtx*, int, int); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index f2da7e093b7c..615f2eeec49a 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -15909,4 +15909,23 @@ ix86_reverse_condition (enum rtx_code code, enum machine_mode mode) : reverse_condition_maybe_unordered (code)); } +/* Output code to perform an x87 FP register move, from OPERANDS[1] + to OPERANDS[0]. */ + +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 (REGNO (operands[0]) == FIRST_STACK_REG + && TARGET_USE_FFREEP) + return "ffreep\t%y0"; + return "fstp\t%y0"; + } + if (STACK_TOP_P (operands[0])) + return "fld%z1\t%y1"; + return "fst\t%y0"; +} + #include "gt-i386.h" diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index a9d8eedf1415..c8590d550743 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -2197,13 +2197,7 @@ switch (which_alternative) { case 0: - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; + return output_387_reg_move (insn, operands); case 1: if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) @@ -2291,18 +2285,7 @@ switch (which_alternative) { case 0: - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - { - if (REGNO (operands[0]) == FIRST_STACK_REG - && TARGET_USE_FFREEP) - return "ffreep\t%y0"; - return "fstp\t%y0"; - } - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; + return output_387_reg_move (insn, operands); case 1: if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) @@ -2466,18 +2449,7 @@ switch (which_alternative) { case 0: - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - { - if (REGNO (operands[0]) == FIRST_STACK_REG - && TARGET_USE_FFREEP) - return "ffreep\t%y0"; - return "fstp\t%y0"; - } - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; + return output_387_reg_move (insn, operands); case 1: if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) @@ -2578,18 +2550,7 @@ switch (which_alternative) { case 0: - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - { - if (REGNO (operands[0]) == FIRST_STACK_REG - && TARGET_USE_FFREEP) - return "ffreep\t%y0"; - return "fstp\t%y0"; - } - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; + return output_387_reg_move (insn, operands); case 1: if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) @@ -2781,18 +2742,7 @@ switch (which_alternative) { case 0: - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - { - if (REGNO (operands[0]) == FIRST_STACK_REG - && TARGET_USE_FFREEP) - return "ffreep\t%y0"; - return "fstp\t%y0"; - } - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; + return output_387_reg_move (insn, operands); case 1: /* There is no non-popping store to memory for XFmode. So if @@ -2825,18 +2775,7 @@ switch (which_alternative) { case 0: - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - { - if (REGNO (operands[0]) == FIRST_STACK_REG - && TARGET_USE_FFREEP) - return "ffreep\t%y0"; - return "fstp\t%y0"; - } - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; + return output_387_reg_move (insn, operands); case 1: /* There is no non-popping store to memory for XFmode. So if @@ -3520,20 +3459,14 @@ switch (which_alternative) { case 0: - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; + 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}"; @@ -3575,13 +3508,7 @@ switch (which_alternative) { case 0: - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; + return output_387_reg_move (insn, operands); case 1: /* There is no non-popping store to memory for XFmode. So if @@ -3620,13 +3547,7 @@ switch (which_alternative) { case 0: - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; + return output_387_reg_move (insn, operands); case 1: /* There is no non-popping store to memory for XFmode. So if @@ -3678,13 +3599,7 @@ (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))] "TARGET_80387 && flag_unsafe_math_optimizations" { - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; + return output_387_reg_move (insn, operands); } [(set_attr "type" "fmov") (set_attr "mode" "SF")]) @@ -3931,13 +3846,7 @@ (float_truncate:SF (match_operand:XF 1 "register_operand" "f")))] "TARGET_80387 && flag_unsafe_math_optimizations" { - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; + return output_387_reg_move (insn, operands); } [(set_attr "type" "fmov") (set_attr "mode" "SF")]) @@ -4020,13 +3929,7 @@ (float_truncate:DF (match_operand:XF 1 "register_operand" "f")))] "TARGET_80387 && flag_unsafe_math_optimizations" { - if (REG_P (operands[1]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - return "fstp\t%y0"; - else if (STACK_TOP_P (operands[0])) - return "fld%z1\t%y1"; - else - return "fst\t%y0"; + return output_387_reg_move (insn, operands); } [(set_attr "type" "fmov") (set_attr "mode" "DF")])