diff mbox

[6/n,i386] : Merge *zero_extendsidi2_rex64 with base pattern using x64 and nox64 isa attribute

Message ID CAFULd4YuWT9M23e2odkNDT62_kJ5LC60pSSXDiRADf0Cq5yXQA@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak March 25, 2013, 6:12 p.m. UTC
Hello!

2013-03-25  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/i386.md (*zero_extendsidi2): Merge with
	*zero_extendsidi2_rex64.  Use x64 and nox64 isa attributes.
	* config/i386/predicates.md (x86_64_zext_operand): Rename from
	x86_64_zext_general_operand.  Use nonimmediate_operand on 32bit
	targets.  Clarify comment.

Tested on x86_64-pc-linux-gnu {,-m32} and committed to mainline SVN.

Uros.
diff mbox

Patch

Index: i386.md
===================================================================
--- i386.md	(revision 197053)
+++ i386.md	(working copy)
@@ -3135,13 +3135,13 @@ 
   [(set (match_operand:DI 0 "nonimmediate_operand")
 	(zero_extend:DI (match_operand:SI 1 "nonimmediate_operand")))])
 
-(define_insn "*zero_extendsidi2_rex64"
+(define_insn "*zero_extendsidi2"
   [(set (match_operand:DI 0 "nonimmediate_operand"
-			"=r  ,o,?*Ym,?*y,?*Yi,?*x")
+			"=r,?r,?o,r   ,o,?*Ym,?*y,?*Yi,?*x")
 	(zero_extend:DI
-	 (match_operand:SI 1 "x86_64_zext_general_operand"
-	        	"rmWz,0,r   ,m  ,r   ,m")))]
-  "TARGET_64BIT"
+	 (match_operand:SI 1 "x86_64_zext_operand"
+	        	"0 ,rm,r ,rmWz,0,r   ,m  ,r   ,m")))]
+  ""
 {
   switch (get_attr_type (insn))
     {
@@ -3164,30 +3164,40 @@ 
       gcc_unreachable ();
     }
 }
-  [(set_attr "type" "imovx,multi,mmxmov,mmxmov,ssemov,ssemov")
-   (set_attr "prefix" "orig,*,orig,orig,maybe_vex,maybe_vex")
-   (set_attr "prefix_0f" "0,*,*,*,*,*")
-   (set_attr "mode" "SI,SI,DI,DI,TI,TI")])
+  [(set (attr "isa")
+     (cond [(eq_attr "alternative" "0,1,2")
+	      (const_string "nox64")
+	    (eq_attr "alternative" "3")
+	      (const_string "x64")
+	    (eq_attr "alternative" "8")
+	      (const_string "sse2")
+	   ]
+	   (const_string "*")))
+   (set (attr "type")
+     (cond [(eq_attr "alternative" "0,1,2,4")
+	      (const_string "multi")
+	    (eq_attr "alternative" "5,6")
+	      (const_string "mmxmov")
+	    (eq_attr "alternative" "7,8")
+	      (const_string "ssemov")
+	   ]
+	   (const_string "imovx")))
+   (set (attr "prefix")
+     (if_then_else (eq_attr "type" "ssemov")
+       (const_string "maybe_vex")
+       (const_string "orig")))
+   (set (attr "prefix_0f")
+     (if_then_else (eq_attr "type" "imovx")
+       (const_string "0")
+       (const_string "*")))
+   (set (attr "mode")
+     (cond [(eq_attr "alternative" "5,6")
+	      (const_string "DI")
+	    (eq_attr "alternative" "7,8")
+	      (const_string "TI")
+	   ]
+	   (const_string "SI")))])
 
-(define_insn "*zero_extendsidi2"
-  [(set (match_operand:DI 0 "nonimmediate_operand"
-			"=ro,?r,?o,?*Ym,?*y,?*Yi,?*x")
-	(zero_extend:DI (match_operand:SI 1 "nonimmediate_operand"
-			"0  ,rm,r ,r   ,m  ,r   ,m")))]
-  "!TARGET_64BIT"
-  "@
-   #
-   #
-   #
-   movd\t{%1, %0|%0, %1}
-   movd\t{%1, %0|%0, %1}
-   %vmovd\t{%1, %0|%0, %1}
-   %vmovd\t{%1, %0|%0, %1}"
-  [(set_attr "isa" "*,*,*,*,*,*,sse2")
-   (set_attr "type" "multi,multi,multi,mmxmov,mmxmov,ssemov,ssemov")
-   (set_attr "prefix" "*,*,*,orig,orig,maybe_vex,maybe_vex")
-   (set_attr "mode" "SI,SI,SI,DI,DI,TI,TI")])
-
 (define_split
   [(set (match_operand:DI 0 "memory_operand")
      	(zero_extend:DI (match_operand:SI 1 "memory_operand")))]
Index: predicates.md
===================================================================
--- predicates.md	(revision 197053)
+++ predicates.md	(working copy)
@@ -311,15 +311,15 @@ 
 	 (match_operand 0 "x86_64_immediate_operand"))
     (match_operand 0 "general_operand")))
 
-;; Return true if OP is general operand representable on x86_64
-;; as zero extended constant.  This predicate is used in zero-extending
-;; conversion operations that require non-VOIDmode immediate operands.
-(define_predicate "x86_64_zext_general_operand"
+;; Return true if OP is representable on x86_64 as zero-extended operand.
+;; This predicate is used in zero-extending conversion operations that
+;; require non-VOIDmode immediate operands.
+(define_predicate "x86_64_zext_operand"
   (if_then_else (match_test "TARGET_64BIT")
     (ior (match_operand 0 "nonimmediate_operand")
 	 (and (match_operand 0 "x86_64_zext_immediate_operand")
 	      (match_test "GET_MODE (op) != VOIDmode")))
-    (match_operand 0 "general_operand")))
+    (match_operand 0 "nonimmediate_operand")))
 
 ;; Return true if OP is general operand representable on x86_64
 ;; as either sign extended or zero extended constant.