Skip to content

Commit

Permalink
target-mips: Use the new extract op
Browse files Browse the repository at this point in the history
Use extract for EXT and DEXT.

Reviewed-by: Yongbok Kim <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
  • Loading branch information
rth7680 committed Jan 10, 2017
1 parent 04fc2f1 commit 6eebb7a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions target/mips/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -4488,11 +4488,12 @@ static void gen_bitops (DisasContext *ctx, uint32_t opc, int rt,
if (lsb + msb > 31) {
goto fail;
}
tcg_gen_shri_tl(t0, t1, lsb);
if (msb != 31) {
tcg_gen_andi_tl(t0, t0, (1U << (msb + 1)) - 1);
tcg_gen_extract_tl(t0, t1, lsb, msb + 1);
} else {
tcg_gen_ext32s_tl(t0, t0);
/* The two checks together imply that lsb == 0,
so this is a simple sign-extension. */
tcg_gen_ext32s_tl(t0, t1);
}
break;
#if defined(TARGET_MIPS64)
Expand All @@ -4507,10 +4508,7 @@ static void gen_bitops (DisasContext *ctx, uint32_t opc, int rt,
if (lsb + msb > 63) {
goto fail;
}
tcg_gen_shri_tl(t0, t1, lsb);
if (msb != 63) {
tcg_gen_andi_tl(t0, t0, (1ULL << (msb + 1)) - 1);
}
tcg_gen_extract_tl(t0, t1, lsb, msb + 1);
break;
#endif
case OPC_INS:
Expand Down

0 comments on commit 6eebb7a

Please sign in to comment.