[PATCH 0/5] tcg: Delay lowering unsupported deposit/extract2

Richard Henderson posted 5 patches 1 month, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250928163155.1472914-1-richard.henderson@linaro.org
Maintainers: Richard Henderson <richard.henderson@linaro.org>
tcg/optimize.c | 257 +++++++++++++++++++++++++++++++++++-----
tcg/tcg-op.c   | 311 +++++++++++++++++++------------------------------
2 files changed, 352 insertions(+), 216 deletions(-)
[PATCH 0/5] tcg: Delay lowering unsupported deposit/extract2
Posted by Richard Henderson 1 month, 2 weeks ago
Reviving a 2 year old set of patches:

The opcodes that we generate early do not fold away nicely when operands
of deposit or extract2 turn out to be constants, especially zero.  

This isn't particularly rare either, as various target ISAs implement
constant shifts with extract2 and their zero register.   Or the compiler
expands x = y | mask with x = deposit(y, -1, pos, len);

Delay lowering of these unsupported operations until optimize, when
we have performed constant propagation.


r~


Richard Henderson (5):
  tcg: Simplify extract2 usage in tcg_gen_shifti_i64
  tcg/optimize: Lower unsupported deposit during optimize
  tcg/optimize: Lower unsupported extract2 during optimize
  tcg: Expand missing rotri with extract2
  tcg: Expand extract2_i64 with extract2_i32 on 32-bit host

 tcg/optimize.c | 257 +++++++++++++++++++++++++++++++++++-----
 tcg/tcg-op.c   | 311 +++++++++++++++++++------------------------------
 2 files changed, 352 insertions(+), 216 deletions(-)

-- 
2.43.0
Re: [PATCH 0/5] tcg: Delay lowering unsupported deposit/extract2
Posted by Richard Henderson 2 weeks, 2 days ago
Ping.

r~

On 9/28/25 18:31, Richard Henderson wrote:
> Reviving a 2 year old set of patches:
> 
> The opcodes that we generate early do not fold away nicely when operands
> of deposit or extract2 turn out to be constants, especially zero.
> 
> This isn't particularly rare either, as various target ISAs implement
> constant shifts with extract2 and their zero register.   Or the compiler
> expands x = y | mask with x = deposit(y, -1, pos, len);
> 
> Delay lowering of these unsupported operations until optimize, when
> we have performed constant propagation.
> 
> 
> r~
> 
> 
> Richard Henderson (5):
>    tcg: Simplify extract2 usage in tcg_gen_shifti_i64
>    tcg/optimize: Lower unsupported deposit during optimize
>    tcg/optimize: Lower unsupported extract2 during optimize
>    tcg: Expand missing rotri with extract2
>    tcg: Expand extract2_i64 with extract2_i32 on 32-bit host
> 
>   tcg/optimize.c | 257 +++++++++++++++++++++++++++++++++++-----
>   tcg/tcg-op.c   | 311 +++++++++++++++++++------------------------------
>   2 files changed, 352 insertions(+), 216 deletions(-)
>