Patchwork [i386] : Introduce *<sse>_maskcmp<mode>3_comm to handle commutative compares

login
register
mail settings
Submitter Uros Bizjak
Date May 25, 2011, 7:54 p.m.
Message ID <BANLkTikddF=MXRjs5U3Yn5UfQhkvCB9QKA@mail.gmail.com>
Download mbox | patch
Permalink /patch/97409/
State New
Headers show

Comments

Uros Bizjak - May 25, 2011, 7:54 p.m.
Hello!

Some SSE "maskcmp" compares are commutative, so we can use % operand
modifier in these cases.  The patched gcc generates one movaps less
for the testcase of PR49133.

2011-05-25  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/sse.md (*<sse>_maskcmp<mode>3_comm): New pattern.

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

Uros.

Patch

Index: sse.md
===================================================================
--- sse.md	(revision 174219)
+++ sse.md	(working copy)
@@ -1184,6 +1184,22 @@ 
    (set_attr "prefix" "vex")
    (set_attr "mode" "<ssescalarmode>")])
 
+(define_insn "*<sse>_maskcmp<mode>3_comm"
+  [(set (match_operand:VF 0 "register_operand" "=x,x")
+	(match_operator:VF 3 "sse_comparison_operator"
+	  [(match_operand:VF 1 "register_operand" "%0,x")
+	   (match_operand:VF 2 "nonimmediate_operand" "xm,xm")]))]
+  "TARGET_SSE
+   && GET_RTX_CLASS (GET_CODE (operands[3])) == RTX_COMM_COMPARE"
+  "@
+   cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
+   vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
+  [(set_attr "isa" "noavx,avx")
+   (set_attr "type" "ssecmp")
+   (set_attr "length_immediate" "1")
+   (set_attr "prefix" "orig,vex")
+   (set_attr "mode" "<MODE>")])
+
 (define_insn "<sse>_maskcmp<mode>3"
   [(set (match_operand:VF 0 "register_operand" "=x,x")
 	(match_operator:VF 3 "sse_comparison_operator"