This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [x86] do not issue invalid vec_select from V2DI


On Jan  6, 2006, Richard Henderson <rth@redhat.com> wrote:

> On Fri, Jan 06, 2006 at 02:01:13AM -0200, Alexandre Oliva wrote:

>> +(define_insn "*vec_extractv2di_sse2"
>> +  [(set (match_operand:DI 0 "nonimmediate_operand" "=x,m,x")
>> +	(vec_select:DI
>> +	  (match_operand:V2DI 1 "nonimmediate_operand" "0,x,o")
>> +	  (parallel [(const_int 1)])))]
>> +  "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
>> +  "@
>> +   psrldq\t{$4, %0|%0, 4}
>> +   movhps\t{%1, %0|%0, %1}
>> +   movlps\t{%H1, %0|%0, %H1}"

> This last can be movq.

Aah, neat!  I thought movq was for 64-bit mode only.

> And the two patterns can be combined
> by using Y and x appropriately.

But then we risk using movhlps instead of copy and psrldq, no?  Is
this what you had in mind?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config/i386/sse.md (*vec_extractv2di_1): New.

Index: gcc/config/i386/sse.md
===================================================================
--- gcc/config/i386/sse.md.orig	2006-01-06 20:42:12.000000000 -0200
+++ gcc/config/i386/sse.md	2006-01-06 21:06:06.000000000 -0200
@@ -3464,6 +3464,20 @@
   operands[1] = gen_rtx_REG (DImode, REGNO (operands[1]));
 })
 
+(define_insn "*vec_extractv2di_1"
+  [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,x,m,x")
+	(vec_select:DI
+	  (match_operand:V2DI 1 "nonimmediate_operand" "0,x,x,o")
+	  (parallel [(const_int 1)])))]
+  "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
+  "@
+   psrldq\t{$4, %0|%0, 4}
+   movhlps\t{%1, %0|%0, %1}
+   movhps\t{%1, %0|%0, %1}
+   movq\t{%H1, %0|%0, %H1}"
+  [(set_attr "type" "sseishft,ssemov,ssemov,ssemov")
+   (set_attr "mode" "TI,V2SF,V4SF,TI")])
+
 (define_insn "*vec_dupv4si"
   [(set (match_operand:V4SI 0 "register_operand" "=Y,x")
 	(vec_duplicate:V4SI
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]