[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 143/147] target-s390: Tidy comparisons
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 143/147] target-s390: Tidy comparisons |
Date: |
Thu, 27 Sep 2012 18:20:29 -0700 |
After full conversion, we can audit the uses of LTGT cc ops
and see that none of the instructions can ever set CC=3.
Thus we can extend the table to treat that bit as ignored.
This fixes a regression wrt the pre-conversion translation
in which NE was used for both m=6 and m=7.
Signed-off-by: Richard Henderson <address@hidden>
---
target-s390x/translate.c | 39 +++++++++++++++++----------------------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index a68e4a3..11f7f36 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -577,30 +577,29 @@ static void account_inline_branch(DisasContext *s, int
cc_op)
}
/* Table of mask values to comparison codes, given a comparison as input.
- For a true comparison CC=3 will never be set, but we treat this
- conservatively for possible use when CC=3 indicates overflow. */
+ For such, CC=3 should not be possible. */
static const TCGCond ltgt_cond[16] = {
TCG_COND_NEVER, TCG_COND_NEVER, /* | | | x */
- TCG_COND_GT, TCG_COND_NEVER, /* | | GT | x */
- TCG_COND_LT, TCG_COND_NEVER, /* | LT | | x */
- TCG_COND_NE, TCG_COND_NEVER, /* | LT | GT | x */
- TCG_COND_EQ, TCG_COND_NEVER, /* EQ | | | x */
- TCG_COND_GE, TCG_COND_NEVER, /* EQ | | GT | x */
- TCG_COND_LE, TCG_COND_NEVER, /* EQ | LT | | x */
+ TCG_COND_GT, TCG_COND_GT, /* | | GT | x */
+ TCG_COND_LT, TCG_COND_LT, /* | LT | | x */
+ TCG_COND_NE, TCG_COND_NE, /* | LT | GT | x */
+ TCG_COND_EQ, TCG_COND_EQ, /* EQ | | | x */
+ TCG_COND_GE, TCG_COND_GE, /* EQ | | GT | x */
+ TCG_COND_LE, TCG_COND_LE, /* EQ | LT | | x */
TCG_COND_ALWAYS, TCG_COND_ALWAYS, /* EQ | LT | GT | x */
};
/* Table of mask values to comparison codes, given a logic op as input.
For such, only CC=0 and CC=1 should be possible. */
static const TCGCond nz_cond[16] = {
- /* | | x | x */
- TCG_COND_NEVER, TCG_COND_NEVER, TCG_COND_NEVER, TCG_COND_NEVER,
- /* | NE | x | x */
- TCG_COND_NE, TCG_COND_NE, TCG_COND_NE, TCG_COND_NE,
- /* EQ | | x | x */
- TCG_COND_EQ, TCG_COND_EQ, TCG_COND_EQ, TCG_COND_EQ,
- /* EQ | NE | x | x */
- TCG_COND_ALWAYS, TCG_COND_ALWAYS, TCG_COND_ALWAYS, TCG_COND_ALWAYS,
+ TCG_COND_NEVER, TCG_COND_NEVER, /* | | x | x */
+ TCG_COND_NEVER, TCG_COND_NEVER,
+ TCG_COND_NE, TCG_COND_NE, /* | NE | x | x */
+ TCG_COND_NE, TCG_COND_NE,
+ TCG_COND_EQ, TCG_COND_EQ, /* EQ | | x | x */
+ TCG_COND_EQ, TCG_COND_EQ,
+ TCG_COND_ALWAYS, TCG_COND_ALWAYS, /* EQ | NE | x | x */
+ TCG_COND_ALWAYS, TCG_COND_ALWAYS,
};
/* Interpret MASK in terms of S->CC_OP, and fill in C with all the
@@ -1463,9 +1462,7 @@ static ExitStatus op_cj(DisasContext *s, DisasOps *o)
bool is_imm;
DisasCompare c;
- /* Bit 3 of the m3 field is reserved and should be zero.
- Choose to ignore it wrt the ltgt_cond table above. */
- c.cond = ltgt_cond[m3 & 14];
+ c.cond = ltgt_cond[m3];
if (s->insn->data) {
c.cond = tcg_unsigned_cond(c.cond);
}
@@ -1831,9 +1828,7 @@ static ExitStatus op_ct(DisasContext *s, DisasOps *o)
TCGv_i32 t;
TCGCond c;
- /* Bit 3 of the m3 field is reserved and should be zero.
- Choose to ignore it wrt the ltgt_cond table above. */
- c = tcg_invert_cond(ltgt_cond[m3 & 14]);
+ c = tcg_invert_cond(ltgt_cond[m3]);
if (s->insn->data) {
c = tcg_unsigned_cond(c);
}
--
1.7.11.4
- [Qemu-devel] [PATCH 133/147] target-s390: Check insn operand specifications, (continued)
- [Qemu-devel] [PATCH 133/147] target-s390: Check insn operand specifications, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 134/147] target-s390: Implement LCDFR, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 135/147] softfloat: Fix uint64_to_float64, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 136/147] softfloat: Implement uint64_to_float128, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 137/147] target-s390: Use uint64_to_float128, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 138/147] target-s390: Implement SET ROUNDING MODE, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 139/147] target-s390: Implement LOAD/SET FP AND SIGNAL, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 140/147] target-s390: Fix cpu_clone_regs, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 141/147] target-s390: Optimize XC, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 142/147] target-s390: Optmize emitting discards, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 143/147] target-s390: Tidy comparisons,
Richard Henderson <=
- [Qemu-devel] [PATCH 144/147] target-s390: Optimize ADDU/SUBU CC testing, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 145/147] target-s390: Optimize ADDC/SUBB, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 146/147] target-s390: Optimize get_address, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 147/147] target-s390: Perform COMPARE AND SWAP inline, Richard Henderson, 2012/09/27