On 1/16/26 00:54, Paolo Bonzini wrote:
extract and deposit_z are similar operations, only differing in
that extract shifts the operand right and deposit_z shifts it left.
However, their code generation is currently different.

extract is implemented as either SHL+SHR or SHR+AND, with the latter
chosen for "simple" cases where we expect the immediate to be available
or a zero extension instruction to be usable.  deposit instead uses only
AND+SHL, though SHL+SHR would be just as usable.

To get the best of both worlds, introduce tcg_op_imm_match to check
whether the processor supports the immediate that is needed for the mask,
and if not fall back to two shifts.

Hmm.

I have a patch set that's been stagnant for a while, now currently waiting on the removal of 32-bit hosts, which delays expansion of extract and deposit until optimize, when we can see then input constants.

There's probably some overlap here.


r~

Reply via email to