public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] s390: Split CCSmode into CCSINT and CCSFP
@ 2022-01-20 16:13 Robin Dapp
  2022-01-21  8:28 ` Andreas Krebbel
  0 siblings, 1 reply; 2+ messages in thread
From: Robin Dapp @ 2022-01-20 16:13 UTC (permalink / raw)
  To: GCC Patches, Andreas Krebbel

[-- Attachment #1: Type: text/plain, Size: 754 bytes --]

Hi,

this patch splits the CCSmode into an integer and a floating point
variant.  This allows ifcvt to consider floating point compares which
would be rejected before because they could not be reversed.

Bootstrapped and regtested on s390x.

Is it OK?

Regards
 Robin

--

gcc/ChangeLog:

	* config/s390/predicates.md: Add CCSINTmode and CCSFPmode.
	* config/s390/s390-modes.def (UNORDERED): Likewise.
	(CC_MODE): Likewise.
	* config/s390/s390.cc (s390_cc_modes_compatible): Likewise.
	(s390_match_ccmode_set): Likewise.
	(s390_select_ccmode): Likewise.
	(s390_branch_condition_mask): Likewise.
	(s390_reverse_condition): Likewise.
	* config/s390/s390.h (REVERSIBLE_CC_MODE): Likewise.
	* config/s390/s390.md: Likewise.
	* config/s390/subst.md: Likewise.

[-- Attachment #2: s390-split-ccsmode.patch --]
[-- Type: text/x-patch, Size: 19672 bytes --]

commit d3d4f8486340ff889de0dd709262f31953c54eda
Author: Robin Dapp <rdapp@linux.ibm.com>
Date:   Fri Jul 23 11:13:39 2021 +0200

    s390: Split CCSmode in CCSINT and CCSFP.
    
    In order to be able to reverse condition codes, CCSmode needs to be
    split into CCSINT and CCSFP modes.
    
    Subsequently, we can add CCSFPmode to REVERSIBLE_CC_MODE.

diff --git a/gcc/config/s390/predicates.md b/gcc/config/s390/predicates.md
index 33194d3f3d6..ec47416cc1b 100644
--- a/gcc/config/s390/predicates.md
+++ b/gcc/config/s390/predicates.md
@@ -325,7 +325,8 @@
     case E_CCURmode:
       return GET_CODE (op) == LTU;
 
-    case E_CCSmode:
+    case E_CCSINTmode:
+    case E_CCSFPmode:
       return GET_CODE (op) == UNGT;
 
     case E_CCSRmode:
@@ -370,7 +371,8 @@
     case E_CCURmode:
       return GET_CODE (op) == GEU;
 
-    case E_CCSmode:
+    case E_CCSINTmode:
+    case E_CCSFPmode:
       return GET_CODE (op) == LE;
 
     case E_CCSRmode:
diff --git a/gcc/config/s390/s390-modes.def b/gcc/config/s390/s390-modes.def
index b419907960e..eafe1e12938 100644
--- a/gcc/config/s390/s390-modes.def
+++ b/gcc/config/s390/s390-modes.def
@@ -48,12 +48,12 @@ CCUR: EQ          GTU          LTU         NE         (CLGF/R)
 
 Signed compares
 
-CCS:  EQ          LT           GT          UNORDERED  (LTGFR, LTGR, LTR, ICM/Y,
-                                                       LTDBR, LTDR, LTEBR, LTER,
+CCSINT: EQ        LT           GT          UNORDERED  (LTGFR, LTGR, LTR, ICM/Y,
                                                        CG/R, C/R/Y, CGHI, CHI,
-                                                       CDB/R, CD/R, CEB/R, CE/R,
-                                                       ADB/R, AEB/R, SDB/R, SEB/R,
                                                        SRAG, SRA, SRDA)
+CCSFP:  EQ        LT           GT          UNORDERED  (CDB/R, CD/R, CEB/R, CE/R,
+                                                       LTDBR, LTDR, LTEBR, LTER,
+                                                       ADB/R, AEB/R, SDB/R, SEB/R)
 CCSR: EQ          GT           LT          UNORDERED  (CGF/R, CH/Y)
 CCSFPS: EQ        LT           GT          UNORDERED  (KEB/R, KDB/R, KXBR, KDTR,
 						       KXTR, WFK)
@@ -234,7 +234,8 @@ CC_MODE (CCL2);
 CC_MODE (CCL3);
 CC_MODE (CCU);
 CC_MODE (CCUR);
-CC_MODE (CCS);
+CC_MODE (CCSINT);
+CC_MODE (CCSFP);
 CC_MODE (CCSR);
 CC_MODE (CCSFPS);
 CC_MODE (CCT);
diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index f2e4474df99..0a93b4b39f4 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -1378,11 +1378,13 @@ s390_cc_modes_compatible (machine_mode m1, machine_mode m2)
     {
     case E_CCZmode:
       if (m2 == CCUmode || m2 == CCTmode || m2 == CCZ1mode
-	  || m2 == CCSmode || m2 == CCSRmode || m2 == CCURmode)
+	  || m2 == CCSINTmode || m2 == CCSFPmode
+	  || m2 == CCSRmode || m2 == CCURmode)
 	return m2;
       return VOIDmode;
 
-    case E_CCSmode:
+    case E_CCSINTmode:
+    case E_CCSFPmode:
     case E_CCUmode:
     case E_CCTmode:
     case E_CCSRmode:
@@ -1422,7 +1424,8 @@ s390_match_ccmode_set (rtx set, machine_mode req_mode)
   switch (set_mode)
     {
     case E_CCZ1mode:
-    case E_CCSmode:
+    case E_CCSINTmode:
+    case E_CCSFPmode:
     case E_CCSRmode:
     case E_CCSFPSmode:
     case E_CCUmode:
@@ -1445,7 +1448,8 @@ s390_match_ccmode_set (rtx set, machine_mode req_mode)
       break;
 
     case E_CCZmode:
-      if (req_mode != CCSmode && req_mode != CCUmode && req_mode != CCTmode
+      if (req_mode != CCSINTmode && req_mode != CCSFPmode
+	  && req_mode != CCUmode && req_mode != CCTmode
 	  && req_mode != CCSRmode && req_mode != CCURmode
 	  && req_mode != CCZ1mode)
 	return 0;
@@ -1625,7 +1629,12 @@ s390_select_ccmode (enum rtx_code code, rtx op0, rtx op1)
 	if ((GET_CODE (op0) == SIGN_EXTEND || GET_CODE (op0) == ZERO_EXTEND)
 	    && GET_CODE (op1) != CONST_INT)
 	  return CCSRmode;
-	return CCSmode;
+	if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_FLOAT
+	    || GET_MODE_CLASS (GET_MODE (op0)) == MODE_DECIMAL_FLOAT)
+	  return CCSFPmode;
+	else
+	  return CCSINTmode;
+	break;
 
       case LTU:
       case GEU:
@@ -2139,7 +2148,8 @@ s390_branch_condition_mask (rtx code)
 	}
       break;
 
-    case E_CCSmode:
+    case E_CCSINTmode:
+    case E_CCSFPmode:
     case E_CCSFPSmode:
       switch (GET_CODE (code))
 	{
@@ -6805,9 +6815,10 @@ s390_reverse_condition (machine_mode mode, enum rtx_code code)
 {
   /* Reversal of FP compares takes care -- an ordered compare
      becomes an unordered compare and vice versa.  */
-  if (mode == CCVFALLmode || mode == CCVFANYmode || mode == CCSFPSmode)
+  if (mode == CCVFALLmode || mode == CCVFANYmode || mode == CCSFPmode
+      || mode == CCSFPSmode)
     return reverse_condition_maybe_unordered (code);
-  else if (mode == CCVIALLmode || mode == CCVIANYmode)
+  else if (mode == CCVIALLmode || mode == CCVIANYmode || mode == CCSINTmode)
     return reverse_condition (code);
   else
     gcc_unreachable ();
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index 5a64048a5a1..590853e97a9 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -530,7 +530,9 @@ extern const char *s390_host_detect_local_cpu (int argc, const char **argv);
    FIXME: It might make sense to do this for other cc modes as well.  */
 #define REVERSIBLE_CC_MODE(MODE)				\
   ((MODE) == CCVIALLmode || (MODE) == CCVIANYmode		\
-   || (MODE) == CCVFALLmode || (MODE) == CCVFANYmode)
+   || (MODE) == CCVFALLmode || (MODE) == CCVFANYmode		\
+   || (MODE) == CCSFPmode || (MODE) == CCSINTmode		\
+   || (MODE) == CCSFPSmode)
 
 /* Given a condition code and a mode, return the inverse condition.  */
 #define REVERSE_CONDITION(CODE, MODE) s390_reverse_condition (MODE, CODE)
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 5eee8e86b42..73b983db300 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -975,7 +975,7 @@
 	  (match_operand:DI 1 "const0_operand" "")))
    (set (match_operand:DI 2 "register_operand" "=d,d")
         (sign_extend:DI (match_dup 0)))]
-  "s390_match_ccmode(insn, CCSmode) && TARGET_ZARCH"
+  "s390_match_ccmode(insn, CCSINTmode) && TARGET_ZARCH"
   "ltgfr\t%2,%0
    ltgf\t%2,%0"
   [(set_attr "op_type"      "RRE,RXY")
@@ -989,7 +989,7 @@
                  (match_operand:GPR 1 "const0_operand" "")))
    (set (match_operand:GPR 2 "register_operand" "=d,d")
         (match_dup 0))]
-  "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
+  "s390_match_ccmode(insn, CCSINTmode) && TARGET_EXTIMM"
   "@
    lt<g>r\t%2,%0
    lt<g>\t%2,%0"
@@ -1003,13 +1003,13 @@
 	(match_operand:GPR 2 "memory_operand"))
    (set (reg CC_REGNUM)
 	(compare (match_dup 0) (match_operand:GPR 1 "const0_operand")))]
-  "s390_match_ccmode (peep2_next_insn (1), CCSmode) && TARGET_EXTIMM
+  "s390_match_ccmode (peep2_next_insn (1), CCSINTmode) && TARGET_EXTIMM
    && GENERAL_REG_P (operands[0])
    && satisfies_constraint_T (operands[2])
    && !contains_constant_pool_address_p (operands[2])"
   [(parallel
-    [(set (reg:CCS CC_REGNUM)
-	  (compare:CCS (match_dup 2) (match_dup 1)))
+    [(set (reg:CCSINT CC_REGNUM)
+	  (compare:CCSINT (match_dup 2) (match_dup 1)))
      (set (match_dup 0) (match_dup 2))])])
 
 ; ltr, lt, ltgr, ltg
@@ -1018,7 +1018,7 @@
         (compare (match_operand:GPR 0 "nonimmediate_operand" "d,T")
                  (match_operand:GPR 1 "const0_operand" "")))
    (clobber (match_scratch:GPR 2 "=X,d"))]
-  "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
+  "s390_match_ccmode(insn, CCSINTmode) && TARGET_EXTIMM"
   "@
    lt<g>r\t%0,%0
    lt<g>\t%2,%0"
@@ -1031,7 +1031,7 @@
                  (match_operand:DI 1 "const0_operand" "")))
    (set (match_operand:DI 2 "register_operand" "=d")
         (match_dup 0))]
-  "s390_match_ccmode(insn, CCSmode) && TARGET_ZARCH && !TARGET_EXTIMM"
+  "s390_match_ccmode(insn, CCSINTmode) && TARGET_ZARCH && !TARGET_EXTIMM"
   "ltgr\t%2,%0"
   [(set_attr "op_type" "RRE")
    (set_attr "z10prop" "z10_fr_E1")])
@@ -1042,7 +1042,7 @@
                  (match_operand:SI 1 "const0_operand" "")))
    (set (match_operand:SI 2 "register_operand" "=d,d,d")
         (match_dup 0))]
-  "s390_match_ccmode(insn, CCSmode) && !TARGET_EXTIMM"
+  "s390_match_ccmode(insn, CCSINTmode) && !TARGET_EXTIMM"
   "@
    ltr\t%2,%0
    icm\t%2,15,%S0
@@ -1056,7 +1056,7 @@
         (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
                  (match_operand:SI 1 "const0_operand" "")))
    (clobber (match_scratch:SI 2 "=X,d,d"))]
-  "s390_match_ccmode(insn, CCSmode)"
+  "s390_match_ccmode(insn, CCSINTmode)"
   "@
    ltr\t%0,%0
    icm\t%2,15,%S0
@@ -1069,7 +1069,7 @@
   [(set (reg CC_REGNUM)
         (compare (match_operand:DI 0 "register_operand" "d")
                  (match_operand:DI 1 "const0_operand" "")))]
-  "s390_match_ccmode(insn, CCSmode) && !TARGET_ZARCH"
+  "s390_match_ccmode(insn, CCSINTmode) && !TARGET_ZARCH"
   "srda\t%0,0"
   [(set_attr "op_type" "RS")
    (set_attr "atype"   "reg")])
@@ -1079,7 +1079,7 @@
   [(set (reg CC_REGNUM)
         (compare (match_operand:GPR 0 "register_operand" "d")
                  (match_operand:GPR 1 "const0_operand" "")))]
-  "s390_match_ccmode(insn, CCSmode)"
+  "s390_match_ccmode(insn, CCSINTmode)"
   "lt<g>r\t%0,%0"
   [(set_attr "op_type" "RR<E>")
    (set_attr "z10prop" "z10_fr_E1")])
@@ -1134,7 +1134,7 @@
                  (match_operand:HQI 1 "const0_operand" "")))
    (set (match_operand:HQI 2 "register_operand" "=d,d")
         (match_dup 0))]
-  "s390_match_ccmode(insn, CCSmode)"
+  "s390_match_ccmode(insn, CCSINTmode)"
   "@
    icm\t%2,<icm_lo>,%S0
    icmy\t%2,<icm_lo>,%S0"
@@ -1147,7 +1147,7 @@
         (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)"
+  "s390_match_ccmode(insn, CCSINTmode)"
   "@
    icm\t%2,<icm_lo>,%S0
    icmy\t%2,<icm_lo>,%S0"
@@ -1226,7 +1226,7 @@
   [(set (reg CC_REGNUM)
         (compare (match_operand:HI 0 "s_operand"         "Q")
                  (match_operand:HI 1 "immediate_operand" "K")))]
-  "s390_match_ccmode(insn, CCSmode) && TARGET_Z10"
+  "s390_match_ccmode(insn, CCSINTmode) && TARGET_Z10"
   "chhsi\t%0,%1"
   [(set_attr "op_type" "SIL")
    (set_attr "z196prop" "z196_cracked")])
@@ -1250,7 +1250,7 @@
                                       "d,d,Q, d,d,d,d")
                  (match_operand:GPR 1 "general_operand"
                                       "d,K,K,Os,R,T,b")))]
-  "s390_match_ccmode(insn, CCSmode)"
+  "s390_match_ccmode(insn, CCSINTmode)"
   "@
    c<g>r\t%0,%1
    c<g>hi\t%0,%h1
@@ -1462,7 +1462,7 @@
   [(set (reg CC_REGNUM)
 	(compare (match_operand:FP 0 "register_operand" "f")
 		 (match_operand:FP 1 "const0_operand")))]
-  "s390_match_ccmode (insn, CCSmode)
+  "s390_match_ccmode (insn, CCSFPmode)
    && TARGET_HARD_FLOAT
    && !flag_trapping_math
    && !flag_signaling_nans"
@@ -1476,7 +1476,7 @@
   [(set (reg CC_REGNUM)
         (compare (match_operand:FP 0 "register_operand" "f,f,v,v")
                  (match_operand:FP 1 "general_operand"  "f,R,v,v")))]
-  "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT"
+  "s390_match_ccmode(insn, CCSFPmode) && TARGET_HARD_FLOAT"
   "@
    c<xde><bt>r\t%0,%1
    c<xde>b\t%0,%1
@@ -1491,7 +1491,7 @@
   [(set (reg CC_REGNUM)
 	(compare (match_operand:TF 0 "register_operand" "v")
                  (match_operand:TF 1 "register_operand" "v")))]
-  "s390_match_ccmode(insn, CCSmode) && TARGET_VXE"
+  "s390_match_ccmode(insn, CCSFPmode) && TARGET_VXE"
   "wfcxb\t%0,%1"
   [(set_attr "op_type" "VRR")
    (set_attr "cpu_facility" "vxe")])
@@ -3932,7 +3932,7 @@
                  (const_int 0)))
    (set (match_operand:SI 0 "register_operand" "=d")
         (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT))]
-  "s390_match_ccmode (insn, CCSmode)"
+  "s390_match_ccmode (insn, CCSINTmode)"
   "#"
   "&& reload_completed"
   [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
@@ -3967,7 +3967,7 @@
                  (const_int 0)))
    (set (match_operand:DI 0 "register_operand" "=d")
         (sign_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT)))]
-  "s390_match_ccmode (insn, CCSmode) && TARGET_ZARCH"
+  "s390_match_ccmode (insn, CCSINTmode) && TARGET_ZARCH"
   "#"
   "&& reload_completed"
   [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
@@ -4260,7 +4260,7 @@
    (set (match_operand:DI 0 "nonimmediate_operand" "=d,d")
 	(ior:DI (and:DI (match_dup 1) (match_dup 2))
 		 (and:DI (match_dup 3) (match_dup 4))))]
-  "TARGET_Z10 && s390_match_ccmode (insn, CCSmode)
+  "TARGET_Z10 && s390_match_ccmode (insn, CCSINTmode)
    && INTVAL (operands[2]) == ~INTVAL (operands[4])"
   "@
    risbg\t%0,%1,%s2,%e2,0
@@ -4279,7 +4279,7 @@
 	       (match_operand:DI 4 "const_int_operand" "")))
      (const_int 0)))
   (clobber (match_scratch:DI 0 "=d,d"))]
-  "TARGET_Z10 && s390_match_ccmode (insn, CCSmode)
+  "TARGET_Z10 && s390_match_ccmode (insn, CCSINTmode)
    && INTVAL (operands[2]) == ~INTVAL (operands[4])"
   "@
    risbg\t%0,%1,%s2,%e2,0
@@ -6225,7 +6225,7 @@
 		 (match_operand:FP 3 "const0_operand" "")))
    (set (match_operand:FP 0 "register_operand" "=f,f,f")
 	(plus:FP (match_dup 1) (match_dup 2)))]
-  "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
+  "s390_match_ccmode (insn, CCSFPmode) && TARGET_HARD_FLOAT"
   "@
    a<xde>tr\t%0,%1,%2
    a<xde>br\t%0,%2
@@ -6241,7 +6241,7 @@
 			  (match_operand:FP 2 "general_operand"       "f,f,R"))
 		 (match_operand:FP 3 "const0_operand" "")))
    (clobber (match_scratch:FP 0 "=f,f,f"))]
-  "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
+  "s390_match_ccmode (insn, CCSFPmode) && TARGET_HARD_FLOAT"
   "@
    a<xde>tr\t%0,%1,%2
    a<xde>br\t%0,%2
@@ -6670,7 +6670,7 @@
 		 (match_operand:FP 3 "const0_operand" "")))
    (set (match_operand:FP 0 "register_operand" "=f,f,f")
 	(minus:FP (match_dup 1) (match_dup 2)))]
-  "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
+  "s390_match_ccmode (insn, CCSFPmode) && TARGET_HARD_FLOAT"
   "@
    s<xde>tr\t%0,%1,%2
    s<xde>br\t%0,%2
@@ -6686,7 +6686,7 @@
 			   (match_operand:FP 2 "general_operand"      "f,f,R"))
 		 (match_operand:FP 3 "const0_operand" "")))
    (clobber (match_scratch:FP 0 "=f,f,f"))]
-  "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
+  "s390_match_ccmode (insn, CCSFPmode) && TARGET_HARD_FLOAT"
   "@
    s<xde>tr\t%0,%1,%2
    s<xde>br\t%0,%2
@@ -8877,7 +8877,7 @@
                  (match_operand:BFP 2 "const0_operand" "")))
    (set (match_operand:BFP 0 "register_operand" "=f")
         (neg:BFP (match_dup 1)))]
-  "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
+  "s390_match_ccmode (insn, CCSFPmode) && TARGET_HARD_FLOAT"
   "lc<xde>br\t%0,%1"
   [(set_attr "op_type"  "RRE")
    (set_attr "type"     "fsimp<type>")])
@@ -8888,7 +8888,7 @@
         (compare (neg:BFP (match_operand:BFP 1 "register_operand" "f"))
                  (match_operand:BFP 2 "const0_operand" "")))
    (clobber (match_scratch:BFP 0 "=f"))]
-  "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
+  "s390_match_ccmode (insn, CCSFPmode) && TARGET_HARD_FLOAT"
   "lc<xde>br\t%0,%1"
   [(set_attr "op_type"  "RRE")
    (set_attr "type"     "fsimp<type>")])
@@ -9002,7 +9002,7 @@
                  (match_operand:BFP 2 "const0_operand" "")))
    (set (match_operand:BFP 0 "register_operand" "=f")
         (abs:BFP (match_dup 1)))]
-  "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
+  "s390_match_ccmode (insn, CCSFPmode) && TARGET_HARD_FLOAT"
   "lp<xde>br\t%0,%1"
   [(set_attr "op_type"  "RRE")
    (set_attr "type"     "fsimp<type>")])
@@ -9013,7 +9013,7 @@
         (compare (abs:BFP (match_operand:BFP 1 "register_operand" "f"))
                  (match_operand:BFP 2 "const0_operand" "")))
    (clobber (match_scratch:BFP 0 "=f"))]
-  "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
+  "s390_match_ccmode (insn, CCSFPmode) && TARGET_HARD_FLOAT"
   "lp<xde>br\t%0,%1"
   [(set_attr "op_type"  "RRE")
    (set_attr "type"     "fsimp<type>")])
@@ -9118,7 +9118,7 @@
                  (match_operand:BFP 2 "const0_operand" "")))
    (set (match_operand:BFP 0 "register_operand" "=f")
         (neg:BFP (abs:BFP (match_dup 1))))]
-  "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
+  "s390_match_ccmode (insn, CCSFPmode) && TARGET_HARD_FLOAT"
   "ln<xde>br\t%0,%1"
   [(set_attr "op_type"  "RRE")
    (set_attr "type"     "fsimp<type>")])
@@ -9129,7 +9129,7 @@
         (compare (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
                  (match_operand:BFP 2 "const0_operand" "")))
    (clobber (match_scratch:BFP 0 "=f"))]
-  "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
+  "s390_match_ccmode (insn, CCSFPmode) && TARGET_HARD_FLOAT"
   "ln<xde>br\t%0,%1"
   [(set_attr "op_type"  "RRE")
    (set_attr "type"     "fsimp<type>")])
@@ -9681,9 +9681,9 @@
   [(set (match_dup 4) (match_dup 1))
    (parallel [(set (match_dup 4) (plus:DI (match_dup 4) (subreg:DI (match_dup 2) 0)))
 	      (clobber (reg:CC CC_REGNUM))])
-   (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:DI (match_dup 2) 8)))
+   (set (reg:CCSINT CC_REGNUM) (compare:CCSINT (match_dup 4) (subreg:DI (match_dup 2) 8)))
    (set (match_dup 3) (match_dup 4))
-   (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
+   (set (pc) (if_then_else (match_op_dup 5 [(reg:CCSINT CC_REGNUM) (const_int 0)])
 			   (label_ref (match_dup 0))
 			   (pc)))]
   ""
@@ -9724,9 +9724,9 @@
   [(set (match_dup 4) (match_dup 1))
    (parallel [(set (match_dup 4) (plus:SI (match_dup 4) (subreg:SI (match_dup 2) 4)))
 	      (clobber (reg:CC CC_REGNUM))])
-   (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:SI (match_dup 2) 12)))
+   (set (reg:CCSINT CC_REGNUM) (compare:CCSINT (match_dup 4) (subreg:SI (match_dup 2) 12)))
    (set (match_dup 3) (match_dup 4))
-   (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
+   (set (pc) (if_then_else (match_op_dup 5 [(reg:CCSINT CC_REGNUM) (const_int 0)])
 			   (label_ref (match_dup 0))
 			   (pc)))]
   ""
@@ -9767,9 +9767,9 @@
   [(set (match_dup 4) (match_dup 1))
    (parallel [(set (match_dup 4) (plus:SI (match_dup 4) (subreg:SI (match_dup 2) 0)))
 	      (clobber (reg:CC CC_REGNUM))])
-   (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:SI (match_dup 2) 4)))
+   (set (reg:CCSINT CC_REGNUM) (compare:CCSINT (match_dup 4) (subreg:SI (match_dup 2) 4)))
    (set (match_dup 3) (match_dup 4))
-   (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
+   (set (pc) (if_then_else (match_op_dup 5 [(reg:CCSINT CC_REGNUM) (const_int 0)])
 			   (label_ref (match_dup 0))
 			   (pc)))]
   ""
diff --git a/gcc/config/s390/subst.md b/gcc/config/s390/subst.md
index 1ab704305a8..e55311bd4d7 100644
--- a/gcc/config/s390/subst.md
+++ b/gcc/config/s390/subst.md
@@ -28,7 +28,7 @@
   [(set (match_operand:DSI 0 ""           "")
         (match_operand:DSI 1 "" ""))
    (clobber (reg:CC CC_REGNUM))]
-  "s390_match_ccmode(insn, CCSmode)"
+  "s390_match_ccmode(insn, CCSINTmode)"
   [(set (reg CC_REGNUM)
 	(compare (match_dup 1) (const_int 0)))
    (set (match_dup 0) (match_dup 1))])
@@ -42,7 +42,7 @@
   [(set (match_operand:DSI 0 ""           "")
         (match_operand:DSI 1 "" ""))
    (clobber (reg:CC CC_REGNUM))]
-  "s390_match_ccmode(insn, CCSmode)"
+  "s390_match_ccmode(insn, CCSINTmode)"
   [(set (reg CC_REGNUM)
 	(compare (match_dup 1) (const_int 0)))
    (clobber (match_scratch:DSI 0 "=d"))])

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] s390: Split CCSmode into CCSINT and CCSFP
  2022-01-20 16:13 [PATCH] s390: Split CCSmode into CCSINT and CCSFP Robin Dapp
@ 2022-01-21  8:28 ` Andreas Krebbel
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Krebbel @ 2022-01-21  8:28 UTC (permalink / raw)
  To: Robin Dapp, GCC Patches

On 1/20/22 17:13, Robin Dapp wrote:
> Hi,
> 
> this patch splits the CCSmode into an integer and a floating point
> variant.  This allows ifcvt to consider floating point compares which
> would be rejected before because they could not be reversed.
> 
> Bootstrapped and regtested on s390x.
> 
> Is it OK?
> 
> Regards
>  Robin
> 
> --
> 
> gcc/ChangeLog:
> 
> 	* config/s390/predicates.md: Add CCSINTmode and CCSFPmode.
> 	* config/s390/s390-modes.def (UNORDERED): Likewise.
> 	(CC_MODE): Likewise.
> 	* config/s390/s390.cc (s390_cc_modes_compatible): Likewise.
> 	(s390_match_ccmode_set): Likewise.
> 	(s390_select_ccmode): Likewise.
> 	(s390_branch_condition_mask): Likewise.
> 	(s390_reverse_condition): Likewise.
> 	* config/s390/s390.h (REVERSIBLE_CC_MODE): Likewise.
> 	* config/s390/s390.md: Likewise.
> 	* config/s390/subst.md: Likewise.

> diff --git a/gcc/config/s390/predicates.md b/gcc/config/s390/predicates.md
> index 33194d3f3d6..ec47416cc1b 100644
> --- a/gcc/config/s390/predicates.md
> +++ b/gcc/config/s390/predicates.md
> @@ -325,7 +325,8 @@
>      case E_CCURmode:
>        return GET_CODE (op) == LTU;
>
> -    case E_CCSmode:
> +    case E_CCSINTmode:
> +    case E_CCSFPmode:
>        return GET_CODE (op) == UNGT;

Can we get an UNGT for CCSINTmode here? Shouldn't this be just GT?

>
>      case E_CCSRmode:
> @@ -370,7 +371,8 @@
>      case E_CCURmode:
>        return GET_CODE (op) == GEU;
>
> -    case E_CCSmode:
> +    case E_CCSINTmode:
> +    case E_CCSFPmode:
>        return GET_CODE (op) == LE;
>
>      case E_CCSRmode:
> diff --git a/gcc/config/s390/s390-modes.def b/gcc/config/s390/s390-modes.def
> index b419907960e..eafe1e12938 100644
> --- a/gcc/config/s390/s390-modes.def
> +++ b/gcc/config/s390/s390-modes.def
> @@ -48,12 +48,12 @@ CCUR: EQ          GTU          LTU         NE         (CLGF/R)
>
>  Signed compares
>
> -CCS:  EQ          LT           GT          UNORDERED  (LTGFR, LTGR, LTR, ICM/Y,
> -                                                       LTDBR, LTDR, LTEBR, LTER,
> +CCSINT: EQ        LT           GT          UNORDERED  (LTGFR, LTGR, LTR, ICM/Y,

CC3 for signed integer compares should not occur. So perhaps '-' instead of UNORDERED?

>                                                         CG/R, C/R/Y, CGHI, CHI,
> -                                                       CDB/R, CD/R, CEB/R, CE/R,
> -                                                       ADB/R, AEB/R, SDB/R, SEB/R,
>                                                         SRAG, SRA, SRDA)
> +CCSFP:  EQ        LT           GT          UNORDERED  (CDB/R, CD/R, CEB/R, CE/R,
> +                                                       LTDBR, LTDR, LTEBR, LTER,
> +                                                       ADB/R, AEB/R, SDB/R, SEB/R)
>  CCSR: EQ          GT           LT          UNORDERED  (CGF/R, CH/Y)
>  CCSFPS: EQ        LT           GT          UNORDERED  (KEB/R, KDB/R, KXBR, KDTR,
>  						       KXTR, WFK)
...
> @@ -2139,7 +2148,8 @@ s390_branch_condition_mask (rtx code)
>  	}
>        break;
>
> -    case E_CCSmode:
> +    case E_CCSINTmode:
> +    case E_CCSFPmode:
>      case E_CCSFPSmode:
>        switch (GET_CODE (code))
>  	{

We will need a new switch statement for CCSINT without all the FP only comparison operators.

Andreas

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-21  8:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20 16:13 [PATCH] s390: Split CCSmode into CCSINT and CCSFP Robin Dapp
2022-01-21  8:28 ` Andreas Krebbel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).