On 10/15/22 04:53, Peter Maydell wrote:
On Thu, 6 Oct 2022 at 04:55, Richard Henderson
<[email protected]> wrote:
In preparation for TARGET_TB_PCREL, reduce reliance on absolute values.
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
@@ -296,7 +301,8 @@ TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs)
TCGv_i32 tmp = tcg_temp_new_i32();
if (reg == 15) {
- tcg_gen_movi_i32(tmp, (read_pc(s) & ~3) + ofs);
+ /* This difference computes a page offset so ok for TARGET_TB_PCREL. */
+ gen_pc_plus_diff(s, tmp, (read_pc(s) & ~3) - s->pc_curr + ofs);
} else {
tcg_gen_addi_i32(tmp, cpu_R[reg], ofs);
}
This is still doing the pc - pc thing -- I guess my comment on v5
crossed in the mail with your v6 repost.
Yes, v6 was posted a couple of days beforehand.
I'll do a v7 with the change soon.
r~