]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix ICE for vpexpand*.
authorliuhongt <hongtao.liu@intel.com>
Wed, 28 Apr 2021 06:52:59 +0000 (14:52 +0800)
committerliuhongt <hongtao.liu@intel.com>
Tue, 22 Jun 2021 01:34:47 +0000 (09:34 +0800)
gcc/ChangeLog

PR target/100310
* config/i386/i386-expand.c
(ix86_expand_special_args_builtin): Keep constm1_operand only
if it satisfies insn's operand predicate.

gcc/testsuite/ChangeLog

PR target/100310
* gcc.target/i386/pr100310.c: New test.

gcc/config/i386/i386-expand.c
gcc/testsuite/gcc.target/i386/pr100310.c [new file with mode: 0644]

index 8f4e4e4d88488c30159a63564fdeffdef71ba2b0..cc2eaeed8dfe91e781d665c0f82ce339edcabee5 100644 (file)
@@ -10969,11 +10969,12 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
 
          op = fixup_modeless_constant (op, mode);
 
-         /* NB: 3-operands load implied it's a mask load,
+         /* NB: 3-operands load implied it's a mask load or v{p}expand*,
             and that mask operand shoud be at the end.
             Keep all-ones mask which would be simplified by the expander.  */
          if (nargs == 3 && i == 2 && klass == load
-             && constm1_operand (op, mode))
+             && constm1_operand (op, mode)
+             && insn_p->operand[i].predicate (op, mode))
            ;
          else if (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode)
            op = copy_to_mode_reg (mode, op);
diff --git a/gcc/testsuite/gcc.target/i386/pr100310.c b/gcc/testsuite/gcc.target/i386/pr100310.c
new file mode 100644 (file)
index 0000000..54ace18
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+#include <immintrin.h>
+
+double *p;
+volatile __m512d x;
+volatile __mmask8 m;
+
+void foo()
+{
+  x = _mm512_mask_expandloadu_pd (x, 255, p);
+}