public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386]: Introduce *<sse>_maskcmp<mode>3_comm to handle commutative compares
@ 2011-05-25 21:15 Uros Bizjak
  0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2011-05-25 21:15 UTC (permalink / raw)
  To: gcc-patches

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

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.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 993 bytes --]

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"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-25 19:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-25 21:15 [PATCH, i386]: Introduce *<sse>_maskcmp<mode>3_comm to handle commutative compares Uros Bizjak

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).