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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
In GCC 13 and earlier, .CLZ(0) was UB depending on CLZ_VALUE_DEFINED_AT_ZERO
(...) != 2.
In GCC 14, it is always UB, and well defined is only .CLZ(0, 32) (but with the
current
requirement that the second argument, value at zero, matches
CLZ_VALUE_DEFINED_AT_ZERO (...) == 2 filled in value for scalars (exception for
bitints).
If we wanted, we could (but probably stage1 material) allow any constant second
argument and just expand to conditional if the value doesn't match
CLZ_VALUE_DEFINED_AT_ZERO (...) != 0 filled in value.
But, still, for the ifcvt and vectorization it would be useful to know what is
the well defined value that will be cheapest to compute.
The backends could do that e.g. by supplying details for
CLZ_VALUE_DEFINED_AT_ZERO on vector modes even if scalar is undefined.
Or have some third way which would say this is not UB at 0, but we don't really
care what value at zero it has (but then e.g. VRP would need to give up on
that).

Reply via email to