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

--- Comment #3 from Kang-Che Sung <Explorer09 at gmail dot com> ---
(In reply to Jakub Jelinek from comment #2)
> Bet the point of this PR is to canonicalize in GIMPLE to one of the forms
> (both have the same number of GIMPLE statements, so that makes it harder to
> pick the canonical form) and let expansion try to expand both ways and query
> rtx costs what is faster or smaller; we do something like that in other
> cases (e.g. for division where ranges tells us we can use unsigned or signed
> division equally).

Yes. For me who writes C code, the ideal outcome would be I can pick either
pattern and it would "just work", gcc would see the two forms are the same in
semantics, and generate the optimal code for the target processor (whichever
form it is).

The other issue is that ((x >> count) << count) pattern might generate
unnecessary instruction that intend to "truncate" upper bits. GCC can assume
they are "truncated" already and focus on "truncating" lower bits instead
(which I was intended to do).

Reply via email to