s390: -mfused-madd cleanup

* config.gcc [s390*-*] (extra_options): Add fused-madd.opt.
        * config/s390/s390.opt (mfused-madd): Remove.
        * config/s390/s390.c (s390_rtx_costs): Handle FMA.
        (TARGET_DEFAULT_TARGET_FLAGS): Remove MASK_FUSED_MADD.
        * config/s390/s390.md (fma<DSF>4): Rename from *fmadd<DSF>; use FMA.
        (fms<DSF>4): Rename from *fmsub<DSF>; use FMA.

From-SVN: r166838
This commit is contained in:
Richard Henderson 2010-11-16 15:24:53 -08:00 committed by Richard Henderson
parent d6613781a5
commit d7ecb504b9
5 changed files with 42 additions and 29 deletions

View file

@ -1,3 +1,12 @@
2010-11-16 Richard Henderson <rth@redhat.com>
* config.gcc [s390*-*] (extra_options): Add fused-madd.opt.
* config/s390/s390.opt (mfused-madd): Remove.
* config/s390/s390.c (s390_rtx_costs): Handle FMA.
(TARGET_DEFAULT_TARGET_FLAGS): Remove MASK_FUSED_MADD.
* config/s390/s390.md (fma<DSF>4): Rename from *fmadd<DSF>; use FMA.
(fms<DSF>4): Rename from *fmsub<DSF>; use FMA.
2010-11-16 Richard Henderson <rth@redhat.com>
* config.gcc [powerpc*, rs6000*] (extra_options): Add fused-madd.opt.

View file

@ -393,6 +393,7 @@ spu*-*-*)
s390*-*-*)
cpu_type=s390
need_64bit_hwint=yes
extra_options="${extra_options} fused-madd.opt"
;;
# Note the 'l'; we need to be able to match e.g. "shle" or "shl".
sh[123456789lbe]*-*-* | sh-*-*)

View file

@ -2464,21 +2464,6 @@ s390_rtx_costs (rtx x, int code, int outer_code, int *total,
case PLUS:
case MINUS:
/* Check for multiply and add. */
if ((GET_MODE (x) == DFmode || GET_MODE (x) == SFmode)
&& GET_CODE (XEXP (x, 0)) == MULT
&& TARGET_HARD_FLOAT && TARGET_FUSED_MADD)
{
/* This is the multiply and add case. */
if (GET_MODE (x) == DFmode)
*total = s390_cost->madbr;
else
*total = s390_cost->maebr;
*total += (rtx_cost (XEXP (XEXP (x, 0), 0), MULT, speed)
+ rtx_cost (XEXP (XEXP (x, 0), 1), MULT, speed)
+ rtx_cost (XEXP (x, 1), (enum rtx_code) code, speed));
return true; /* Do not do an additional recursive descent. */
}
*total = COSTS_N_INSNS (1);
return false;
@ -2541,6 +2526,28 @@ s390_rtx_costs (rtx x, int code, int outer_code, int *total,
}
return false;
case FMA:
switch (GET_MODE (x))
{
case DFmode:
*total = s390_cost->madbr;
break;
case SFmode:
*total = s390_cost->maebr;
break;
default:
return false;
}
/* Negate in the third argument is free: FMSUB. */
if (GET_CODE (XEXP (x, 2)) == NEG)
{
*total += (rtx_cost (XEXP (x, 0), FMA, speed)
+ rtx_cost (XEXP (x, 1), FMA, speed)
+ rtx_cost (XEXP (XEXP (x, 2), 0), FMA, speed));
return true;
}
return false;
case UDIV:
case UMOD:
if (GET_MODE (x) == TImode) /* 128 bit division */
@ -10511,7 +10518,7 @@ s390_loop_unroll_adjust (unsigned nunroll, struct loop *loop)
#define TARGET_ASM_CLOSE_PAREN ""
#undef TARGET_DEFAULT_TARGET_FLAGS
#define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT | MASK_FUSED_MADD)
#define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT)
#undef TARGET_HANDLE_OPTION
#define TARGET_HANDLE_OPTION s390_handle_option

View file

@ -5488,12 +5488,12 @@
(set_attr "type" "fmul<mode>")])
; madbr, maebr, maxb, madb, maeb
(define_insn "*fmadd<mode>"
(define_insn "fma<mode>4"
[(set (match_operand:DSF 0 "register_operand" "=f,f")
(plus:DSF (mult:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f")
(match_operand:DSF 2 "nonimmediate_operand" "f,R"))
(fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f")
(match_operand:DSF 2 "nonimmediate_operand" "f,R")
(match_operand:DSF 3 "register_operand" "0,0")))]
"TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
"TARGET_HARD_FLOAT"
"@
ma<xde>br\t%0,%1,%2
ma<xde>b\t%0,%1,%2"
@ -5501,12 +5501,12 @@
(set_attr "type" "fmadd<mode>")])
; msxbr, msdbr, msebr, msxb, msdb, mseb
(define_insn "*fmsub<mode>"
(define_insn "fms<mode>4"
[(set (match_operand:DSF 0 "register_operand" "=f,f")
(minus:DSF (mult:DSF (match_operand:DSF 1 "nonimmediate_operand" "f,f")
(match_operand:DSF 2 "nonimmediate_operand" "f,R"))
(match_operand:DSF 3 "register_operand" "0,0")))]
"TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
(fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f")
(match_operand:DSF 2 "nonimmediate_operand" "f,R")
(neg:DSF (match_operand:DSF 3 "register_operand" "0,0"))))]
"TARGET_HARD_FLOAT"
"@
ms<xde>br\t%0,%1,%2
ms<xde>b\t%0,%1,%2"

View file

@ -42,10 +42,6 @@ mesa
Target Report RejectNegative Negative(mzarch) InverseMask(ZARCH)
ESA/390 architecture
mfused-madd
Target Report Mask(FUSED_MADD)
Enable fused multiply/add instructions
mhard-dfp
Target Report Mask(HARD_DFP)
Enable decimal floating point hardware support