[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/13] tcg-sparc: Fix setcond2
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 04/13] tcg-sparc: Fix setcond2 |
Date: |
Wed, 10 Oct 2012 09:02:38 -0700 |
Like brcond2, use tcg_high_cond. Use movcc instead of branches.
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/sparc/tcg-target.c | 38 ++++++++++++++++++--------------------
1 file changed, 18 insertions(+), 20 deletions(-)
diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c
index 79530ec..bdc282d 100644
--- a/tcg/sparc/tcg-target.c
+++ b/tcg/sparc/tcg-target.c
@@ -337,7 +337,9 @@ static void tcg_out_arithc(TCGContext *s, int rd, int rs1,
static inline void tcg_out_mov(TCGContext *s, TCGType type,
TCGReg ret, TCGReg arg)
{
- tcg_out_arith(s, ret, arg, TCG_REG_G0, ARITH_OR);
+ if (ret != arg) {
+ tcg_out_arith(s, ret, arg, TCG_REG_G0, ARITH_OR);
+ }
}
static inline void tcg_out_sethi(TCGContext *s, int ret, uint32_t arg)
@@ -671,33 +673,29 @@ static void tcg_out_setcond2_i32(TCGContext *s, TCGCond
cond, TCGArg ret,
TCGArg bl, int blconst,
TCGArg bh, int bhconst)
{
- int lab;
+ int tmp = TCG_REG_T1;
+
+ /* Note that the low parts are fully consumed before tmp is set. */
+ if (ret != ah && (bhconst || ret != bh)) {
+ tmp = ret;
+ }
switch (cond) {
case TCG_COND_EQ:
- tcg_out_setcond_i32(s, TCG_COND_EQ, TCG_REG_T1, al, bl, blconst);
- tcg_out_setcond_i32(s, TCG_COND_EQ, ret, ah, bh, bhconst);
- tcg_out_arith(s, ret, ret, TCG_REG_T1, ARITH_AND);
- break;
-
case TCG_COND_NE:
- tcg_out_setcond_i32(s, TCG_COND_NE, TCG_REG_T1, al, al, blconst);
- tcg_out_setcond_i32(s, TCG_COND_NE, ret, ah, bh, bhconst);
- tcg_out_arith(s, ret, ret, TCG_REG_T1, ARITH_OR);
+ tcg_out_setcond_i32(s, cond, tmp, al, bl, blconst);
+ tcg_out_cmp(s, ah, bh, bhconst);
+ tcg_out_mov(s, TCG_TYPE_I32, ret, tmp);
+ tcg_out_movcc(s, TCG_COND_NE, MOVCC_ICC, ret, cond == TCG_COND_NE, 1);
break;
default:
- lab = gen_new_label();
-
+ /* <= : ah < bh | (ah == bh && al <= bl) */
+ tcg_out_setcond_i32(s, tcg_unsigned_cond(cond), tmp, al, bl, blconst);
tcg_out_cmp(s, ah, bh, bhconst);
- tcg_out_branch_i32(s, INSN_COND(tcg_cond_to_bcond[cond], 1), lab);
- tcg_out_movi_imm13(s, ret, 1);
- tcg_out_branch_i32(s, INSN_COND(COND_NE, 1), lab);
- tcg_out_movi_imm13(s, ret, 0);
-
- tcg_out_setcond_i32(s, tcg_unsigned_cond(cond), ret, al, bl, blconst);
-
- tcg_out_label(s, lab, s->code_ptr);
+ tcg_out_mov(s, TCG_TYPE_I32, ret, tmp);
+ tcg_out_movcc(s, TCG_COND_NE, MOVCC_ICC, ret, 0, 1);
+ tcg_out_movcc(s, tcg_high_cond(cond), MOVCC_ICC, ret, 1, 1);
break;
}
}
--
1.7.11.4
- [Qemu-devel] [PATCH v2 00/13] tcg-sparc fixes and improvements, Richard Henderson, 2012/10/10
- [Qemu-devel] [PATCH 01/13] target-sparc: Fix optimized %icc comparisons, Richard Henderson, 2012/10/10
- [Qemu-devel] [PATCH 02/13] tcg-sparc: Fix brcond2, Richard Henderson, 2012/10/10
- [Qemu-devel] [PATCH 03/13] tcg-sparc: Implement movcond., Richard Henderson, 2012/10/10
- [Qemu-devel] [PATCH 11/13] tcg-sparc: Dump illegal opode contents, Richard Henderson, 2012/10/10
- [Qemu-devel] [PATCH 05/13] tcg-sparc: Fix qemu_st for 32-bit, Richard Henderson, 2012/10/10
- [Qemu-devel] [PATCH 07/13] tcg-sparc: Fix add2/sub2, Richard Henderson, 2012/10/10
- [Qemu-devel] [PATCH 04/13] tcg-sparc: Fix setcond2,
Richard Henderson <=
- [Qemu-devel] [PATCH 13/13] tcg-sparc: Emit MOVR insns for setcond_i64 and movcond_64, Richard Henderson, 2012/10/10
- [Qemu-devel] [PATCH 09/13] tcg-sparc: Optimize setcond2 equality compare with 0., Richard Henderson, 2012/10/10
- [Qemu-devel] [PATCH 08/13] tcg-sparc: Use Z constraint for %g0, Richard Henderson, 2012/10/10
- [Qemu-devel] [PATCH 12/13] tcg-sparc: Emit BPr insns for brcond_i64, Richard Henderson, 2012/10/10
- [Qemu-devel] [PATCH 06/13] tcg-sparc: Fix setcond, Richard Henderson, 2012/10/10
- [Qemu-devel] [PATCH 10/13] tcg-sparc: Drop use of Bicc in favor of BPcc, Richard Henderson, 2012/10/10
- Re: [Qemu-devel] [PATCH v2 00/13] tcg-sparc fixes and improvements, Blue Swirl, 2012/10/13