[PATCH, i386]: Fix PR target/38931

Uros Bizjak ubizjak@gmail.com
Thu Jan 22 12:47:00 GMT 2009


Hello!

The problem was with the type of  *movsi_1 alternative 2 (and
*movdi_1_rex64 alternative 5) type. Gcc wants to analyze operand2,
which is nonexistent for "move-zero" instructions.

Attached patch changes type of these alternatives from mmxadd to mmx.

2009-01-22  Uros Bizjak  <ubizjak@gmail.com>

	PR target/38931
	* config/i386/i386.md (*movsi_1): Use type "mmx" for alternative 2.
	(*movdi_1_rex64): Use type "mmx" for alternative 5.

testsuite/ChangeLog:

2009-01-22  Uros Bizjak  <ubizjak@gmail.com>

	PR target/38931
	* gcc.target/i386/pr38931.c: New test.

Patch was bootstrapped and regression tested on i686-pc-linux-gnu,
committed to mainline.

Uros.
-------------- next part --------------
Index: testsuite/gcc.target/i386/pr38931.c
===================================================================
--- testsuite/gcc.target/i386/pr38931.c	(revision 0)
+++ testsuite/gcc.target/i386/pr38931.c	(revision 0)
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse" } */
+
+typedef int __m64 __attribute__ ((__vector_size__ (8)));
+
+extern __m64 foo () ;
+
+void bar (const int input_bpl, const unsigned char *input,
+	  unsigned char *output, unsigned long x1)
+{
+  unsigned char *pix_end_ptr = output + x1 * 4;
+  __m64 m_original = { 0, 0 };
+  __m64 m_base_addr = __builtin_ia32_vec_init_v2si (0, input_bpl);
+  __m64 m_addr = __builtin_ia32_paddd (m_original, m_base_addr);
+  __m64 *a0 = (__m64 *) input;
+
+  for (; output < pix_end_ptr; output += 4)
+    {
+      a0 = (__m64 *) (input + __builtin_ia32_vec_ext_v2si (m_addr, 0));
+      m_addr = foo ();
+      __builtin_prefetch (a0, 0);
+    }
+}
Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md	(revision 143562)
+++ config/i386/i386.md	(working copy)
@@ -1534,7 +1534,7 @@
 	  gcc_unreachable ();
 	}
 
-    case TYPE_MMXADD:
+    case TYPE_MMX:
       return "pxor\t%0, %0";
 
     case TYPE_MMXMOV:
@@ -1552,7 +1552,7 @@
 }
   [(set (attr "type")
      (cond [(eq_attr "alternative" "2")
-	      (const_string "mmxadd")
+	      (const_string "mmx")
 	    (eq_attr "alternative" "3,4,5")
 	      (const_string "mmxmov")
 	    (eq_attr "alternative" "6")
@@ -2370,7 +2370,7 @@
     case TYPE_SSELOG1:
       return "%vpxor\t%0, %d0";
 
-    case TYPE_MMXADD:
+    case TYPE_MMX:
       return "pxor\t%0, %0";
 
     case TYPE_MULTI:
@@ -2391,7 +2391,7 @@
 }
   [(set (attr "type")
      (cond [(eq_attr "alternative" "5")
-	      (const_string "mmxadd")
+	      (const_string "mmx")
 	    (eq_attr "alternative" "6,7,8,9,10")
 	      (const_string "mmxmov")
 	    (eq_attr "alternative" "11")


More information about the Gcc-patches mailing list