diff mbox

[i386] : Split *avx_<maxmin:code><mode>3

Message ID AANLkTimZ+HNV+TmzBotQ53sj2VU7zxAgOeW591fKP+DE@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Sept. 28, 2010, 6:17 a.m. UTC
Hello!

IMO, it is not possible for humans to determine the logic from current
pattern how prefix_extra is calculated.  Attached patch splits the
pattern in two and also removes maxmin code iterator that is used only
for this pattern.

2010-09-28  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/sse.md (*avx_<umaxmin:code><mode>3):
	Split from *avx_<maxmin:code><mode>3.
	(*avx_<smaxmin:code><mode>3): Ditto.
	* config/i386/i386.md (maxmin): Remove code iterator.

Tested on x86_64-pc-linux-gnu, committed to mainline SVN.

Uros.
diff mbox

Patch

Index: i386.md
===================================================================
--- i386.md	(revision 164643)
+++ i386.md	(working copy)
@@ -712,9 +712,6 @@ 
 ;; Mapping of unsigned max and min
 (define_code_iterator umaxmin [umax umin])
 
-;; Mapping of signed/unsigned max and min
-(define_code_iterator maxmin [smax smin umax umin])
-
 ;; Base name for integer and FP insn mnemonic
 (define_code_attr maxmin_int [(smax "maxs") (smin "mins")
 			      (umax "maxu") (umin "minu")])
Index: sse.md
===================================================================
--- sse.md	(revision 164643)
+++ sse.md	(working copy)
@@ -6031,18 +6031,16 @@ 
 
 (define_insn "*avx_<code><mode>3"
   [(set (match_operand:SSEMODE124 0 "register_operand" "=x")
-	(maxmin:SSEMODE124
+	(umaxmin:SSEMODE124
 	  (match_operand:SSEMODE124 1 "nonimmediate_operand" "%x")
 	  (match_operand:SSEMODE124 2 "nonimmediate_operand" "xm")))]
   "TARGET_AVX && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
   "vp<maxmin_int><ssevecsize>\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "sseiadd")
    (set (attr "prefix_extra")
-     (if_then_else
-       (ne (symbol_ref "<MODE>mode != ((<CODE> == SMAX || <CODE> == SMIN) ? V8HImode : V16QImode)")
-	   (const_int 0))
-       (const_string "1")
-       (const_string "0")))
+     (if_then_else (match_operand:V16QI 0 "" "")
+       (const_string "0")
+       (const_string "1")))
    (set_attr "prefix" "vex")
    (set_attr "mode" "TI")])
 
@@ -6065,6 +6063,21 @@ 
    (set_attr "prefix_data16" "1")
    (set_attr "mode" "TI")])
 
+(define_insn "*avx_<code><mode>3"
+  [(set (match_operand:SSEMODE124 0 "register_operand" "=x")
+	(smaxmin:SSEMODE124
+	  (match_operand:SSEMODE124 1 "nonimmediate_operand" "%x")
+	  (match_operand:SSEMODE124 2 "nonimmediate_operand" "xm")))]
+  "TARGET_AVX && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
+  "vp<maxmin_int><ssevecsize>\t{%2, %1, %0|%0, %1, %2}"
+  [(set_attr "type" "sseiadd")
+   (set (attr "prefix_extra")
+     (if_then_else (match_operand:V8HI 0 "" "")
+       (const_string "0")
+       (const_string "1")))
+   (set_attr "prefix" "vex")
+   (set_attr "mode" "TI")])
+
 (define_expand "<code>v8hi3"
   [(set (match_operand:V8HI 0 "register_operand" "")
 	(smaxmin:V8HI
@@ -6917,7 +6930,7 @@ 
 }
   [(set_attr "type" "sselog")
    (set (attr "prefix_extra")
-     (if_then_else (match_operand:V8HI 0 "register_operand" "")
+     (if_then_else (match_operand:V8HI 0 "" "")
        (const_string "0")
        (const_string "1")))
    (set_attr "length_immediate" "1")