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