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

--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Jakub Jelinek from comment #6)

> To some extent BZHI is a special case of BEXTR, but I'm afraid any
> generalization is much harder due to the weirdo encoding of the operands,
> unless both the START and LEN are CONST_INTs (and if they are constants, it
> is questionable if BEXTR or BZHI are the best instructions to use, because
> both take just register for the LEN or START/LEN pair, so one would need to
> set some register to a constant and then perform BEXTR/BZHI, so two
> instructions, while there is always the option to perform AND and right
> shift (or right shift and AND).

Probably I didn't form the question in the right way - I was trying to point
out, if we also describe BEXTR without unspec (in a similar way as your
proposed patch describes BZHI), then combine will be able to propagate eventual
immediates to the insn, and in this case reduce BEXTR with START=0 and LEN=n to
an AND.

Reply via email to