[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/7] target-alpha: Use setcond/movcond in integer co
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 3/7] target-alpha: Use setcond/movcond in integer compares and cmoves. |
Date: |
Tue, 15 Dec 2009 16:36:49 -0800 |
Limited usage of setcond/movcond to enable testing in the code generator.
Signed-off-by: Richard Henderson <address@hidden>
---
target-alpha/translate.c | 66 +++++++++++++++++++++------------------------
1 files changed, 31 insertions(+), 35 deletions(-)
diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 7b6ff2a..f51d4ef 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -391,33 +391,33 @@ static void gen_fbcond(DisasContext *ctx, TCGCond cond,
int ra, int32_t disp)
static inline void gen_cmov(TCGCond inv_cond, int ra, int rb, int rc,
int islit, uint8_t lit, int mask)
{
- int l1;
+ TCGv va, vb, zero;
if (unlikely(rc == 31))
return;
- l1 = gen_new_label();
-
- if (ra != 31) {
- if (mask) {
- TCGv tmp = tcg_temp_new();
- tcg_gen_andi_i64(tmp, cpu_ir[ra], 1);
- tcg_gen_brcondi_i64(inv_cond, tmp, 0, l1);
- tcg_temp_free(tmp);
- } else
- tcg_gen_brcondi_i64(inv_cond, cpu_ir[ra], 0, l1);
+ zero = tcg_const_i64(0);
+ if (ra == 31) {
+ va = zero;
+ } else if (mask) {
+ va = tcg_temp_new();
+ tcg_gen_andi_i64(va, cpu_ir[ra], 1);
} else {
- /* Very uncommon case - Do not bother to optimize. */
- TCGv tmp = tcg_const_i64(0);
- tcg_gen_brcondi_i64(inv_cond, tmp, 0, l1);
- tcg_temp_free(tmp);
+ va = cpu_ir[ra];
}
if (islit)
- tcg_gen_movi_i64(cpu_ir[rc], lit);
+ vb = tcg_const_i64(lit);
else
- tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]);
- gen_set_label(l1);
+ vb = cpu_ir[rb];
+
+ tcg_gen_movcond_i64(inv_cond, cpu_ir[rc], va, zero, cpu_ir[rc], vb);
+
+ tcg_temp_free(zero);
+ if (mask && ra != 31)
+ tcg_temp_free(va);
+ if (islit)
+ tcg_temp_free(vb);
}
static void gen_fcmov(TCGCond inv_cond, int ra, int rb, int rc)
@@ -873,30 +873,26 @@ MVIOP2(unpkbw)
static inline void gen_cmp(TCGCond cond, int ra, int rb, int rc, int islit,
uint8_t lit)
{
- int l1, l2;
- TCGv tmp;
+ TCGv va, vb;
if (unlikely(rc == 31))
return;
- l1 = gen_new_label();
- l2 = gen_new_label();
-
- if (ra != 31) {
- tmp = tcg_temp_new();
- tcg_gen_mov_i64(tmp, cpu_ir[ra]);
- } else
- tmp = tcg_const_i64(0);
+ if (ra == 31)
+ va = tcg_const_i64(0);
+ else
+ va = cpu_ir[ra];
if (islit)
- tcg_gen_brcondi_i64(cond, tmp, lit, l1);
+ vb = tcg_const_i64(lit);
else
- tcg_gen_brcond_i64(cond, tmp, cpu_ir[rb], l1);
+ vb = cpu_ir[rb];
- tcg_gen_movi_i64(cpu_ir[rc], 0);
- tcg_gen_br(l2);
- gen_set_label(l1);
- tcg_gen_movi_i64(cpu_ir[rc], 1);
- gen_set_label(l2);
+ tcg_gen_setcond_i64(cond, cpu_ir[rc], va, vb);
+
+ if (ra == 31)
+ tcg_temp_free(va);
+ if (islit)
+ tcg_temp_free(vb);
}
static inline int translate_one(DisasContext *ctx, uint32_t insn)
--
1.6.2.5
- [Qemu-devel] [PATCH 0/7] tcg: conditional set and move opcodes, Richard Henderson, 2009/12/16
- [Qemu-devel] [PATCH 1/7] tcg: Generic support for conditional set and conditional move., Richard Henderson, 2009/12/16
- [Qemu-devel] [PATCH 2/7] tcg-amd64: Implement setcond and movcond., Richard Henderson, 2009/12/16
- [Qemu-devel] [PATCH 3/7] target-alpha: Use setcond/movcond in integer compares and cmoves.,
Richard Henderson <=
- [Qemu-devel] [PATCH 4/7] tcg-i386: Implement setcond, movcond, setcond2., Richard Henderson, 2009/12/16
- [Qemu-devel] [PATCH 6/7] target-i386: Use setcond and movcond., Richard Henderson, 2009/12/16
- [Qemu-devel] [PATCH 5/7] tcg-sparc: Implement setcond, movcond, setcond2, brcond2., Richard Henderson, 2009/12/16
- Re: [Qemu-devel] [PATCH 5/7] tcg-sparc: Implement setcond, movcond, setcond2, brcond2., Blue Swirl, 2009/12/19
- Re: [Qemu-devel] [PATCH 5/7] tcg-sparc: Implement setcond, movcond, setcond2, brcond2., Richard Henderson, 2009/12/19
- Re: [Qemu-devel] [PATCH 5/7] tcg-sparc: Implement setcond, movcond, setcond2, brcond2., Blue Swirl, 2009/12/19
- Re: [Qemu-devel] [PATCH 5/7] tcg-sparc: Implement setcond, movcond, setcond2, brcond2., Richard Henderson, 2009/12/19
- Re: [Qemu-devel] [PATCH 5/7] tcg-sparc: Implement setcond, movcond, setcond2, brcond2., Blue Swirl, 2009/12/20
[Qemu-devel] [PATCH 7/7] target-mips: Use setcond and movcond., Richard Henderson, 2009/12/16
Re: [Qemu-devel] [PATCH 0/7] tcg: conditional set and move opcodes, malc, 2009/12/17