aboutsummaryrefslogtreecommitdiff
path: root/target/ppc/translate
diff options
context:
space:
mode:
authorMatheus Ferst <matheus.ferst@eldorado.org.br>2021-11-04 09:37:19 -0300
committerDavid Gibson <david@gibson.dropbear.id.au>2021-11-09 10:32:53 +1100
commitab1e25ad2f2fcc3c3d0f01b24f272a2bc2a42e3e (patch)
treeccf6b010ede86c840b501f8e39572e45c1edacde /target/ppc/translate
parent6e26b85de5f00629e074aef9260a7632a8978f08 (diff)
target/ppc: cntlzdm/cnttzdm implementation without brcond
Suggested-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br> Message-Id: <20211104123719.323713-26-matheus.ferst@eldorado.org.br> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'target/ppc/translate')
-rw-r--r--target/ppc/translate/fixedpoint-impl.c.inc31
1 files changed, 16 insertions, 15 deletions
diff --git a/target/ppc/translate/fixedpoint-impl.c.inc b/target/ppc/translate/fixedpoint-impl.c.inc
index e093562e2a..7fecff4579 100644
--- a/target/ppc/translate/fixedpoint-impl.c.inc
+++ b/target/ppc/translate/fixedpoint-impl.c.inc
@@ -416,32 +416,33 @@ static bool trans_CFUGED(DisasContext *ctx, arg_X *a)
static void do_cntzdm(TCGv_i64 dst, TCGv_i64 src, TCGv_i64 mask, int64_t trail)
{
- TCGv_i64 tmp;
- TCGLabel *l1;
+ TCGv_i64 t0, t1;
- tmp = tcg_temp_local_new_i64();
- l1 = gen_new_label();
+ t0 = tcg_temp_new_i64();
+ t1 = tcg_temp_new_i64();
- tcg_gen_and_i64(tmp, src, mask);
+ tcg_gen_and_i64(t0, src, mask);
if (trail) {
- tcg_gen_ctzi_i64(tmp, tmp, 64);
+ tcg_gen_ctzi_i64(t0, t0, -1);
} else {
- tcg_gen_clzi_i64(tmp, tmp, 64);
+ tcg_gen_clzi_i64(t0, t0, -1);
}
- tcg_gen_brcondi_i64(TCG_COND_EQ, tmp, 0, l1);
-
- tcg_gen_subfi_i64(tmp, 64, tmp);
+ tcg_gen_setcondi_i64(TCG_COND_NE, t1, t0, -1);
+ tcg_gen_andi_i64(t0, t0, 63);
+ tcg_gen_xori_i64(t0, t0, 63);
if (trail) {
- tcg_gen_shl_i64(tmp, mask, tmp);
+ tcg_gen_shl_i64(t0, mask, t0);
+ tcg_gen_shl_i64(t0, t0, t1);
} else {
- tcg_gen_shr_i64(tmp, mask, tmp);
+ tcg_gen_shr_i64(t0, mask, t0);
+ tcg_gen_shr_i64(t0, t0, t1);
}
- tcg_gen_ctpop_i64(tmp, tmp);
- gen_set_label(l1);
+ tcg_gen_ctpop_i64(dst, t0);
- tcg_gen_mov_i64(dst, tmp);
+ tcg_temp_free_i64(t0);
+ tcg_temp_free_i64(t1);
}
static bool trans_CNTLZDM(DisasContext *ctx, arg_X *a)