diff options
author | Richard Henderson <rth@twiddle.net> | 2016-11-16 11:27:03 +0100 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2017-01-10 08:06:11 -0800 |
commit | 9b8514e56efa59549ad642a494ba69e2b0ca4daf (patch) | |
tree | f3006655195a1a2821b0050b5b9a871d3eef5e64 /target/ppc/translate.c | |
parent | 555baef8d0369fea9d0849ef420841665639c209 (diff) | |
download | qemu-9b8514e56efa59549ad642a494ba69e2b0ca4daf.zip qemu-9b8514e56efa59549ad642a494ba69e2b0ca4daf.tar.gz qemu-9b8514e56efa59549ad642a494ba69e2b0ca4daf.tar.bz2 |
target-ppc: Use clz and ctz opcodes
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target/ppc/translate.c')
-rw-r--r-- | target/ppc/translate.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 435c6f0..1224f56 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -1641,7 +1641,13 @@ static void gen_andis_(DisasContext *ctx) /* cntlzw */ static void gen_cntlzw(DisasContext *ctx) { - gen_helper_cntlzw(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)]); + TCGv_i32 t = tcg_temp_new_i32(); + + tcg_gen_trunc_tl_i32(t, cpu_gpr[rS(ctx->opcode)]); + tcg_gen_clzi_i32(t, t, 32); + tcg_gen_extu_i32_tl(cpu_gpr[rA(ctx->opcode)], t); + tcg_temp_free_i32(t); + if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); } @@ -1649,7 +1655,13 @@ static void gen_cntlzw(DisasContext *ctx) /* cnttzw */ static void gen_cnttzw(DisasContext *ctx) { - gen_helper_cnttzw(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)]); + TCGv_i32 t = tcg_temp_new_i32(); + + tcg_gen_trunc_tl_i32(t, cpu_gpr[rS(ctx->opcode)]); + tcg_gen_ctzi_i32(t, t, 32); + tcg_gen_extu_i32_tl(cpu_gpr[rA(ctx->opcode)], t); + tcg_temp_free_i32(t); + if (unlikely(Rc(ctx->opcode) != 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); } @@ -1891,7 +1903,7 @@ GEN_LOGICAL1(extsw, tcg_gen_ext32s_tl, 0x1E, PPC_64B); /* cntlzd */ static void gen_cntlzd(DisasContext *ctx) { - gen_helper_cntlzd(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)]); + tcg_gen_clzi_i64(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], 64); if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); } @@ -1899,7 +1911,7 @@ static void gen_cntlzd(DisasContext *ctx) /* cnttzd */ static void gen_cnttzd(DisasContext *ctx) { - gen_helper_cnttzd(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)]); + tcg_gen_ctzi_i64(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], 64); if (unlikely(Rc(ctx->opcode) != 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); } |