re PR rtl-optimization/84989 (_mm512_broadcast_f32x4 triggers ICE in simplify_const_u...
authorJakub Jelinek <jakub@redhat.com>
Wed, 21 Mar 2018 10:13:29 +0000 (11:13 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 21 Mar 2018 10:13:29 +0000 (11:13 +0100)
PR rtl-optimization/84989
* simplify-rtx.c (simplify_unary_operation_1): Don't try to simplify
VEC_DUPLICATE with scalar result mode.

* gcc.target/i386/pr84989.c: New test.

From-SVN: r258709

gcc/ChangeLog
gcc/simplify-rtx.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr84989.c [new file with mode: 0644]

index 41f4b3b3422b628990a2b445dcfd67d44f23b5f0..1fd6490bdc5b03cb7d4074b5594b57c7f6155f33 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/84989
+       * simplify-rtx.c (simplify_unary_operation_1): Don't try to simplify
+       VEC_DUPLICATE with scalar result mode.
+
 2018-03-21  Martin Liska  <mliska@suse.cz>
 
        PR ipa/84963
index 2e7aa5c12952ab1a9b49b5adaf23710327e577d3..23244a12545ba2f9db21f66a63a6d36ff8fd29fc 100644 (file)
@@ -1692,7 +1692,9 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op)
       break;
     }
 
-  if (VECTOR_MODE_P (mode) && vec_duplicate_p (op, &elt))
+  if (VECTOR_MODE_P (mode)
+      && vec_duplicate_p (op, &elt)
+      && code != VEC_DUPLICATE)
     {
       /* Try applying the operator to ELT and see if that simplifies.
         We can duplicate the result if so.
index 7e844e5a82cb0997d32f36cb089a181dba8797c0..20e7dd9f2a06de11c3761732b013efd6780b5fec 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/84989
+       * gcc.target/i386/pr84989.c: New test.
+
 2018-03-21  Christophe Lyon  <christophe.lyon@linaro.org>
 
        * gcc.target/arm/pr82518.c: Require arm_neon_hw.
diff --git a/gcc/testsuite/gcc.target/i386/pr84989.c b/gcc/testsuite/gcc.target/i386/pr84989.c
new file mode 100644 (file)
index 0000000..10655d3
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR rtl-optimization/84989 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f" } */
+
+#include <x86intrin.h>
+
+__m512
+foo (float a, float *b)
+{
+  return _mm512_sub_ps (_mm512_broadcast_f32x4 (_mm_load_ps (b)),
+                       _mm512_broadcast_f32x4 (_mm_set1_ps (a)));
+}