mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
target/loongarch: Use {set/get}_gpr replace to cpu_fpr
Introduce set_fpr() and get_fpr() and remove cpu_fpr. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Song Gao <gaosong@loongson.cn> Message-Id: <20230504122810.4094787-44-gaosong@loongson.cn>
This commit is contained in:
parent
29bb5d727f
commit
4854bbbe01
5 changed files with 129 additions and 43 deletions
|
@ -10,14 +10,17 @@ static const uint32_t fcsr_mask[4] = {
|
|||
static bool trans_fsel(DisasContext *ctx, arg_fsel *a)
|
||||
{
|
||||
TCGv zero = tcg_constant_tl(0);
|
||||
TCGv dest = get_fpr(ctx, a->fd);
|
||||
TCGv src1 = get_fpr(ctx, a->fj);
|
||||
TCGv src2 = get_fpr(ctx, a->fk);
|
||||
TCGv cond;
|
||||
|
||||
CHECK_FPE;
|
||||
|
||||
cond = tcg_temp_new();
|
||||
tcg_gen_ld8u_tl(cond, cpu_env, offsetof(CPULoongArchState, cf[a->ca]));
|
||||
tcg_gen_movcond_tl(TCG_COND_EQ, cpu_fpr[a->fd], cond, zero,
|
||||
cpu_fpr[a->fj], cpu_fpr[a->fk]);
|
||||
tcg_gen_movcond_tl(TCG_COND_EQ, dest, cond, zero, src1, src2);
|
||||
set_fpr(a->fd, dest);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -25,15 +28,16 @@ static bool trans_fsel(DisasContext *ctx, arg_fsel *a)
|
|||
static bool gen_f2f(DisasContext *ctx, arg_ff *a,
|
||||
void (*func)(TCGv, TCGv), bool nanbox)
|
||||
{
|
||||
TCGv dest = cpu_fpr[a->fd];
|
||||
TCGv src = cpu_fpr[a->fj];
|
||||
TCGv dest = get_fpr(ctx, a->fd);
|
||||
TCGv src = get_fpr(ctx, a->fj);
|
||||
|
||||
CHECK_FPE;
|
||||
|
||||
func(dest, src);
|
||||
if (nanbox) {
|
||||
gen_nanbox_s(cpu_fpr[a->fd], cpu_fpr[a->fd]);
|
||||
gen_nanbox_s(dest, dest);
|
||||
}
|
||||
set_fpr(a->fd, dest);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -42,10 +46,13 @@ static bool gen_r2f(DisasContext *ctx, arg_fr *a,
|
|||
void (*func)(TCGv, TCGv))
|
||||
{
|
||||
TCGv src = gpr_src(ctx, a->rj, EXT_NONE);
|
||||
TCGv dest = get_fpr(ctx, a->fd);
|
||||
|
||||
CHECK_FPE;
|
||||
|
||||
func(cpu_fpr[a->fd], src);
|
||||
func(dest, src);
|
||||
set_fpr(a->fd, dest);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -53,10 +60,11 @@ static bool gen_f2r(DisasContext *ctx, arg_rf *a,
|
|||
void (*func)(TCGv, TCGv))
|
||||
{
|
||||
TCGv dest = gpr_dst(ctx, a->rd, EXT_NONE);
|
||||
TCGv src = get_fpr(ctx, a->fj);
|
||||
|
||||
CHECK_FPE;
|
||||
|
||||
func(dest, cpu_fpr[a->fj]);
|
||||
func(dest, src);
|
||||
gen_set_gpr(a->rd, dest, EXT_NONE);
|
||||
|
||||
return true;
|
||||
|
@ -124,11 +132,12 @@ static void gen_movfrh2gr_s(TCGv dest, TCGv src)
|
|||
static bool trans_movfr2cf(DisasContext *ctx, arg_movfr2cf *a)
|
||||
{
|
||||
TCGv t0;
|
||||
TCGv src = get_fpr(ctx, a->fj);
|
||||
|
||||
CHECK_FPE;
|
||||
|
||||
t0 = tcg_temp_new();
|
||||
tcg_gen_andi_tl(t0, cpu_fpr[a->fj], 0x1);
|
||||
tcg_gen_andi_tl(t0, src, 0x1);
|
||||
tcg_gen_st8_tl(t0, cpu_env, offsetof(CPULoongArchState, cf[a->cd & 0x7]));
|
||||
|
||||
return true;
|
||||
|
@ -136,10 +145,14 @@ static bool trans_movfr2cf(DisasContext *ctx, arg_movfr2cf *a)
|
|||
|
||||
static bool trans_movcf2fr(DisasContext *ctx, arg_movcf2fr *a)
|
||||
{
|
||||
TCGv dest = get_fpr(ctx, a->fd);
|
||||
|
||||
CHECK_FPE;
|
||||
|
||||
tcg_gen_ld8u_tl(cpu_fpr[a->fd], cpu_env,
|
||||
tcg_gen_ld8u_tl(dest, cpu_env,
|
||||
offsetof(CPULoongArchState, cf[a->cj & 0x7]));
|
||||
set_fpr(a->fd, dest);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue