This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Committed] S/390: Disable load fp zero instruction


Hi,

the S/390 load zero instruction for floating point numbers causes a
performance penalty if the result is used in a binary floating point
operation (in contrast to hexfloat).  This renders the instruction
unusable for our back-end.

The attached patch disables the instruction increasing the performance
of several SpecFP testcases.

(Note: The patch doesn't remove the 'G' constraint for fp zeros since
I hope that we will be able to add back the instruction on some future
machine.)

Applied to 4.4, 4.5 and trunk.

@Jakub: Please merge into redhat GCC branch - thanks!

Bye,

-Andreas-


2010-06-02  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>

	* config/s390/2097.md (z10_fhex): Remove insn reservation.
	* config/s390/s390.md (UNSPEC_COPYSIGN): Remove unused constant.
	(*mov<mode>_64 TD_TF, *mov<mode>_31 TD_TF, *mov<mode>_64dfp DD_DF,
	*mov<mode>_64 DD_DF, *mov<mode>_31, mov<mode>): Remove load zero
	instruction.
	* config/s390/s390.c: Don't accept fp zeros as valid constants
	anymore.


Index: gcc/config/s390/2097.md
===================================================================
*** gcc/config/s390/2097.md.orig
--- gcc/config/s390/2097.md
***************
*** 466,480 ****
         (eq_attr "type" "fsimpdf,fmuldf"))
    "z10_e1_BOTH, z10_Gate_FP")
  
- ; LOAD ZERO produces a hex value but we need bin. Using the stage 7
- ; bypass causes an exception for format conversion which is very
- ; expensive. So, make sure subsequent instructions only get the zero
- ; in the normal way.
- (define_insn_reservation "z10_fhex" 12
-   (and (eq_attr "cpu" "z10")
-        (eq_attr "type" "fhex"))
-   "z10_e1_BOTH, z10_Gate_FP")
- 
  (define_insn_reservation "z10_fsimpsf" 6
    (and (eq_attr "cpu" "z10")
         (eq_attr "type" "fsimpsf,fmulsf"))
--- 466,471 ----
Index: gcc/config/s390/s390.md
===================================================================
*** gcc/config/s390/s390.md.orig
--- gcc/config/s390/s390.md
***************
*** 105,115 ****
     (UNSPEC_SP_SET 		700)
     (UNSPEC_SP_TEST		701)
  
-    ; Copy sign instructions
-    (UNSPEC_COPYSIGN             800)
- 
     ; Test Data Class (TDC)
!    (UNSPEC_TDC_INSN		900)
   ])
  
  ;;
--- 105,112 ----
     (UNSPEC_SP_SET 		700)
     (UNSPEC_SP_TEST		701)
  
     ; Test Data Class (TDC)
!    (UNSPEC_TDC_INSN		800)
   ])
  
  ;;
***************
*** 1931,1941 ****
    "")
  
  (define_insn "*mov<mode>_64"
!   [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,f,o, d,QS,  d,o")
!         (match_operand:TD_TF 1 "general_operand"      " G,f,o,f,QS, d,dRT,d"))]
    "TARGET_ZARCH"
    "@
-    lzxr\t%0
     lxr\t%0,%1
     #
     #
--- 1928,1937 ----
    "")
  
  (define_insn "*mov<mode>_64"
!   [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,o, d,QS,  d,o")
!         (match_operand:TD_TF 1 "general_operand"      " f,o,f,QS, d,dRT,d"))]
    "TARGET_ZARCH"
    "@
     lxr\t%0,%1
     #
     #
***************
*** 1943,1962 ****
     stmg\t%1,%N1,%S0
     #
     #"
!   [(set_attr "op_type" "RRE,RRE,*,*,RSY,RSY,*,*")
!    (set_attr "type"    "fhex,fsimptf,*,*,lm,stm,*,*")])
  
  (define_insn "*mov<mode>_31"
!   [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,f,o")
!         (match_operand:TD_TF 1 "general_operand"      " G,f,o,f"))]
    "!TARGET_ZARCH"
    "@
-    lzxr\t%0
     lxr\t%0,%1
     #
     #"
!   [(set_attr "op_type" "RRE,RRE,*,*")
!    (set_attr "type"    "fhex,fsimptf,*,*")])
  
  ; TFmode in GPRs splitters
  
--- 1939,1957 ----
     stmg\t%1,%N1,%S0
     #
     #"
!   [(set_attr "op_type" "RRE,*,*,RSY,RSY,*,*")
!    (set_attr "type"    "fsimptf,*,*,lm,stm,*,*")])
  
  (define_insn "*mov<mode>_31"
!   [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,o")
!         (match_operand:TD_TF 1 "general_operand"      " f,o,f"))]
    "!TARGET_ZARCH"
    "@
     lxr\t%0,%1
     #
     #"
!   [(set_attr "op_type" "RRE,*,*")
!    (set_attr "type"    "fsimptf,*,*")])
  
  ; TFmode in GPRs splitters
  
***************
*** 2047,2058 ****
  
  (define_insn "*mov<mode>_64dfp"
    [(set (match_operand:DD_DF 0 "nonimmediate_operand"
! 			       "=f,f,f,d,f,f,R,T,d, d,RT")
          (match_operand:DD_DF 1 "general_operand"
! 			       " G,f,d,f,R,T,f,f,d,RT, d"))]
    "TARGET_DFP"
    "@
-    lzdr\t%0
     ldr\t%0,%1
     ldgr\t%0,%1
     lgdr\t%0,%1
--- 2042,2052 ----
  
  (define_insn "*mov<mode>_64dfp"
    [(set (match_operand:DD_DF 0 "nonimmediate_operand"
! 			       "=f,f,d,f,f,R,T,d, d,RT")
          (match_operand:DD_DF 1 "general_operand"
! 			       " f,d,f,R,T,f,f,d,RT, d"))]
    "TARGET_DFP"
    "@
     ldr\t%0,%1
     ldgr\t%0,%1
     lgdr\t%0,%1
***************
*** 2063,2090 ****
     lgr\t%0,%1
     lg\t%0,%1
     stg\t%1,%0"
!   [(set_attr "op_type" "RRE,RR,RRE,RRE,RX,RXY,RX,RXY,RRE,RXY,RXY")
!    (set_attr "type" "fhex,floaddf,floaddf,floaddf,floaddf,floaddf,
                       fstoredf,fstoredf,lr,load,store")
!    (set_attr "z10prop" "*,
!                         *,
!                         *,
!                         *,
!                         *,
!                         *,
!                         *,
!                         *,
!                         z10_fr_E1,
!                         z10_fwd_A3,
!                         z10_rec")
  ])
  
  (define_insn "*mov<mode>_64"
!   [(set (match_operand:DD_DF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d, d,RT")
!         (match_operand:DD_DF 1 "general_operand"       "G,f,R,T,f,f,d,RT, d"))]
    "TARGET_ZARCH"
    "@
-    lzdr\t%0
     ldr\t%0,%1
     ld\t%0,%1
     ldy\t%0,%1
--- 2057,2073 ----
     lgr\t%0,%1
     lg\t%0,%1
     stg\t%1,%0"
!   [(set_attr "op_type" "RR,RRE,RRE,RX,RXY,RX,RXY,RRE,RXY,RXY")
!    (set_attr "type" "floaddf,floaddf,floaddf,floaddf,floaddf,
                       fstoredf,fstoredf,lr,load,store")
!    (set_attr "z10prop" "*,*,*,*,*,*,*,z10_fr_E1,z10_fwd_A3,z10_rec")
  ])
  
  (define_insn "*mov<mode>_64"
!   [(set (match_operand:DD_DF 0 "nonimmediate_operand" "=f,f,f,R,T,d, d,RT")
!         (match_operand:DD_DF 1 "general_operand"       "f,R,T,f,f,d,RT, d"))]
    "TARGET_ZARCH"
    "@
     ldr\t%0,%1
     ld\t%0,%1
     ldy\t%0,%1
***************
*** 2093,2119 ****
     lgr\t%0,%1
     lg\t%0,%1
     stg\t%1,%0"
!   [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RRE,RXY,RXY")
!    (set_attr "type" "fhex,fload<mode>,fload<mode>,fload<mode>,
                       fstore<mode>,fstore<mode>,lr,load,store")
!    (set_attr "z10prop" "*,
!                         *,
!                         *,
!                         *,
!                         *,
!                         *,
!                         z10_fr_E1,
!                         z10_fwd_A3,
!                         z10_rec")])
  
  (define_insn "*mov<mode>_31"
    [(set (match_operand:DD_DF 0 "nonimmediate_operand"
!                                "=f,f,f,f,R,T,d,d,Q,S,   d,o")
          (match_operand:DD_DF 1 "general_operand"
!                                " G,f,R,T,f,f,Q,S,d,d,dPRT,d"))]
    "!TARGET_ZARCH"
    "@
-    lzdr\t%0
     ldr\t%0,%1
     ld\t%0,%1
     ldy\t%0,%1
--- 2076,2093 ----
     lgr\t%0,%1
     lg\t%0,%1
     stg\t%1,%0"
!   [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY")
!    (set_attr "type" "fload<mode>,fload<mode>,fload<mode>,
                       fstore<mode>,fstore<mode>,lr,load,store")
!    (set_attr "z10prop" "*,*,*,*,*,*,z10_fr_E1,z10_fwd_A3,z10_rec")])
  
  (define_insn "*mov<mode>_31"
    [(set (match_operand:DD_DF 0 "nonimmediate_operand"
!                                "=f,f,f,R,T,d,d,Q,S,   d,o")
          (match_operand:DD_DF 1 "general_operand"
!                                " f,R,T,f,f,Q,S,d,d,dPRT,d"))]
    "!TARGET_ZARCH"
    "@
     ldr\t%0,%1
     ld\t%0,%1
     ldy\t%0,%1
***************
*** 2125,2132 ****
     stmy\t%1,%N1,%S0
     #
     #"
!   [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RS,RSY,RS,RSY,*,*")
!    (set_attr "type" "fhex,fload<mode>,fload<mode>,fload<mode>,
                       fstore<mode>,fstore<mode>,lm,lm,stm,stm,*,*")])
  
  (define_split
--- 2099,2106 ----
     stmy\t%1,%N1,%S0
     #
     #"
!   [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RS,RSY,RS,RSY,*,*")
!    (set_attr "type" "fload<mode>,fload<mode>,fload<mode>,
                       fstore<mode>,fstore<mode>,lm,lm,stm,stm,*,*")])
  
  (define_split
***************
*** 2176,2187 ****
  
  (define_insn "mov<mode>"
    [(set (match_operand:SD_SF 0 "nonimmediate_operand"
! 			       "=f,f,f,f,R,T,d,d,d,R,T")
          (match_operand:SD_SF 1 "general_operand"
! 			       " G,f,R,T,f,f,d,R,T,d,d"))]
    ""
    "@
-    lzer\t%0
     ler\t%0,%1
     le\t%0,%1
     ley\t%0,%1
--- 2150,2160 ----
  
  (define_insn "mov<mode>"
    [(set (match_operand:SD_SF 0 "nonimmediate_operand"
! 			       "=f,f,f,R,T,d,d,d,R,T")
          (match_operand:SD_SF 1 "general_operand"
! 			       " f,R,T,f,f,d,R,T,d,d"))]
    ""
    "@
     ler\t%0,%1
     le\t%0,%1
     ley\t%0,%1
***************
*** 2192,2211 ****
     ly\t%0,%1
     st\t%1,%0
     sty\t%1,%0"
!   [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY")
!    (set_attr "type" "fhex,fload<mode>,fload<mode>,fload<mode>,
                       fstore<mode>,fstore<mode>,lr,load,load,store,store")
!    (set_attr "z10prop" "*,
!                         *,
!                         *,
!                         *,
!                         *,
!                         *,
!                         z10_fr_E1,
!                         z10_fwd_A3,
!                         z10_fwd_A3,
!                         z10_rec,
!                         z10_rec")])
  
  ;
  ; movcc instruction pattern
--- 2165,2174 ----
     ly\t%0,%1
     st\t%1,%0
     sty\t%1,%0"
!   [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY")
!    (set_attr "type" "fload<mode>,fload<mode>,fload<mode>,
                       fstore<mode>,fstore<mode>,lr,load,load,store,store")
!    (set_attr "z10prop" "*,*,*,*,*,*,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec")])
  
  ;
  ; movcc instruction pattern
Index: gcc/config/s390/s390.c
===================================================================
*** gcc/config/s390/s390.c.orig
--- gcc/config/s390/s390.c
*************** legitimate_reload_constant_p (rtx op)
*** 2792,2802 ****
        && larl_operand (op, VOIDmode))
      return true;
  
-   /* Accept lzXX operands.  */
-   if (GET_CODE (op) == CONST_DOUBLE
-       && CONST_DOUBLE_OK_FOR_CONSTRAINT_P (op, 'G', "G"))
-     return true;
- 
    /* Accept double-word operands that can be split.  */
    if (GET_CODE (op) == CONST_INT
        && trunc_int_for_mode (INTVAL (op), word_mode) != INTVAL (op))
--- 2792,2797 ----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]