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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #5)
> (In reply to Jakub Jelinek from comment #3)
> > For zero_extract RTL we require that the POS and LEN arguments are in the
> > right ranges, while bextr allows any values, and either uses 0 for bits
> > outside of the original operand and for LEN uses umin (len, <bitsize>).
> 
> Ah, thanks, this explains my question from Comment #4.
> 
> Speculating a bit further, is BZHI just a special case of BEXTR, where start
> = 0 (I'm referring to [1]). It would be nice to make these insn as general
> as possible, so combine will have a chance here.
> 
> [1] http://en.wikipedia.org/wiki/Bit_Manipulation_Instruction_Sets

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).

Reply via email to