https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127853
Bug ID: 127853
Summary: x86 (non BMI): .CTZ(x, N) returns 32 when bsr insn
result could be undefined
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: vineetg at gcc dot gnu.org
Reporter: vineetg at gcc dot gnu.org
Target Milestone: ---
on x86 without BMI, bsf/bsr insns with input 0 can have undefined output (or on
amd, it could be left unchanged).
x86 CTZ_DEFINED_VALUE_AT_ZERO, defines 2 for BMI, but it returns 32
nonetheless, when it is actually undefined. This can lead to erroneous deletion
of program's own v ? … : 32 guard from match.pd folding.