gcc/gcc11-pr105123.patch

49 lines
1.4 KiB
Diff

2022-04-01 Jakub Jelinek <jakub@redhat.com>
PR target/105123
* config/i386/i386-expand.c (ix86_expand_vector_init_general): Avoid
using word as target for expand_simple_binop when doing ASHIFT and
IOR.
* gcc.target/i386/pr105123.c: New test.
--- gcc/config/i386/i386-expand.c.jj 2022-03-19 13:52:53.000000000 +0100
+++ gcc/config/i386/i386-expand.c 2022-04-01 16:51:27.253154191 +0200
@@ -14479,9 +14479,9 @@ quarter:
else
{
word = expand_simple_binop (word_mode, ASHIFT, word, shift,
- word, 1, OPTAB_LIB_WIDEN);
+ NULL_RTX, 1, OPTAB_LIB_WIDEN);
word = expand_simple_binop (word_mode, IOR, word, elt,
- word, 1, OPTAB_LIB_WIDEN);
+ NULL_RTX, 1, OPTAB_LIB_WIDEN);
}
}
--- gcc/testsuite/gcc.target/i386/pr105123.c.jj 2022-04-01 16:56:44.549625810 +0200
+++ gcc/testsuite/gcc.target/i386/pr105123.c 2022-04-01 16:56:33.569782511 +0200
@@ -0,0 +1,22 @@
+/* PR target/105123 */
+/* { dg-do run { target sse2_runtime } } */
+/* { dg-options "-msse2" } */
+/* { dg-additional-options "-mtune=i686" { target ia32 } } */
+
+typedef unsigned short __attribute__((__vector_size__ (4 * sizeof (unsigned short)))) V;
+
+V
+foo (unsigned short u, V v)
+{
+ return __builtin_shuffle (u * v, v);
+}
+
+int
+main ()
+{
+ V x = foo (1, (V) { 0, 1, 2, 3 });
+ for (unsigned i = 0; i < 4; i++)
+ if (x[i] != i)
+ __builtin_abort ();
+ return 0;
+}