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]

[s390] macros patch 1/11


Hi,

This patch introduces macros to s390.md. It is the first of a series of 11
patches. It deals with the compare, test & set, and sethigh patterns.


2005-05-09  Adrian Straetling  <straetling@de.ibm.com>

	* config/s390/s390.md: ("HQI"): New mode macro.
	("icm_lo", "icm_hi", "max_uint"): New mode attributes.
	("*tmhi_full", "*tmqi_full"): Merge.
	("*tsthiCCT", "*tstqiCCT"): Merge.
	("*tsthi", "*tstqi"): Merge.
	("*tsthi_cconly", "tstqi_cconly"): Merge.
	("*sethighhisi", "*sethighqisi"): Merge.
	 

Index: gcc/config/s390/s390.md
===================================================================
*** gcc/config/s390/s390.md.orig	2005-05-04 14:10:19.131486453 +0200
--- gcc/config/s390/s390.md	2005-05-04 14:17:04.521486453 +0200
***************
*** 232,237 ****
--- 232,257 ----
  ;; Predicates
  (include "predicates.md")
  
+ 
+ ;; Macros
+ 
+ ;; This mode macro allows the QI and HI patterns to be defined from
+ ;; the same template.
+ (define_mode_macro HQI [HI QI])
+ 
+ 
+ ;; ICM mask required to load MODE value into the highest subreg
+ ;; of a SImode register.
+ (define_mode_attr icm_hi [(HI "12") (QI "8")])
+ 
+ ;; ICM mask required to load MODE value into the lowest subreg
+ ;; of a SImode register.
+ (define_mode_attr icm_lo [(HI "3") (QI "1")])
+ 
+ ;; Maximum unsigned integer that fits in MODE.
+ (define_mode_attr max_uint [(HI "65535") (QI "255")])
+ 
+ 
  ;;
  ;;- Compare instructions.
  ;;
***************
*** 322,341 ****
     tml\t%0,%i1"
    [(set_attr "op_type" "RI")])
  
! (define_insn "*tmhi_full"
!   [(set (reg 33)
!         (compare (match_operand:HI 0 "register_operand" "d")
!                  (match_operand:HI 1 "immediate_operand" "n")))]
!   "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))"
!   "tml\t%0,65535"
!   [(set_attr "op_type" "RI")])
! 
! (define_insn "*tmqi_full"
    [(set (reg 33)
!         (compare (match_operand:QI 0 "register_operand" "d")
!                  (match_operand:QI 1 "immediate_operand" "n")))]
    "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))"
!   "tml\t%0,255"
    [(set_attr "op_type" "RI")])
  
  
--- 342,353 ----
     tml\t%0,%i1"
    [(set_attr "op_type" "RI")])
  
! (define_insn "*tm<mode>_full"
    [(set (reg 33)
!         (compare (match_operand:HQI 0 "register_operand" "d")
!                  (match_operand:HQI 1 "immediate_operand" "n")))]
    "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))"
!   "tml\t%0,<max_uint>"
    [(set_attr "op_type" "RI")])
  
  
***************
*** 413,429 ****
    "ltr\t%0,%0"
    [(set_attr "op_type" "RR")])
  
! (define_insn "*tsthiCCT"
    [(set (reg 33)
!         (compare (match_operand:HI 0 "nonimmediate_operand" "?Q,?S,d")
!                  (match_operand:HI 1 "const0_operand" "")))
!    (set (match_operand:HI 2 "register_operand" "=d,d,0")
          (match_dup 0))]
    "s390_match_ccmode(insn, CCTmode)"
    "@
!    icm\t%2,3,%S0
!    icmy\t%2,3,%S0
!    tml\t%0,65535"
    [(set_attr "op_type" "RS,RSY,RI")])
  
  (define_insn "*tsthiCCT_cconly"
--- 425,441 ----
    "ltr\t%0,%0"
    [(set_attr "op_type" "RR")])
  
! (define_insn "*tst<mode>CCT"
    [(set (reg 33)
!         (compare (match_operand:HQI 0 "nonimmediate_operand" "?Q,?S,d")
!                  (match_operand:HQI 1 "const0_operand" "")))
!    (set (match_operand:HQI 2 "register_operand" "=d,d,0")
          (match_dup 0))]
    "s390_match_ccmode(insn, CCTmode)"
    "@
!    icm\t%2,<icm_lo>,%S0
!    icmy\t%2,<icm_lo>,%S0
!    tml\t%0,<max_uint>"
    [(set_attr "op_type" "RS,RSY,RI")])
  
  (define_insn "*tsthiCCT_cconly"
***************
*** 438,479 ****
     tml\t%0,65535"
    [(set_attr "op_type" "RS,RSY,RI")])
  
- (define_insn "*tsthi"
-   [(set (reg 33)
-         (compare (match_operand:HI 0 "s_operand" "Q,S")
-                  (match_operand:HI 1 "const0_operand" "")))
-    (set (match_operand:HI 2 "register_operand" "=d,d")
-         (match_dup 0))]
-   "s390_match_ccmode(insn, CCSmode)"
-   "@
-    icm\t%2,3,%S0
-    icmy\t%2,3,%S0"
-   [(set_attr "op_type" "RS,RSY")])
- 
- (define_insn "*tsthi_cconly"
-   [(set (reg 33)
-         (compare (match_operand:HI 0 "s_operand" "Q,S")
-                  (match_operand:HI 1 "const0_operand" "")))
-    (clobber (match_scratch:HI 2 "=d,d"))]
-   "s390_match_ccmode(insn, CCSmode)"
-   "@
-    icm\t%2,3,%S0
-    icmy\t%2,3,%S0"
-   [(set_attr "op_type" "RS,RSY")])
- 
- (define_insn "*tstqiCCT"
-   [(set (reg 33)
-         (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
-                  (match_operand:QI 1 "const0_operand" "")))
-    (set (match_operand:QI 2 "register_operand" "=d,d,0")
-         (match_dup 0))]
-   "s390_match_ccmode(insn, CCTmode)"
-   "@
-    icm\t%2,1,%S0
-    icmy\t%2,1,%S0
-    tml\t%0,255"
-   [(set_attr "op_type" "RS,RSY,RI")])
- 
  (define_insn "*tstqiCCT_cconly"
    [(set (reg 33)
          (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
--- 450,455 ----
***************
*** 485,511 ****
     tml\t%0,255"
    [(set_attr "op_type" "SI,SIY,RI")])
  
! (define_insn "*tstqi"
    [(set (reg 33)
!         (compare (match_operand:QI 0 "s_operand" "Q,S")
!                  (match_operand:QI 1 "const0_operand" "")))
!    (set (match_operand:QI 2 "register_operand" "=d,d")
          (match_dup 0))]
    "s390_match_ccmode(insn, CCSmode)"
    "@
!    icm\t%2,1,%S0
!    icmy\t%2,1,%S0"
    [(set_attr "op_type" "RS,RSY")])
  
! (define_insn "*tstqi_cconly"
    [(set (reg 33)
!         (compare (match_operand:QI 0 "s_operand" "Q,S")
!                  (match_operand:QI 1 "const0_operand" "")))
!    (clobber (match_scratch:QI 2 "=d,d"))]
    "s390_match_ccmode(insn, CCSmode)"
    "@
!    icm\t%2,1,%S0
!    icmy\t%2,1,%S0"
    [(set_attr "op_type" "RS,RSY")])
  
  
--- 461,487 ----
     tml\t%0,255"
    [(set_attr "op_type" "SI,SIY,RI")])
  
! (define_insn "*tst<mode>"
    [(set (reg 33)
!         (compare (match_operand:HQI 0 "s_operand" "Q,S")
!                  (match_operand:HQI 1 "const0_operand" "")))
!    (set (match_operand:HQI 2 "register_operand" "=d,d")
          (match_dup 0))]
    "s390_match_ccmode(insn, CCSmode)"
    "@
!    icm\t%2,<icm_lo>,%S0
!    icmy\t%2,<icm_lo>,%S0"
    [(set_attr "op_type" "RS,RSY")])
  
! (define_insn "*tst<mode>_cconly"
    [(set (reg 33)
!         (compare (match_operand:HQI 0 "s_operand" "Q,S")
!                  (match_operand:HQI 1 "const0_operand" "")))
!    (clobber (match_scratch:HQI 2 "=d,d"))]
    "s390_match_ccmode(insn, CCSmode)"
    "@
!    icm\t%2,<icm_lo>,%S0
!    icmy\t%2,<icm_lo>,%S0"
    [(set_attr "op_type" "RS,RSY")])
  
  
***************
*** 2338,2361 ****
  ;;- Conversion instructions.
  ;;
  
- (define_insn "*sethighqisi"
-   [(set (match_operand:SI 0 "register_operand" "=d,d")
-         (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
-    (clobber (reg:CC 33))]
-   ""
-   "@
-    icm\t%0,8,%S1
-    icmy\t%0,8,%S1"
-   [(set_attr "op_type" "RS,RSY")])
  
! (define_insn "*sethighhisi"
    [(set (match_operand:SI 0 "register_operand" "=d,d")
!         (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
     (clobber (reg:CC 33))]
    ""
    "@
!    icm\t%0,12,%S1
!    icmy\t%0,12,%S1"
    [(set_attr "op_type" "RS,RSY")])
  
  (define_insn "*sethighqidi_64"
--- 2314,2328 ----
  ;;- Conversion instructions.
  ;;
  
  
! (define_insn "*sethigh<mode>si"
    [(set (match_operand:SI 0 "register_operand" "=d,d")
!         (unspec:SI [(match_operand:HQI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
     (clobber (reg:CC 33))]
    ""
    "@
!    icm\t%0,<icm_hi>,%S1
!    icmy\t%0,<icm_hi>,%S1"
    [(set_attr "op_type" "RS,RSY")])
  
  (define_insn "*sethighqidi_64"
Index: gcc/config/s390/.s390.md.swp
===================================================================
Binary files gcc/config/s390/.s390.md.swp.orig	2005-05-04 14:16:14.501486453 +0200 and gcc/config/s390/.s390.md.swp	2005-05-04 14:17:08.521486453 +0200 differ


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