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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, for the a ? -1 : 0 case (and similarly for a ? 0 : -1) we have 3 distinct
cases.
One is signed 1-bit precision type, for which we jump through the unnecessary
hops of
trying to optimize e.g. the first one as (lshift (convert:type
(convert:boolean_type_node @0) { integer_zero_node; }) and then optimizing away
the shift.  Then the signed boolean case of larger precision, where we can
choose what
exactly we want it to simplify to, one is the negation in signed integer type
of the same precision and another one would be to cast to signed boolean type
rather than unsigned.  And finally the case where both 1 and -1 are valid,
where we should use the negation.
If we go the negation route for the second subcase, that is the only case where
we need build_nonstandard_integer_type.  If we go with the casts, we don't need
it anywhere.

Reply via email to