]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ICE: QImode(not SImode) operand should be passed to gen_vec_initv16qiqi in ashlv16qi3.
authorliuhongt <hongtao.liu@intel.com>
Wed, 9 Feb 2022 05:14:43 +0000 (13:14 +0800)
committerliuhongt <hongtao.liu@intel.com>
Wed, 9 Feb 2022 09:14:35 +0000 (17:14 +0800)
ix86_expand_vector_init expects vals to be a parallel containing
values of individual fields which should be either element mode of the
vector mode, or a vector mode with the same element mode and smaller
number of elements.

But in the expander ashlv16qi3, the second operand is SImode which
can't be directly passed to gen_vec_initv16qiqi.

gcc/ChangeLog:

PR target/104451
* config/i386/sse.md (<insn><mode>3): lowpart_subreg
operands[2] from SImode to QImode.

gcc/testsuite/ChangeLog:

PR target/104451
* gcc.target/i386/pr104451.c: New test.

gcc/config/i386/sse.md
gcc/testsuite/gcc.target/i386/pr104451.c [new file with mode: 0644]

index d8cb7b655944ab05571b64ddd2799d5bb7685fca..36b35f68349252334191298c7fe8d183823429a7 100644 (file)
            negate = true;
        }
       par = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16));
+      tmp = lowpart_subreg (QImode, operands[2], SImode);
       for (i = 0; i < 16; i++)
-        XVECEXP (par, 0, i) = operands[2];
+       XVECEXP (par, 0, i) = tmp;
 
       tmp = gen_reg_rtx (V16QImode);
       emit_insn (gen_vec_initv16qiqi (tmp, par));
diff --git a/gcc/testsuite/gcc.target/i386/pr104451.c b/gcc/testsuite/gcc.target/i386/pr104451.c
new file mode 100644 (file)
index 0000000..8b251cc
--- /dev/null
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx2 -mxop -O" } */
+
+typedef char __attribute__((__vector_size__ (16))) V;
+typedef unsigned char __attribute__((__vector_size__ (16))) UV;
+V v;
+UV uv;
+
+V
+foo (long c)
+{
+  return v << c;
+}
+
+V
+foo1 (long c)
+{
+  return v >> c;
+}
+
+UV
+foo2 (unsigned long uc)
+{
+  return uv >> uc;
+}