From: Jakub Jelinek Date: Thu, 12 Aug 2021 09:26:57 +0000 (+0200) Subject: i386: Fix up V32HImode permutations with -mno-avx512bw [PR101860] X-Git-Tag: basepoints/gcc-13~5437 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04b4f3152593f85b05974528d1607619dd77d702;p=thirdparty%2Fgcc.git i386: Fix up V32HImode permutations with -mno-avx512bw [PR101860] My patch from yesterday apparently broke some V32HImode permutations as the testcase shows. The first function assumed it would never be called in d->testing_p mode and so went right away into emitting the code. And the second one assumed V32HImode would never reach it, which now can for the !TARGET_AVX512BW case. We don't have a instruction in that case though. 2021-08-12 Jakub Jelinek PR target/101860 * config/i386/i386-expand.c (ix86_expand_vec_one_operand_perm_avx512): If d->testing_p, return true after performing checks instead of actually expanding the insn. (expand_vec_perm_broadcast_1): Handle V32HImode - assert !TARGET_AVX512BW and return false. * gcc.target/i386/avx512f-pr101860.c: New test. --- diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index c708b33b7867..a652b25f5345 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c @@ -18116,6 +18116,9 @@ ix86_expand_vec_one_operand_perm_avx512 (struct expand_vec_perm_d *d) return false; } + if (d->testing_p) + return true; + target = d->target; op0 = d->op0; for (int i = 0; i < d->nelt; ++i) @@ -20481,6 +20484,10 @@ expand_vec_perm_broadcast_1 (struct expand_vec_perm_d *d) gcc_assert (!TARGET_AVX2 || d->perm[0]); return false; + case E_V32HImode: + gcc_assert (!TARGET_AVX512BW); + return false; + default: gcc_unreachable (); } diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr101860.c b/gcc/testsuite/gcc.target/i386/avx512f-pr101860.c new file mode 100644 index 000000000000..1aadfa28ac84 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-pr101860.c @@ -0,0 +1,5 @@ +/* PR target/101860 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mavx512f -mno-avx512bw" } */ + +#include "../../gcc.dg/torture/vshuf-v32hi.c"