[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 57/62] tcg-s390: Use the COMPARE IMMEDIATE instrucio
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 57/62] tcg-s390: Use the COMPARE IMMEDIATE instrucions for compares. |
Date: |
Thu, 27 May 2010 13:46:39 -0700 |
These instructions are available with extended-immediate facility.
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/s390/tcg-target.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
index edae6a8..5af8bc9 100644
--- a/tcg/s390/tcg-target.c
+++ b/tcg/s390/tcg-target.c
@@ -70,6 +70,10 @@ typedef enum S390Opcode {
RIL_ALGFI = 0xc20a,
RIL_BRASL = 0xc005,
RIL_BRCL = 0xc004,
+ RIL_CFI = 0xc20d,
+ RIL_CGFI = 0xc20c,
+ RIL_CLFI = 0xc20f,
+ RIL_CLGFI = 0xc20e,
RIL_IIHF = 0xc008,
RIL_IILF = 0xc009,
RIL_LARL = 0xc000,
@@ -527,7 +531,29 @@ static int tcg_match_xori(int ct, tcg_target_long val)
static int tcg_match_cmpi(int ct, tcg_target_long val)
{
- return (val == 0);
+ if (facilities & FACILITY_EXT_IMM) {
+ /* The COMPARE IMMEDIATE instruction is available. */
+ if (ct & TCG_CT_CONST_32) {
+ /* We have a 32-bit immediate and can compare against anything. */
+ return 1;
+ } else {
+ /* ??? We have no insight here into whether the comparison is
+ signed or unsigned. The COMPARE IMMEDIATE insn uses a 32-bit
+ signed immediate, and the COMPARE LOGICAL IMMEDIATE insn uses
+ a 32-bit unsigned immediate. If we were to use the (semi)
+ obvious "val == (int32_t)val" we would be enabling unsigned
+ comparisons vs very large numbers. The only solution is to
+ take the intersection of the ranges. */
+ /* ??? Another possible solution is to simply lie and allow all
+ constants here and force the out-of-range values into a temp
+ register in tgen_cmp when we have knowledge of the actual
+ comparison code in use. */
+ return val >= 0 && val <= 0x7fffffff;
+ }
+ } else {
+ /* Only the LOAD AND TEST instruction is available. */
+ return val == 0;
+ }
}
/* Test if a constant matches the constraint. */
@@ -1083,7 +1109,21 @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond
c, TCGReg r1,
}
return tcg_cond_to_ltr_cond[c];
} else {
- tcg_abort();
+ if (c > TCG_COND_GT) {
+ /* unsigned */
+ if (type == TCG_TYPE_I32) {
+ tcg_out_insn(s, RIL, CLFI, r1, c2);
+ } else {
+ tcg_out_insn(s, RIL, CLGFI, r1, c2);
+ }
+ } else {
+ /* signed */
+ if (type == TCG_TYPE_I32) {
+ tcg_out_insn(s, RIL, CFI, r1, c2);
+ } else {
+ tcg_out_insn(s, RIL, CGFI, r1, c2);
+ }
+ }
}
} else {
if (c > TCG_COND_GT) {
--
1.7.0.1
- [Qemu-devel] [PATCH 48/62] tcg-s390: Conditionalize ADD IMMEDIATE instructions., (continued)
- [Qemu-devel] [PATCH 48/62] tcg-s390: Conditionalize ADD IMMEDIATE instructions., Richard Henderson, 2010/05/27
- [Qemu-devel] [PATCH 46/62] tcg-s390: Query instruction extensions that are installed., Richard Henderson, 2010/05/27
- [Qemu-devel] [PATCH 50/62] tcg-s390: Conditionalize 8 and 16 bit extensions., Richard Henderson, 2010/05/27
- [Qemu-devel] [PATCH 49/62] tcg-s390: Conditionalize LOAD IMMEDIATE instructions., Richard Henderson, 2010/05/27
- [Qemu-devel] [PATCH 51/62] tcg-s390: Conditionalize AND IMMEDIATE instructions., Richard Henderson, 2010/05/27
- [Qemu-devel] [PATCH 52/62] tcg-s390: Conditionalize OR IMMEDIATE instructions., Richard Henderson, 2010/05/27
- [Qemu-devel] [PATCH 53/62] tcg-s390: Conditionalize XOR IMMEDIATE instructions., Richard Henderson, 2010/05/27
- [Qemu-devel] [PATCH 54/62] tcg-s390: Do not require the extended-immediate facility., Richard Henderson, 2010/05/27
- [Qemu-devel] [PATCH 55/62] tcg-s390: Use 16-bit branches for forward jumps., Richard Henderson, 2010/05/27
- [Qemu-devel] [PATCH 56/62] tcg-s390: Use the LOAD AND TEST instruction for compares., Richard Henderson, 2010/05/27
- [Qemu-devel] [PATCH 57/62] tcg-s390: Use the COMPARE IMMEDIATE instrucions for compares.,
Richard Henderson <=
- [Qemu-devel] [PATCH 58/62] tcg-s390: Use COMPARE AND BRANCH instructions., Richard Henderson, 2010/05/27
- [Qemu-devel] [PATCH 61/62] tcg-s390: Enable compile in 32-bit mode., Richard Henderson, 2010/05/27
- [Qemu-devel] [PATCH 59/62] tcg-s390: Generalize load/store support., Richard Henderson, 2010/05/27
- [Qemu-devel] [PATCH 60/62] tcg-s390: Fix TLB comparison width., Richard Henderson, 2010/05/27
- [Qemu-devel] [PATCH 62/62] tcg: Optionally sign-extend 32-bit arguments for 64-bit host., Richard Henderson, 2010/05/27
- Re: [Qemu-devel] [PATCH 00/62] s390x tcg target, Blue Swirl, 2010/05/27