target-mips: Make repl_ph to sign extend to target-long

The immediate value is 9bits, should sign-extend to 16bits. The return value to
register should sign-extend to target_long, as Richard says, removing an
unnecessary cast works fun.

Signed-off-by: Dongxue Zhang <elta.era@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
Jovanovic, Petar 2012-12-11 15:06:35 +00:00 committed by Aurelien Jarno
parent fe65a1fad6
commit c4aaba92e5
1 changed files with 2 additions and 1 deletions

View File

@ -13769,9 +13769,10 @@ static void gen_mipsdsp_bitinsn(CPUMIPSState *env, DisasContext *ctx,
check_dsp(ctx); check_dsp(ctx);
{ {
imm = (ctx->opcode >> 16) & 0x03FF; imm = (ctx->opcode >> 16) & 0x03FF;
imm = (int16_t)(imm << 6) >> 6;
tcg_gen_movi_tl(cpu_gpr[ret], \ tcg_gen_movi_tl(cpu_gpr[ret], \
(target_long)((int32_t)imm << 16 | \ (target_long)((int32_t)imm << 16 | \
(uint32_t)(uint16_t)imm)); (uint16_t)imm));
} }
break; break;
case OPC_REPLV_PH: case OPC_REPLV_PH: