https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83488

--- Comment #1 from igor.v.tsimbalist at intel dot com ---
The reason of this ICE is not in CET implementation itself, it's an induced
error. The actual reason is in keeping isa bits. There are two different flags
to keep ISA bits (for i386): x86_isa_flags and x86_isa_flags2. When introducing
a new builtin definition with BDESC () ISA bits are given to tell when a usage
of the builtin is valid. At this point there could be combination of ISA bits
from different isa_flags set. That's exactly the case with rdssp builtin: it
has bits OPTION_MASK_ISA_SHSTK | OPTION_MASK_ISA_64BIT specified. Later
def_builtin or def_buildin2 is called that assume the 'mask' argument belong to
one isa set flag. In this case def_buildin2 is called and it turned out
OPTION_MASK_ISA_64BIT from x86_isa_flags maps to OPTION_MASK_ISA_AVX5124VNNIW
from x86_isa_flags2.

I assume it could be a potential error for other intrinsics. The best solution
is to revisit a mechanism of processing and keeping ISA bits.

The workaround is to remove OPTION_MASK_ISA_64BIT. All test are working, the
correct intrinsic is selected (I think due to different intrinsic's name).
Patch is attached. The patch has a fix for wrong setting of
OPTION_MASK_ISA_AVX512F_SET for -mavx512vnni option, which has also effect on
CET.

Reply via email to