]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/52407 (sse2 simd uint32_t and int64_t and stack variable initi...
authorRichard Guenther <rguenther@suse.de>
Tue, 22 May 2012 09:20:15 +0000 (09:20 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 22 May 2012 09:20:15 +0000 (09:20 +0000)
2012-05-22  Richard Guenther  <rguenther@suse.de>

        Backport from mainline
        2012-02-28  Richard Guenther  <rguenther@suse.de>

PR target/52407
* config/i386/i386.c (ix86_expand_vector_set): Fix element
ordering for the VEC_CONCAT for two element vectors for
V2SFmode, V2SImode and V2DImode.

* gcc.dg/torture/pr52407.c: New testcase.

From-SVN: r187763

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr52407.c [new file with mode: 0644]

index 2d96e00c1e929df87f5d0b5df697f15848df5ada..804d20f6826857bb2d4a2ed6254fb7c484ba5a2b 100644 (file)
@@ -1,3 +1,13 @@
+2012-05-22  Richard Guenther  <rguenther@suse.de>
+
+       Backport from mainline
+       2012-02-28  Richard Guenther  <rguenther@suse.de>
+
+       PR target/52407
+       * config/i386/i386.c (ix86_expand_vector_set): Fix element
+       ordering for the VEC_CONCAT for two element vectors for
+       V2SFmode, V2SImode and V2DImode.
+
 2012-05-22  Richard Guenther  <rguenther@suse.de>
 
        Backport from mainline
index 9e2d66cd9cac9587a4519bc0dc8b9bb9a8491d17..0b20d2c124296dd69dd1a16f1783a89ca263de52 100644 (file)
@@ -31430,9 +31430,9 @@ ix86_expand_vector_set (bool mmx_ok, rtx target, rtx val, int elt)
          tmp = gen_reg_rtx (GET_MODE_INNER (mode));
          ix86_expand_vector_extract (true, tmp, target, 1 - elt);
          if (elt == 0)
-           tmp = gen_rtx_VEC_CONCAT (mode, tmp, val);
-         else
            tmp = gen_rtx_VEC_CONCAT (mode, val, tmp);
+         else
+           tmp = gen_rtx_VEC_CONCAT (mode, tmp, val);
          emit_insn (gen_rtx_SET (VOIDmode, target, tmp));
          return;
        }
@@ -31446,9 +31446,9 @@ ix86_expand_vector_set (bool mmx_ok, rtx target, rtx val, int elt)
       tmp = gen_reg_rtx (GET_MODE_INNER (mode));
       ix86_expand_vector_extract (false, tmp, target, 1 - elt);
       if (elt == 0)
-       tmp = gen_rtx_VEC_CONCAT (mode, tmp, val);
-      else
        tmp = gen_rtx_VEC_CONCAT (mode, val, tmp);
+      else
+       tmp = gen_rtx_VEC_CONCAT (mode, tmp, val);
       emit_insn (gen_rtx_SET (VOIDmode, target, tmp));
       return;
 
index 710bcf6378f2e3ae05ce7a8dff0471eb36fe81c0..c553b926c2011e3cd6876621f85a6c2ea1854445 100644 (file)
@@ -1,3 +1,11 @@
+2012-05-22  Richard Guenther  <rguenther@suse.de>
+
+       Backport from mainline
+       2012-02-28  Richard Guenther  <rguenther@suse.de>
+
+       PR target/52407
+       * gcc.dg/torture/pr52407.c: New testcase.
+
 2012-05-22  Richard Guenther  <rguenther@suse.de>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.dg/torture/pr52407.c b/gcc/testsuite/gcc.dg/torture/pr52407.c
new file mode 100644 (file)
index 0000000..bb95e51
--- /dev/null
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+
+extern void abort (void);
+
+typedef long long T;
+typedef T vl_t __attribute__((vector_size(2 * sizeof (T))));
+
+vl_t   ul[4], vl[4] = { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } };
+
+static void
+mul_vl_l(vl_t *u, vl_t *v, T x, int m)
+{
+  vl_t  w;
+  T *p = (T *)&w;
+  p[0] = p[1] = x;
+  while (m--)
+    *u++ = *v++ * w;
+}
+
+int
+main(int argc, char *argv[])
+{
+  int i;
+  T *pl;
+
+  pl = (T *) &ul;
+  mul_vl_l(ul, vl, 2, 4);
+  for (i = 0; i < 8; i++)
+    if (pl[i] != 2 * (i + 1))
+      abort ();
+
+  return 0;
+}