public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] i386: Fix up V32HImode permutations with -mno-avx512bw [PR101860]
@ 2021-08-12  7:49 Jakub Jelinek
  2021-08-12  8:52 ` Hongtao Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2021-08-12  7:49 UTC (permalink / raw)
  To: Hongtao Liu; +Cc: gcc-patches

Hi!

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.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2021-08-12  Jakub Jelinek  <jakub@redhat.com>

	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.

--- gcc/config/i386/i386-expand.c.jj	2021-08-10 12:37:53.867159317 +0200
+++ gcc/config/i386/i386-expand.c	2021-08-11 11:02:03.994908828 +0200
@@ -18116,6 +18116,9 @@ ix86_expand_vec_one_operand_perm_avx512
       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 expa
       gcc_assert (!TARGET_AVX2 || d->perm[0]);
       return false;
 
+    case E_V32HImode:
+      gcc_assert (!TARGET_AVX512BW);
+      return false;
+
     default:
       gcc_unreachable ();
     }
--- gcc/testsuite/gcc.target/i386/avx512f-pr101860.c.jj	2021-08-11 11:05:28.090072461 +0200
+++ gcc/testsuite/gcc.target/i386/avx512f-pr101860.c	2021-08-11 11:05:17.157224399 +0200
@@ -0,0 +1,5 @@
+/* PR target/101860 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f -mno-avx512bw" } */
+
+#include "../../gcc.dg/torture/vshuf-v32hi.c"

	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] i386: Fix up V32HImode permutations with -mno-avx512bw [PR101860]
  2021-08-12  7:49 [PATCH] i386: Fix up V32HImode permutations with -mno-avx512bw [PR101860] Jakub Jelinek
@ 2021-08-12  8:52 ` Hongtao Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Hongtao Liu @ 2021-08-12  8:52 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GCC Patches

On Thu, Aug 12, 2021 at 3:49 PM Jakub Jelinek <jakub@redhat.com> wrote:
>
> Hi!
>
> 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.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
LGTM.
>
> 2021-08-12  Jakub Jelinek  <jakub@redhat.com>
>
>         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.
>
> --- gcc/config/i386/i386-expand.c.jj    2021-08-10 12:37:53.867159317 +0200
> +++ gcc/config/i386/i386-expand.c       2021-08-11 11:02:03.994908828 +0200
> @@ -18116,6 +18116,9 @@ ix86_expand_vec_one_operand_perm_avx512
>        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 expa
>        gcc_assert (!TARGET_AVX2 || d->perm[0]);
>        return false;
>
> +    case E_V32HImode:
> +      gcc_assert (!TARGET_AVX512BW);
> +      return false;
> +
>      default:
>        gcc_unreachable ();
>      }
> --- gcc/testsuite/gcc.target/i386/avx512f-pr101860.c.jj 2021-08-11 11:05:28.090072461 +0200
> +++ gcc/testsuite/gcc.target/i386/avx512f-pr101860.c    2021-08-11 11:05:17.157224399 +0200
> @@ -0,0 +1,5 @@
> +/* PR target/101860 */
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -mavx512f -mno-avx512bw" } */
> +
> +#include "../../gcc.dg/torture/vshuf-v32hi.c"
>
>         Jakub
>


-- 
BR,
Hongtao

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-12  8:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12  7:49 [PATCH] i386: Fix up V32HImode permutations with -mno-avx512bw [PR101860] Jakub Jelinek
2021-08-12  8:52 ` Hongtao Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).