public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/redhat/heads/gcc-8-branch)] i386: Don't use AVX512F integral masks for V*TImode [PR94438]
@ 2020-09-17 17:21 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2020-09-17 17:21 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:a82154cdbf3951b1101eba3fc9b73682ef434a57

commit a82154cdbf3951b1101eba3fc9b73682ef434a57
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Apr 8 18:24:12 2020 +0200

    i386: Don't use AVX512F integral masks for V*TImode [PR94438]
    
    The ix86_get_mask_mode hook uses int mask for 512-bit vectors or 128/256-bit
    vectors with AVX512VL (that is correct), and only for V*[SD][IF]mode if not
    AVX512BW (also correct), but with AVX512BW it would stop checking the
    elem_size altogether and pretend the hw has masking support for V*TImode
    etc., which it doesn't.  That can lead to various ICEs later on.
    
    2020-04-08  Jakub Jelinek  <jakub@redhat.com>
    
            PR target/94438
            * config/i386/i386.c (ix86_get_mask_mode): Only use int mask for elem_size
            1, 2, 4 and 8.
    
            * gcc.target/i386/avx512bw-pr94438.c: New test.
            * gcc.target/i386/avx512vlbw-pr94438.c: New test.
    
    (cherry picked from commit 8bf5faa9c463f0d53ffe835ba03d4502edfb959d)

Diff:
---
 gcc/config/i386/i386.c                             |  4 +++-
 gcc/testsuite/gcc.target/i386/avx512bw-pr94438.c   | 13 +++++++++++++
 gcc/testsuite/gcc.target/i386/avx512vlbw-pr94438.c | 13 +++++++++++++
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 2e290910f61..b4516714465 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -50355,7 +50355,9 @@ ix86_get_mask_mode (poly_uint64 nunits, poly_uint64 vector_size)
   if ((TARGET_AVX512F && vector_size == 64)
       || (TARGET_AVX512VL && (vector_size == 32 || vector_size == 16)))
     {
-      if (elem_size == 4 || elem_size == 8 || TARGET_AVX512BW)
+      if (elem_size == 4
+	  || elem_size == 8
+	  || (TARGET_AVX512BW && (elem_size == 1 || elem_size == 2)))
 	return smallest_int_mode_for_size (nunits);
     }
 
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr94438.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr94438.c
new file mode 100644
index 00000000000..9e56f2846ee
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr94438.c
@@ -0,0 +1,13 @@
+/* PR target/94438 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-mavx512bw" } */
+
+typedef __attribute__ ((__vector_size__ (4 * sizeof (__int128)))) __int128 V;
+void bar (V);
+
+void
+foo (V w)
+{
+  V v = 0 <= (0 >= w);
+  bar (v);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512vlbw-pr94438.c b/gcc/testsuite/gcc.target/i386/avx512vlbw-pr94438.c
new file mode 100644
index 00000000000..a0c52e426c8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vlbw-pr94438.c
@@ -0,0 +1,13 @@
+/* PR target/94438 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-mavx512bw -mavx512vl" } */
+
+typedef __attribute__ ((__vector_size__ (sizeof (__int128)))) __int128 V;
+void bar (V);
+
+void
+foo (V w)
+{
+  V v = 0 <= (0 >= w);
+  bar (v);
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-17 17:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 17:21 [gcc(refs/vendors/redhat/heads/gcc-8-branch)] i386: Don't use AVX512F integral masks for V*TImode [PR94438] Jakub Jelinek

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).