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]

S/390: Fix potential scheduling problem


Hello,

no two different define_insn_reservation statments are supposed to be
allowed to match the same insn.  This was violated by the current 2064
and 2084 automata descriptions.  Fixed by always including the "type"
attribute into the define_insn_reservation condition.  To simplify 
this, the type attribute now defaults depending on the op_type
attribute.  This patch also adds the x_branch and x_other reservations
to the AGI bypass definitions.

Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux,
applied to mainline.

Bye,
Ulrich


ChangeLog:

	* config/s390/2064.md ("z_int", "z_agen"): Ensure the condition
	matches no insns already matched by other reservations.
	* config/s390/2084.md ("x_int", "x_agen"): Ensure the condition
	matches no insns already matched by other reservations.
	("x_ss"): Remove, replace by ...
	("x_cs"): ... this new reservation.  Check type instead of op_type.
	Update bypasses to use x_cs instead of x_ss.
	("x_nn"): Remove, replace by ...
	("x_other"): ... this new reservation.  Check type instead of op_type.
	Add x_other and x_branch to bypasses.
	("x_vs"): New reservation.
	* config/s390/s390.md (attribute "type"): Default according to op_type.
	("*execute"): Set type to "cs".

Index: gcc/config/s390/2064.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/2064.md,v
retrieving revision 1.8
diff -c -p -r1.8 2064.md
*** gcc/config/s390/2064.md	6 Nov 2004 15:42:32 -0000	1.8
--- gcc/config/s390/2064.md	6 Nov 2004 16:06:00 -0000
***************
*** 72,93 ****
         (eq_attr "type" "jsr"))
    "z_e1*5,z_wr")
  
! ;
! ; Insn still not mentioned are check for
! ; the usage of the agen unit 
! ;
  
  (define_insn_reservation "z_int" 1
    (and (eq_attr "cpu" "z900,g5,g6")
!        (eq_attr "atype" "reg"))
    "z_e1,z_wr")
  
  (define_insn_reservation "z_agen" 1
    (and (eq_attr "cpu" "z900,g5,g6")
!        (eq_attr "atype" "agen"))
    "z_e1,z_wr")
  
- 
  ;;
  ;; s390_agen_dep_p returns 1, if a register is set in the 
  ;; first insn and used in the dependent insn to form a address.
--- 72,91 ----
         (eq_attr "type" "jsr"))
    "z_e1*5,z_wr")
  
! ;; For everything else we check the atype flag.
  
  (define_insn_reservation "z_int" 1
    (and (eq_attr "cpu" "z900,g5,g6")
!        (and (not (eq_attr "type" "la,larl,load,store,jsr"))
!             (eq_attr "atype" "reg")))
    "z_e1,z_wr")
  
  (define_insn_reservation "z_agen" 1
    (and (eq_attr "cpu" "z900,g5,g6")
!        (and (not (eq_attr "type" "la,larl,load,store,jsr"))
!             (eq_attr "atype" "agen")))
    "z_e1,z_wr")
  
  ;;
  ;; s390_agen_dep_p returns 1, if a register is set in the 
  ;; first insn and used in the dependent insn to form a address.
Index: gcc/config/s390/2084.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/2084.md,v
retrieving revision 1.4
diff -c -p -r1.4 2084.md
*** gcc/config/s390/2084.md	6 Nov 2004 15:42:32 -0000	1.4
--- gcc/config/s390/2084.md	6 Nov 2004 16:06:00 -0000
***************
*** 61,66 ****
--- 61,78 ----
  ;; Simple insns
  ;;
  
+ (define_insn_reservation "x_int" 1
+   (and (eq_attr "cpu" "z990")
+        (and (eq_attr "type" "integer")
+             (eq_attr "atype" "reg")))
+   "x-e1-st,x-wr-st")
+ 
+ (define_insn_reservation "x_agen" 1
+   (and (eq_attr "cpu" "z990")
+        (and (eq_attr "type" "integer")
+             (eq_attr "atype" "agen")))
+   "x-e1-st,x-wr-st")
+ 
  (define_insn_reservation "x_lr" 1
    (and (eq_attr "cpu" "z990")
         (eq_attr "type" "lr"))
***************
*** 100,110 ****
  ;; Multicycle insns
  ;;
  
! (define_insn_reservation "x_ss" 1 
    (and (eq_attr "cpu" "z990")
!        (eq_attr "op_type" "SS"))
    "x-e1-np,x-wr-np") 
  
  (define_insn_reservation "x_stm" 1 
    (and (eq_attr "cpu" "z990")
         (eq_attr "type" "stm"))
--- 112,127 ----
  ;; Multicycle insns
  ;;
  
! (define_insn_reservation "x_cs" 1 
    (and (eq_attr "cpu" "z990")
!        (eq_attr "type" "cs"))
    "x-e1-np,x-wr-np") 
  
+ (define_insn_reservation "x_vs" 1 
+   (and (eq_attr "cpu" "z990")
+        (eq_attr "type" "vs"))
+   "x-e1-np*10,x-wr-np") 
+ 
  (define_insn_reservation "x_stm" 1 
    (and (eq_attr "cpu" "z990")
         (eq_attr "type" "stm"))
***************
*** 115,123 ****
         (eq_attr "type" "lm"))
    "x-e1-np*10,x-wr-np") 
  
! (define_insn_reservation "x_nn" 1 
    (and (eq_attr "cpu" "z990")
!        (eq_attr "op_type" "NN"))
    "x-e1-np,x-wr-np") 
  
  ;;
--- 132,140 ----
         (eq_attr "type" "lm"))
    "x-e1-np*10,x-wr-np") 
  
! (define_insn_reservation "x_other" 1 
    (and (eq_attr "cpu" "z990")
!        (eq_attr "type" "other"))
    "x-e1-np,x-wr-np") 
  
  ;;
***************
*** 183,203 ****
  (define_bypass 1 "x_floads" "x_fsimps,x_fstores,x_floads")
  
  ;;
- ;; Insns still not mentioned are checked for
- ;; the usage of the agen unit 
- ;;
- 
- (define_insn_reservation "x_int" 1
-   (and (eq_attr "cpu" "z990")
-        (eq_attr "atype" "reg"))
-   "x-e1-st,x-wr-st") 
- 
- (define_insn_reservation "x_agen" 1
-   (and (eq_attr "cpu" "z990")
-        (eq_attr "atype" "agen"))
-   "x-e1-st+x-mem,x-wr-st") 
- 
- ;;
  ;; s390_agen_dep_p returns 1, if a register is set in the 
  ;; first insn and used in the dependent insn to form a address.
  ;;
--- 200,205 ----
***************
*** 208,214 ****
  ;; 
  
  (define_bypass 5 "x_int,x_agen,x_lr" 
!                  "x_agen,x_la,x_call,x_load,x_store,x_ss,x_stm,x_lm"
  	         "s390_agen_dep_p")
  
  (define_bypass 9 "x_int,x_agen,x_lr" 
--- 210,216 ----
  ;; 
  
  (define_bypass 5 "x_int,x_agen,x_lr" 
!                  "x_agen,x_la,x_branch,x_call,x_load,x_store,x_cs,x_stm,x_lm,x_other"
  	         "s390_agen_dep_p")
  
  (define_bypass 9 "x_int,x_agen,x_lr" 
***************
*** 221,227 ****
  ;;
  
  (define_bypass 4 "x_load"    
!                  "x_agen,x_la,x_call,x_load,x_store,x_ss,x_stm,x_lm"
  	         "s390_agen_dep_p")
  
  (define_bypass 5 "x_load"
--- 223,229 ----
  ;;
  
  (define_bypass 4 "x_load"    
!                  "x_agen,x_la,x_branch,x_call,x_load,x_store,x_cs,x_stm,x_lm,x_other"
  	         "s390_agen_dep_p")
  
  (define_bypass 5 "x_load"
***************
*** 235,241 ****
  ;;
  
  (define_bypass 3 "x_larl,x_la" 
!                  "x_agen,x_la,x_call,x_load,x_store,x_ss,x_stm,x_lm"
  	         "s390_agen_dep_p")
  
  (define_bypass 5 "x_larl, x_la"
--- 237,243 ----
  ;;
  
  (define_bypass 3 "x_larl,x_la" 
!                  "x_agen,x_la,x_branch,x_call,x_load,x_store,x_cs,x_stm,x_lm,x_other"
  	         "s390_agen_dep_p")
  
  (define_bypass 5 "x_larl, x_la"
Index: gcc/config/s390/s390.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.md,v
retrieving revision 1.141
diff -c -p -r1.141 s390.md
*** gcc/config/s390/s390.md	6 Nov 2004 15:42:32 -0000	1.141
--- gcc/config/s390/s390.md	6 Nov 2004 16:06:01 -0000
***************
*** 143,158 ****
    ])
  
  
! ;; Processor type.  This attribute must exactly match the processor_type
! ;; enumeration in s390.h.  The current machine description does not
! ;; distinguish between g5 and g6, but there are differences between the two
! ;; CPUs could in theory be modeled.
  
! (define_attr "cpu" "g5,g6,z900,z990"
!   (const (symbol_ref "s390_tune")))
  
! ;; Define an insn type attribute.  This is used in function unit delay
! ;; computations.
  
  (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
  	             cs,vs,store,imul,idiv,
--- 143,156 ----
    ])
  
  
! ;; Instruction operand type as used in the Principles of Operation.
! ;; Used to determine defaults for length and other attribute values.
  
! (define_attr "op_type"
!   "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY"
!   (const_string "RX"))
  
! ;; Instruction type attribute used for scheduling.
  
  (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
  	             cs,vs,store,imul,idiv,
***************
*** 161,177 ****
  		     fmuld,fmuls,fdivd,fdivs,
  		     ftoi,itof,fsqrtd,fsqrts,
                       other"
!   (const_string "integer"))
! 
! ;; Operand type. Used to default length attribute values
! 
! (define_attr "op_type"
!   "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY"
!   (const_string "RX"))
! 
! ;; Insn are devide in two classes:
! ;;   agen: Insn using agen
! ;;   reg: Insn not using agen
  
  (define_attr "atype" "agen,reg"
  (cond [ (eq_attr "op_type" "E")    (const_string "reg")
--- 159,171 ----
  		     fmuld,fmuls,fdivd,fdivs,
  		     ftoi,itof,fsqrtd,fsqrts,
                       other"
!   (cond [(eq_attr "op_type" "NN")  (const_string "other")
!          (eq_attr "op_type" "SS")  (const_string "cs")]
!     (const_string "integer")))
! 
! ;; Another attribute used for scheduling purposes:
! ;;   agen: Instruction uses the address generation unit
! ;;   reg: Instruction does not use the agen unit
  
  (define_attr "atype" "agen,reg"
  (cond [ (eq_attr "op_type" "E")    (const_string "reg")
***************
*** 193,205 ****
           (eq_attr "op_type" "SIY") (const_string "agen")]
    (const_string "reg")))
  
- ;; Pipeline description for z900.  For lack of anything better,
- ;; this description is also used for the g5 and g6.
- (include "2064.md")
- 
- ;; Pipeline description for z990. 
- (include "2084.md")
- 
  ;; Length in bytes.
  
  (define_attr "length" ""
--- 187,192 ----
***************
*** 227,232 ****
--- 214,236 ----
  (define_asm_attributes [(set_attr "type" "other")
                          (set_attr "op_type" "NN")])
  
+ 
+ ;; Processor type.  This attribute must exactly match the processor_type
+ ;; enumeration in s390.h.  The current machine description does not
+ ;; distinguish between g5 and g6, but there are differences between the two
+ ;; CPUs could in theory be modeled.
+ 
+ (define_attr "cpu" "g5,g6,z900,z990"
+   (const (symbol_ref "s390_tune")))
+ 
+ ;; Pipeline description for z900.  For lack of anything better,
+ ;; this description is also used for the g5 and g6.
+ (include "2064.md")
+ 
+ ;; Pipeline description for z990. 
+ (include "2084.md")
+ 
+ 
  ;;
  ;;  Condition Codes
  ;;
***************
*** 1760,1766 ****
    "GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
     && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
    "ex\t%1,%2"
!   [(set_attr "op_type" "RX")])
  
  
  ;
--- 1764,1771 ----
    "GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
     && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
    "ex\t%1,%2"
!   [(set_attr "op_type" "RX")
!    (set_attr "type" "cs")])
  
  
  ;
-- 
  Dr. Ulrich Weigand
  Linux on zSeries Development
  Ulrich.Weigand@de.ibm.com


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