[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/3] target/mips: Add emulation of MMI instructi
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH 2/3] target/mips: Add emulation of MMI instruction PCPYLD |
Date: |
Mon, 25 Feb 2019 14:20:29 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
On 2/25/19 8:10 AM, Mateja Marjanovic wrote:
> + if (rd == 0) {
> + /* nop */
> + } else if ((rt == 0) && (rs == 0)) {
> + tcg_gen_movi_i64(cpu_gpr[rt], 0);
> + tcg_gen_movi_i64(cpu_mmr[rt], 0);
> + } else if (rt == 0) {
> + tcg_gen_movi_i64(cpu_gpr[rd], 0);
> + tcg_gen_mov_i64(cpu_mmr[rd], cpu_gpr[rs]);
> + } else if (rs == 0) {
> + tcg_gen_mov_i64(cpu_gpr[rd], cpu_gpr[rt]);
> + tcg_gen_movi_i64(cpu_mmr[rd], 0);
> + } else {
> + tcg_gen_mov_i64(cpu_gpr[rd], cpu_gpr[rt]);
> + tcg_gen_mov_i64(cpu_mmr[rd], cpu_gpr[rs]);
> + }
You should avoid multiplying the cases this way.
The same results can be had with
if (rd != 0) {
gen_load_gpr(cpu_gpr[rd], rt);
gen_load_gpr(cpu_mmr[rd], rs);
}
r~