OSDN Git Service

s390: -mfused-madd cleanup
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Nov 2010 23:24:53 +0000 (23:24 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Nov 2010 23:24:53 +0000 (23:24 +0000)
        * 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166838 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config.gcc
gcc/config/s390/s390.c
gcc/config/s390/s390.md
gcc/config/s390/s390.opt

index 6f6da07..a9b8f76 100644 (file)
@@ -1,5 +1,14 @@
 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.
        * config/rs6000/rs6000.opt (mfused-madd): Remove.
        * config/rs6000/altivec.md (altivec_vmaddfp): Remove.
index 0202a22..c6a2d4c 100644 (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-*-*)
index 11ca919..2c40b67 100644 (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
index ce8c3ce..701fca1 100644 (file)
    (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"
    (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"
index 9451b74..57ab838 100644 (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