aboutsummaryrefslogtreecommitdiff
path: root/target-ppc/translate.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2013-02-19 23:52:16 -0800
committerBlue Swirl <blauwirbel@gmail.com>2013-02-23 17:25:30 +0000
commit146de60dcade65a401c6665ae4b51c2b15dfaa55 (patch)
treeb3aaf3ea1a9bb0ebfd2981b594b9e2322d837594 /target-ppc/translate.c
parentffe30937c89dd67a53bf3f35b962701cd9d8f70e (diff)
target-ppc: Compute addition carry with setcond
Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'target-ppc/translate.c')
-rw-r--r--target-ppc/translate.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 116cf12b3e..fce261b2c3 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -768,36 +768,26 @@ static inline void gen_op_arith_compute_ov(DisasContext *ctx, TCGv arg0,
static inline void gen_op_arith_compute_ca(DisasContext *ctx, TCGv arg1,
TCGv arg2, int sub)
{
- int l1 = gen_new_label();
+ TCGv t0 = tcg_temp_new(), t1 = arg1, t2 = arg2;
#if defined(TARGET_PPC64)
if (!(ctx->sf_mode)) {
- TCGv t0, t1;
- t0 = tcg_temp_new();
- t1 = tcg_temp_new();
-
- tcg_gen_ext32u_tl(t0, arg1);
- tcg_gen_ext32u_tl(t1, arg2);
- if (sub) {
- tcg_gen_brcond_tl(TCG_COND_GTU, t0, t1, l1);
- } else {
- tcg_gen_brcond_tl(TCG_COND_GEU, t0, t1, l1);
- }
- tcg_gen_movi_tl(cpu_ca, 1);
- gen_set_label(l1);
- tcg_temp_free(t0);
- tcg_temp_free(t1);
- } else
+ t1 = t0;
+ tcg_gen_ext32u_tl(t1, arg1);
+ t2 = tcg_temp_new();
+ tcg_gen_ext32u_tl(t2, arg2);
+ }
#endif
- {
- if (sub) {
- tcg_gen_brcond_tl(TCG_COND_GTU, arg1, arg2, l1);
- } else {
- tcg_gen_brcond_tl(TCG_COND_GEU, arg1, arg2, l1);
- }
- tcg_gen_movi_tl(cpu_ca, 1);
- gen_set_label(l1);
+
+ tcg_gen_setcond_tl(sub ? TCG_COND_LEU : TCG_COND_LTU, t0, t1, t2);
+ tcg_gen_or_tl(cpu_ca, cpu_ca, t0);
+
+ tcg_temp_free(t0);
+#if defined(TARGET_PPC64)
+ if (!(ctx->sf_mode)) {
+ tcg_temp_free(t2);
}
+#endif
}
/* Common add function */
@@ -811,7 +801,7 @@ static inline void gen_op_arith_add(DisasContext *ctx, TCGv ret, TCGv arg1,
(!TCGV_EQUAL(ret,arg1) && !TCGV_EQUAL(ret, arg2))) {
t0 = ret;
} else {
- t0 = tcg_temp_local_new();
+ t0 = tcg_temp_new();
}
if (add_ca) {