target/mips: Fix emulation of microMIPS R6 <SELEQZ|SELNEZ>.<D|S>

Fix emulation of microMIPS R6 <SELEQZ|SELNEZ>.<D|S> instructions.
Their handling was permuted.

Backports commit fdac60cd0458f34b2e79d74a55bec10836e26471 from qemu
This commit is contained in:
Matthew Fortune 2018-10-23 14:31:02 -04:00 committed by Lioncash
parent 73c2955d2b
commit 255ced3c1a
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -15754,15 +15754,15 @@ static void decode_micromips32_opc(CPUMIPSState *env, DisasContext *ctx)
case 0x38: case 0x38:
/* cmovs */ /* cmovs */
switch ((ctx->opcode >> 6) & 0x7) { switch ((ctx->opcode >> 6) & 0x7) {
case MOVN_FMT: /* SELNEZ_FMT */ case MOVN_FMT: /* SELEQZ_FMT */
if (ctx->insn_flags & ISA_MIPS32R6) { if (ctx->insn_flags & ISA_MIPS32R6) {
/* SELNEZ_FMT */ /* SELEQZ_FMT */
switch ((ctx->opcode >> 9) & 0x3) { switch ((ctx->opcode >> 9) & 0x3) {
case FMT_SDPS_S: case FMT_SDPS_S:
gen_sel_s(ctx, OPC_SELNEZ_S, rd, rt, rs); gen_sel_s(ctx, OPC_SELEQZ_S, rd, rt, rs);
break; break;
case FMT_SDPS_D: case FMT_SDPS_D:
gen_sel_d(ctx, OPC_SELNEZ_D, rd, rt, rs); gen_sel_d(ctx, OPC_SELEQZ_D, rd, rt, rs);
break; break;
default: default:
goto pool32f_invalid; goto pool32f_invalid;
@ -15776,15 +15776,15 @@ static void decode_micromips32_opc(CPUMIPSState *env, DisasContext *ctx)
check_insn_opc_removed(ctx, ISA_MIPS32R6); check_insn_opc_removed(ctx, ISA_MIPS32R6);
FINSN_3ARG_SDPS(MOVN); FINSN_3ARG_SDPS(MOVN);
break; break;
case MOVZ_FMT: /* SELEQZ_FMT */ case MOVZ_FMT: /* SELNEZ_FMT */
if (ctx->insn_flags & ISA_MIPS32R6) { if (ctx->insn_flags & ISA_MIPS32R6) {
/* SELEQZ_FMT */ /* SELNEZ_FMT */
switch ((ctx->opcode >> 9) & 0x3) { switch ((ctx->opcode >> 9) & 0x3) {
case FMT_SDPS_S: case FMT_SDPS_S:
gen_sel_s(ctx, OPC_SELEQZ_S, rd, rt, rs); gen_sel_s(ctx, OPC_SELNEZ_S, rd, rt, rs);
break; break;
case FMT_SDPS_D: case FMT_SDPS_D:
gen_sel_d(ctx, OPC_SELEQZ_D, rd, rt, rs); gen_sel_d(ctx, OPC_SELNEZ_D, rd, rt, rs);
break; break;
default: default:
goto pool32f_invalid; goto pool32f_invalid;