From: Jakub Jelinek Date: Wed, 8 Apr 2020 16:24:12 +0000 (+0200) Subject: i386: Don't use AVX512F integral masks for V*TImode [PR94438] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8bf5faa9c463f0d53ffe835ba03d4502edfb959d;p=gcc.git 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 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. --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 88e79520807..ec97a1e2bd1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-04-08 Jakub Jelinek + + PR target/94438 + * config/i386/i386.c (ix86_get_mask_mode): Only use int mask for elem_size + 1, 2, 4 and 8. + 2020-04-08 Martin Liska PR c++/94314 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 049ca4f4fdb..ca3b7dc06c2 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -21771,7 +21771,9 @@ ix86_get_mask_mode (machine_mode data_mode) 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/ChangeLog b/gcc/testsuite/ChangeLog index 347181619a5..e3600e0627a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-04-08 Jakub Jelinek + + PR target/94438 + * gcc.target/i386/avx512bw-pr94438.c: New test. + * gcc.target/i386/avx512vlbw-pr94438.c: New test. + 2020-04-08 Tobias Burnus PR fortran/93871 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); +}