re PR target/85169 (wrong code with vector member insert)
authorJakub Jelinek <jakub@redhat.com>
Tue, 3 Apr 2018 16:06:19 +0000 (18:06 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 3 Apr 2018 16:06:19 +0000 (18:06 +0200)
PR target/85169
* config/i386/i386.c (ix86_expand_vector_set): Use
HOST_WIDE_INT_1U << elt instead of 1 << elt.  Formatting fix.

* gcc.c-torture/execute/pr85169.c: New test.
* gcc.target/i386/avx512f-pr85169.c: New test.
* gcc.target/i386/avx512bw-pr85169.c: New test.

From-SVN: r259037

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr85169.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512bw-pr85169.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-pr85169.c [new file with mode: 0644]

index f1030b4fd64efd903d77482e7810ab6c7a23a3d5..efd155e36a4a7daecd3ab4cefd6dfea0569b9840 100644 (file)
@@ -1,3 +1,9 @@
+2018-04-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/85169
+       * config/i386/i386.c (ix86_expand_vector_set): Use
+       HOST_WIDE_INT_1U << elt instead of 1 << elt.  Formatting fix.
+
 2018-04-03  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.c (emit_i387_cw_initialization): Always use logic
index 44ef60e563982f8a8277f28d0e303c8da9833120..03e5c433574eeef300806fca3a610546ffcd2151 100644 (file)
@@ -44127,12 +44127,14 @@ quarter:
         where the mask is clear and second input operand otherwise.  */
       emit_insn (gen_blendm (target, target, tmp,
                             force_reg (mmode,
-                                       gen_int_mode (1 << elt, mmode))));
+                                       gen_int_mode (HOST_WIDE_INT_1U << elt,
+                                                     mmode))));
     }
   else if (use_vec_merge)
     {
       tmp = gen_rtx_VEC_DUPLICATE (mode, val);
-      tmp = gen_rtx_VEC_MERGE (mode, tmp, target, GEN_INT (1 << elt));
+      tmp = gen_rtx_VEC_MERGE (mode, tmp, target,
+                              GEN_INT (HOST_WIDE_INT_1U << elt));
       emit_insn (gen_rtx_SET (target, tmp));
     }
   else
@@ -44141,7 +44143,7 @@ quarter:
 
       emit_move_insn (mem, target);
 
-      tmp = adjust_address (mem, inner_mode, elt*GET_MODE_SIZE (inner_mode));
+      tmp = adjust_address (mem, inner_mode, elt * GET_MODE_SIZE (inner_mode));
       emit_move_insn (tmp, val);
 
       emit_move_insn (target, mem);
index 407bb4f572799a7fd8f2d6f29dd110e29d52118c..a53d46b6bac95e1a10c62631ab39f132db071f60 100644 (file)
@@ -1,3 +1,10 @@
+2018-04-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/85169
+       * gcc.c-torture/execute/pr85169.c: New test.
+       * gcc.target/i386/avx512f-pr85169.c: New test.
+       * gcc.target/i386/avx512bw-pr85169.c: New test.
+
 2018-04-03  Segher Boessenkool  <segher@kernel.crashing.org>
 
        PR target/85126
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr85169.c b/gcc/testsuite/gcc.c-torture/execute/pr85169.c
new file mode 100644 (file)
index 0000000..a21ed9b
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR target/85169 */
+
+typedef char V __attribute__((vector_size (64)));
+
+static void __attribute__ ((noipa))
+foo (V *p)
+{
+  V v = *p;
+  v[63] = 1;
+  *p = v;
+}
+
+int
+main ()
+{
+  V v = (V) { };
+  foo (&v);
+  for (unsigned i = 0; i < 64; i++)
+    if (v[i] != (i == 63))
+      __builtin_abort ();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr85169.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr85169.c
new file mode 100644 (file)
index 0000000..be2dcfd
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR target/85169 */
+/* { dg-do run { target avx512bw } } */
+/* { dg-options "-O2 -mavx512bw" } */
+
+#include "avx512bw-check.h"
+
+int do_main (void);
+
+static void
+avx512bw_test (void)
+{
+  do_main ();
+}
+
+#undef main
+#define main() do_main ()
+
+#include "../../gcc.c-torture/execute/pr85169.c"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr85169.c b/gcc/testsuite/gcc.target/i386/avx512f-pr85169.c
new file mode 100644 (file)
index 0000000..be1913b
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR target/85169 */
+/* { dg-do run { target avx512f } } */
+/* { dg-options "-O2 -mavx512f" } */
+
+#include "avx512f-check.h"
+
+int do_main (void);
+
+static void
+avx512f_test (void)
+{
+  do_main ();
+}
+
+#undef main
+#define main() do_main ()
+
+#include "../../gcc.c-torture/execute/pr85169.c"