Re: [PATCH v2 04/21] target/riscv: Introduce DisasExtend and new helpers

2021-08-18 Thread Alistair Francis
On Wed, Aug 18, 2021 at 7:23 AM Richard Henderson wrote: > > Introduce get_gpr, dest_gpr, temp_new -- new helpers that do not force > tcg globals into temps, returning a constant 0 for $zero as source and > a new temp for $zero as destination. > > Introduce ctx->w for simplifying word operations,

Re: [PATCH v2 04/21] target/riscv: Introduce DisasExtend and new helpers

2021-08-18 Thread Richard Henderson
On 8/18/21 12:58 AM, Bin Meng wrote: +TCGv temp[4]; Why is 4? Is it enough? Perhaps a comment here is needed here? It's a round number that will cover three operands plus an extra for address computation. r~

Re: [PATCH v2 04/21] target/riscv: Introduce DisasExtend and new helpers

2021-08-18 Thread Richard Henderson
On 8/18/21 12:58 AM, Bin Meng wrote: +static void gen_set_gpr(DisasContext *ctx, int reg_num, TCGv t) +{ +if (reg_num != 0) { +if (ctx->w) { +tcg_gen_ext32s_tl(cpu_gpr[reg_num], t); What about zero extension? All of the RV64 word instructions sign-extend the result.

Re: [PATCH v2 04/21] target/riscv: Introduce DisasExtend and new helpers

2021-08-18 Thread Bin Meng
On Wed, Aug 18, 2021 at 5:22 AM Richard Henderson wrote: > > Introduce get_gpr, dest_gpr, temp_new -- new helpers that do not force > tcg globals into temps, returning a constant 0 for $zero as source and > a new temp for $zero as destination. > > Introduce ctx->w for simplifying word operations,

[PATCH v2 04/21] target/riscv: Introduce DisasExtend and new helpers

2021-08-17 Thread Richard Henderson
Introduce get_gpr, dest_gpr, temp_new -- new helpers that do not force tcg globals into temps, returning a constant 0 for $zero as source and a new temp for $zero as destination. Introduce ctx->w for simplifying word operations, such as addw. Signed-off-by: Richard Henderson --- target/riscv/tr