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-Tag: releases/gcc-9.4.0~687 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cb09410d3c61d325c64b17eabe9dfd1609cec1a6;p=thirdparty%2Fgcc.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. (cherry picked from commit 8bf5faa9c463f0d53ffe835ba03d4502edfb959d) --- diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index ae5046ee6a0a..c6bc468e36bf 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -50287,7 +50287,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 000000000000..9e56f2846ee8 --- /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 000000000000..a0c52e426c86 --- /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); +}