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]

[PATCH] Fix PR target/14343


Hi,

The compiler ICEs on

int main() 
{ 
    typedef int v __attribute__ ((mode(V2DI))); 
    v a, b; 
    a = b; 
    return 0; 
} 

with

vti.cc: In function `int main()': 
vti.cc:7: error: unrecognizable insn: 
(insn 25 3 26 0 (set (reg:V2DI 70 [ b ]) 
        (mem/f:V2DI (symbol_ref:SI ("b") [flags 0x2] <var_decl 0x404fa3cc b>) 
[0 b+0 S16 A128])) -1 (nil) 
    (nil)) 
vti.cc:7: internal compiler error: in extract_insn, at recog.c:2083

when compiled with -march=pentium3 but not -march=pentium4, a regression 
present on mainline and 3.4 branch.


As you have probably already guessed, this is the classical mismatch between 
an expander and its insn:

(define_expand "movv2di"
  [(set (match_operand:V2DI 0 "nonimmediate_operand" "")
	(match_operand:V2DI 1 "nonimmediate_operand" ""))]
  "TARGET_SSE"
{
  ix86_expand_vector_move (V2DImode, operands);
  DONE;
})

(define_insn "movv2di_internal"
  [(set (match_operand:V2DI 0 "nonimmediate_operand" "=x,x,m")
	(match_operand:V2DI 1 "vector_move_operand" "C,xm,x"))]
  "TARGET_SSE2"
{
  switch (which_alternative)
    {
    case 0:
      if (get_attr_mode (insn) == MODE_V4SF)
	return "xorps\t%0, %0";
      else
	return "pxor\t%0, %0";
    case 1:
    case 2:
      if (get_attr_mode (insn) == MODE_V4SF)
	return "movaps\t{%1, %0|%0, %1}";
      else
	return "movdqa\t{%1, %0|%0, %1}";
    default:
      abort ();
    }
}

So the obvious fix would be to remove the "2" above.  However, unless I'm 
mistaken, it seems to me that the i386 back-end is a little confused about 
SSE vs SSE2 because, according to my manual, 'movaps' is SSE while 'movdqa' 
is SSE2.  Or is there a mechanism to guarantee that the mode insn will 
always be MODE_V4SF for !TARGET_SSE2 ?


2004-03-03  Eric Botcazou  <ebotcazou@libertysurf.fr>

	PR target/14343
	* config/i386/i386.md (movv2di_internal): Conditionalize on
	TARGET_SSE, not TARGET_SSE2.


2004-03-03  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* gcc.dg/i386-sse-8.c: New test.


-- 
Eric Botcazou
Index: config/i386/i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.502.2.2
diff -u -r1.502.2.2 i386.md
--- config/i386/i386.md	24 Feb 2004 00:23:04 -0000	1.502.2.2
+++ config/i386/i386.md	3 Mar 2004 09:41:39 -0000
@@ -18481,7 +18481,7 @@
 (define_insn "movv2di_internal"
   [(set (match_operand:V2DI 0 "nonimmediate_operand" "=x,x,m")
 	(match_operand:V2DI 1 "vector_move_operand" "C,xm,x"))]
-  "TARGET_SSE2"
+  "TARGET_SSE"
 {
   switch (which_alternative)
     {
/* PR target/14313 */
/* Origin: <Pawe Sikora <pluto@ds14.agh.edu.pl> */

/* { dg-do compile } */
/* { dg-options "-march=pentium3" { target i?86-*-* x86_64-*-* } } */

int main() 
{ 
  typedef int v __attribute__ ((mode(V2DI))); 
  v a, b; 
  a = b; 
  return 0; 
}

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