[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 09/35] target/mips: Add nanoMIPS 48bit instructi
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH 09/35] target/mips: Add nanoMIPS 48bit instructions |
Date: |
Sun, 24 Jun 2018 16:49:23 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
On 06/20/2018 05:05 AM, Yongbok Kim wrote:
> case NM_P48I:
> + insn = cpu_lduw_code(env, ctx->base.pc_next + 4);
Surely split this case out to a new function. And properly form the common,
signed 32-bit offset once before the switch.
> + switch ((ctx->opcode >> 16) & 0x1f) {
> + case NM_LI48:
> + if (rt != 0) {
> + tcg_gen_movi_tl(cpu_gpr[rt],
> + extract32(ctx->opcode, 0, 16) | insn << 16);
The 32-bit constant is to be sign-extended for nanomips 64.
> + }
> + break;
> + case NM_ADDIU48:
> + if (rt != 0) {
> + tcg_gen_addi_tl(cpu_gpr[rt], cpu_gpr[rt],
> + extract32(ctx->opcode, 0, 16) | insn << 16);
Likewise.
> + tcg_gen_ext32s_tl(cpu_gpr[rt], cpu_gpr[rt]);
> + }
> + break;
> + case NM_ADDIUGP48:
> + if (rt != 0) {
> + tcg_gen_addi_tl(cpu_gpr[rt], cpu_gpr[28],
> + extract32(ctx->opcode, 0, 16) | insn << 16);
Likewise.
> + tcg_gen_ext32s_tl(cpu_gpr[rt], cpu_gpr[rt]);
Behaves-like DADDIU[GP48]. Which would indicate using gen_op_addr_add[i].
I know you're only targeting nanomips32 now, but I think you need to be clearer
about all of these 64-bit edge cases now, lest they be very difficult to pick
out later.
> + }
> + break;
> + case NM_ADDIUPC48:
> + if (rt != 0) {
> + int32_t offset = extract32(ctx->opcode, 0, 16) | insn << 16;
> + target_long addr = addr_add(ctx, ctx->base.pc_next + 6,
> offset);
> +
> + tcg_gen_movi_tl(cpu_gpr[rt], addr);
> + tcg_gen_ext32s_tl(cpu_gpr[rt], cpu_gpr[rt]);
Likewise. And the ext32s would be doubly redundant with that already done in
addr_add.
r~
- Re: [Qemu-devel] [PATCH 04/35] target/mips: Add decode_nanomips_opc(), (continued)
- [Qemu-devel] [PATCH 05/35] target/mips: Add nanoMIPS 16bit ld/st instructions, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 06/35] target/mips: Add nanoMIPS pool16c instructions, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 07/35] target/mips: Add nanoMIPS save and restore, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 08/35] target/mips: Add nanoMIPS 32bit instructions, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 09/35] target/mips: Add nanoMIPS 48bit instructions, Yongbok Kim, 2018/06/20
- Re: [Qemu-devel] [PATCH 09/35] target/mips: Add nanoMIPS 48bit instructions,
Richard Henderson <=
- [Qemu-devel] [PATCH 10/35] target/mips: Add nanoMIPS pool32f instructions, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 11/35] target/mips: Add nanoMIPS pool32a0 instructions, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 12/35] target/mips: Add nanoMIPS pool32axf instructions, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 13/35] target/mips: Update gen_flt_ldst(), Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 14/35] target/mips: Add nanoMIPS p_lsx instructions, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 15/35] target/mips: Implement nanoMIPS EXTW instruction, Yongbok Kim, 2018/06/20