Hi!

The testcase shows another problem, for TARGET_AVX512BW we have a single insn
doing broadcast from the first element, but don't have one for broadcast
of 2nd+ element (so for d->perm[0] we must return false), but for
TARGET_AVX512F && !TARGET_AVX512BW we don't even have support for that other
broadcast.  V64QImode case was just added to the AVX2 cases which had
gcc_assert (!TARGET_AVX2 || d->perm[0]);
but for V64QImode we actually need
gcc_assert (!TARGET_AVX512BW || d->perm[0]);

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk as obvious.

2021-08-14  Jakub Jelinek  <ja...@redhat.com>

        PR target/101896
        * config/i386/i386-expand.c (expand_vec_perm_broadcast_1)
        <case E_V64QImode>: For this mode assert
        !TARGET_AVX512BW || d->perm[0] rather than !TARGET_AVX2 || d->perm[0].

        * gcc.target/i386/avx512f-pr101896.c: New test.

--- gcc/config/i386/i386-expand.c.jj    2021-08-12 11:26:50.000000000 +0200
+++ gcc/config/i386/i386-expand.c       2021-08-13 10:05:40.820131381 +0200
@@ -20474,7 +20474,6 @@ expand_vec_perm_broadcast_1 (struct expa
       emit_move_insn (d->target, gen_lowpart (d->vmode, dest));
       return true;
 
-    case E_V64QImode:
     case E_V32QImode:
     case E_V16HImode:
     case E_V8SImode:
@@ -20484,6 +20483,10 @@ expand_vec_perm_broadcast_1 (struct expa
       gcc_assert (!TARGET_AVX2 || d->perm[0]);
       return false;
 
+    case E_V64QImode:
+      gcc_assert (!TARGET_AVX512BW || d->perm[0]);
+      return false;
+
     case E_V32HImode:
       gcc_assert (!TARGET_AVX512BW);
       return false;
--- gcc/testsuite/gcc.target/i386/avx512f-pr101896.c.jj 2021-08-13 
10:10:32.624070409 +0200
+++ gcc/testsuite/gcc.target/i386/avx512f-pr101896.c    2021-08-13 
10:10:42.763929293 +0200
@@ -0,0 +1,5 @@
+/* PR target/101896 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f -mno-avx512bw" } */
+
+#include "../../gcc.dg/torture/vshuf-v64qi.c"

        Jakub

Reply via email to