On 11/1/21 6:01 AM, LIU Zhiwei wrote:
static bool trans_fld(DisasContext *ctx, arg_fld *a)
{
- TCGv addr;
+ TCGv src1 = get_gpr(ctx, a->rs1, EXT_NONE);
+ TCGv addr = temp_new(ctx);
REQUIRE_FPU;
REQUIRE_EXT(ctx, RVD);
- addr = get_gpr(ctx, a->rs1, EXT_NONE);
- if (a->imm) {
- TCGv temp = temp_new(ctx);
- tcg_gen_addi_tl(temp, addr, a->imm);
- addr = temp;
- }
+ tcg_gen_addi_tl(addr, src1, a->imm);
addr = gen_pm_adjust_address(ctx, addr);
No change here,
static bool trans_fsd(DisasContext *ctx, arg_fsd *a)
{
- TCGv addr;
+ TCGv src1 = get_gpr(ctx, a->rs1, EXT_NONE);
+ TCGv addr = temp_new(ctx);
REQUIRE_FPU;
REQUIRE_EXT(ctx, RVD);
- addr = get_gpr(ctx, a->rs1, EXT_NONE);
- if (a->imm) {
- TCGv temp = temp_new(ctx);
- tcg_gen_addi_tl(temp, addr, a->imm);
- addr = temp;
- }
+ tcg_gen_addi_tl(addr, src1, a->imm);
addr = gen_pm_adjust_address(ctx, addr);
Or here.
static bool trans_flw(DisasContext *ctx, arg_flw *a)
{
TCGv_i64 dest;
- TCGv addr;
+ TCGv src1 = get_gpr(ctx, a->rs1, EXT_NONE);
+ TCGv addr = temp_new(ctx);
REQUIRE_FPU;
REQUIRE_EXT(ctx, RVF);
- addr = get_gpr(ctx, a->rs1, EXT_NONE);
- if (a->imm) {
- TCGv temp = temp_new(ctx);
- tcg_gen_addi_tl(temp, addr, a->imm);
- addr = temp;
+ tcg_gen_addi_tl(addr, src1, a->imm);
+ if (ctx->ol == MXL_RV32) {
+ tcg_gen_ext32u_tl(addr, addr);
}
addr = gen_pm_adjust_address(ctx, addr);
But you did here.
(1) OL is wrong, use XL.
(2) The address adjustment should be done in some common routine.
Probably rename gen_pm_adjust_address to make it more generic,
then add the XL truncation there.
r~