diff mbox series

[committed] i386: Use int_nonimmediate_operand more

Message ID CAFULd4Z+55utQuS5=up53+Q-+Zq0=-Vj_kkgP1sJR3weRmJ-bw@mail.gmail.com
State New
Headers show
Series [committed] i386: Use int_nonimmediate_operand more | expand

Commit Message

Uros Bizjak May 5, 2020, 9:36 a.m. UTC
Pattern explosing and manual mode checks can be avoided by using
int_nonimmediate_operand special predicate.

While there, rewrite *x86_mov<SWI48:mode>cc_0_m1_neg_leu<SWI:mode>
to a combine pass splitter.

2020-05-05  Uroš Bizjak  <ubizjak@gmail.com>

    * config/i386/i386.md (*testqi_ext_3): Use
    int_nonimmediate_operand instead of manual mode checks.
    (*x86_mov<SWI48:mode>cc_0_m1_neg_leu<SWI:mode>):
    Use int_nonimmediate_operand predicate.  Rewrite
    define_insn_and_split pattern to a combine pass splitter.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Committed to mainline.

Uros.
diff mbox series

Patch

diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 76c00867231..5cad481fd9f 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -8714,16 +8714,12 @@ 
   [(set (match_operand 0 "flags_reg_operand")
         (match_operator 1 "compare_operator"
 	  [(zero_extract:SWI248
-	     (match_operand 2 "nonimmediate_operand" "rm")
+	     (match_operand 2 "int_nonimmediate_operand" "rm")
 	     (match_operand 3 "const_int_operand" "n")
 	     (match_operand 4 "const_int_operand" "n"))
 	   (const_int 0)]))]
-  "((TARGET_64BIT && GET_MODE (operands[2]) == DImode)
-    || GET_MODE (operands[2]) == SImode
-    || GET_MODE (operands[2]) == HImode
-    || GET_MODE (operands[2]) == QImode)
-   /* Ensure that resulting mask is zero or sign extended operand.  */
-   && INTVAL (operands[4]) >= 0
+  "/* Ensure that resulting mask is zero or sign extended operand.  */
+   INTVAL (operands[4]) >= 0
    && ((INTVAL (operands[3]) > 0
 	&& INTVAL (operands[3]) + INTVAL (operands[4]) <= 32)
        || (<MODE>mode == DImode
@@ -18038,18 +18034,15 @@ 
    (set_attr "mode" "<MODE>")
    (set_attr "length_immediate" "0")])
 
-(define_insn_and_split "*x86_mov<SWI48:mode>cc_0_m1_neg_leu<SWI:mode>"
-  [(set (match_operand:SWI48 0 "register_operand" "=r")
+(define_split
+  [(set (match_operand:SWI48 0 "register_operand")
 	(neg:SWI48
 	  (leu:SWI48
-	    (match_operand:SWI 1 "nonimmediate_operand" "<SWI:r>m")
-	    (match_operand:SWI 2 "<SWI:immediate_operand>" "<SWI:i>"))))
-   (clobber (reg:CC FLAGS_REG))]
-  "CONST_INT_P (operands[2])
+	    (match_operand 1 "int_nonimmediate_operand")
+	    (match_operand 2 "const_int_operand"))))]
+  "x86_64_immediate_operand (operands[2], VOIDmode)
    && INTVAL (operands[2]) != -1
    && INTVAL (operands[2]) != 2147483647"
-  "#"
-  ""
   [(set (reg:CC FLAGS_REG) (compare:CC (match_dup 1) (match_dup 2)))
    (parallel [(set (match_dup 0)
 		   (neg:SWI48 (ltu:SWI48 (reg:CC FLAGS_REG) (const_int 0))))