Blame SOURCES/gcc34-pr16104.patch

6693b3
2005-01-13  Jakub Jelinek  <jakub@redhat.com>
6693b3
6693b3
	PR rtl-optimization/16104
6693b3
	* expr.c (convert_move): Handle vector from resp. to if mode
6693b3
	sizes differ.
6693b3
6693b3
	* gcc.c-torture/execute/20050113-1.c: New test.
6693b3
6693b3
--- gcc/expr.c.jj	2004-12-27 21:31:08.000000000 +0100
6693b3
+++ gcc/expr.c	2005-01-13 15:56:31.229253647 +0100
6693b3
@@ -590,7 +590,26 @@ convert_move (rtx to, rtx from, int unsi
6693b3
   if (VECTOR_MODE_P (to_mode) || VECTOR_MODE_P (from_mode))
6693b3
     {
6693b3
       if (GET_MODE_BITSIZE (from_mode) != GET_MODE_BITSIZE (to_mode))
6693b3
-	abort ();
6693b3
+        {
6693b3
+          if (VECTOR_MODE_P (from_mode))
6693b3
+            {
6693b3
+              enum machine_mode new_mode;
6693b3
+
6693b3
+              new_mode = mode_for_size (GET_MODE_BITSIZE (from_mode),
6693b3
+                                        MODE_INT, 0);
6693b3
+              from = simplify_gen_subreg (new_mode, from, from_mode, 0);
6693b3
+            }
6693b3
+          if (VECTOR_MODE_P (to_mode))
6693b3
+            {
6693b3
+              enum machine_mode new_mode;
6693b3
+
6693b3
+              new_mode = mode_for_size (GET_MODE_BITSIZE (to_mode),
6693b3
+                                        MODE_INT, 0);
6693b3
+              to = simplify_gen_subreg (new_mode, to, to_mode, 0);
6693b3
+            }
6693b3
+          convert_move (to, from, unsignedp);
6693b3
+          return;
6693b3
+        }
6693b3
 
6693b3
       if (VECTOR_MODE_P (to_mode))
6693b3
 	from = simplify_gen_subreg (to_mode, from, GET_MODE (from), 0);
6693b3
--- gcc/testsuite/gcc.c-torture/execute/20050113-1.c.jj	2005-01-13 15:51:09.194383356 +0100
6693b3
+++ gcc/testsuite/gcc.c-torture/execute/20050113-1.c	2005-01-13 15:37:22.000000000 +0100
6693b3
@@ -0,0 +1,56 @@
6693b3
+/* PR rtl-optimization/16104 */
6693b3
+
6693b3
+extern void abort (void);
6693b3
+
6693b3
+typedef int V2SI __attribute__ ((vector_size (8)));
6693b3
+typedef short V2HI __attribute__ ((vector_size (4)));
6693b3
+
6693b3
+int
6693b3
+test1 (void)
6693b3
+{
6693b3
+  return (long long) (V2SI) 0LL;
6693b3
+}
6693b3
+
6693b3
+int
6693b3
+test2 (V2SI x)
6693b3
+{
6693b3
+  return (long long) x;
6693b3
+}
6693b3
+
6693b3
+V2SI
6693b3
+test3 (void)
6693b3
+{
6693b3
+  return (V2SI) (long long) (int) (V2HI) 0;
6693b3
+}
6693b3
+
6693b3
+V2SI
6693b3
+test4 (V2HI x)
6693b3
+{
6693b3
+  return (V2SI) (long long) (int) x;
6693b3
+}
6693b3
+
6693b3
+int
6693b3
+main (void)
6693b3
+{
6693b3
+  if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
6693b3
+    return 0;
6693b3
+
6693b3
+  if (test1 () != 0)
6693b3
+    abort ();
6693b3
+
6693b3
+  V2SI x = { 2, 2 };
6693b3
+  if (test2 (x) != 2)
6693b3
+    abort ();
6693b3
+
6693b3
+  union { V2SI x; int y[2]; } u;
6693b3
+  u.x = test3 ();
6693b3
+  if (u.y[0] != 0 || u.y[1] != 0)
6693b3
+    abort ();
6693b3
+
6693b3
+  V2HI y = { 4, 4 };
6693b3
+  union { V2SI x; long long y; } v;
6693b3
+  v.x = test4 (y);
6693b3
+  if (v.y != 0x40004)
6693b3
+    abort ();
6693b3
+  return 0;
6693b3
+}