target/mips: Add emulation of DSP ASE for nanoMIPS - part 6

Add emulation of DSP ASE instructions for nanoMIPS - part 6.

Backports commit 0b591184a2d0686b8f2c5fb27cc9fe2f60752d57 from qemu
This commit is contained in:
Stefan Markovic 2018-08-27 06:47:57 -04:00 committed by Lioncash
parent ba7d8bc0ab
commit 38f2640a34
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -18036,6 +18036,61 @@ static void gen_pool32axf_4_nanomips_insn(DisasContext *ctx, uint32_t opc,
tcg_temp_free(tcg_ctx, t0);
}
static void gen_pool32axf_7_nanomips_insn(DisasContext *ctx, uint32_t opc,
int rt, int rs, int rd)
{
TCGContext *tcg_ctx = ctx->uc->tcg_ctx;
TCGv t0 = tcg_temp_new(tcg_ctx);
TCGv rs_t = tcg_temp_new(tcg_ctx);
gen_load_gpr(ctx, rs_t, rs);
switch (opc) {
case NM_SHRA_R_QB:
check_dspr2(ctx);
tcg_gen_movi_tl(tcg_ctx, t0, rd >> 2);
switch (extract32(ctx->opcode, 12, 1)) {
case 0:
/* NM_SHRA_QB */
gen_helper_shra_qb(tcg_ctx, t0, t0, rs_t);
gen_store_gpr(tcg_ctx, t0, rt);
break;
case 1:
/* NM_SHRA_R_QB */
gen_helper_shra_r_qb(tcg_ctx, t0, t0, rs_t);
gen_store_gpr(tcg_ctx, t0, rt);
break;
}
break;
case NM_SHRL_PH:
check_dspr2(ctx);
tcg_gen_movi_tl(tcg_ctx, t0, rd >> 1);
gen_helper_shrl_ph(tcg_ctx, t0, t0, rs_t);
gen_store_gpr(tcg_ctx, t0, rt);
break;
case NM_REPL_QB:
check_dsp(ctx);
{
int16_t imm;
target_long result;
imm = extract32(ctx->opcode, 13, 8);
result = (uint32_t)imm << 24 |
(uint32_t)imm << 16 |
(uint32_t)imm << 8 |
(uint32_t)imm;
result = (int32_t)result;
tcg_gen_movi_tl(tcg_ctx, t0, result);
gen_store_gpr(tcg_ctx, t0, rt);
}
break;
default:
generate_exception_end(ctx, EXCP_RI);
break;
}
tcg_temp_free(tcg_ctx, t0);
tcg_temp_free(tcg_ctx, rs_t);
}
static void gen_pool32axf_nanomips_insn(CPUMIPSState *env, DisasContext *ctx)
{
@ -18132,6 +18187,10 @@ static void gen_pool32axf_nanomips_insn(CPUMIPSState *env, DisasContext *ctx)
}
break;
case NM_POOL32AXF_7:
{
int32_t op1 = extract32(ctx->opcode, 9, 3);
gen_pool32axf_7_nanomips_insn(ctx, op1, rt, rs, rd);
}
break;
default:
generate_exception_end(ctx, EXCP_RI);