From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PULL 25/27] tcg/s390x: Tighten constraints for 64-bit compare
Date: Fri, 6 Jan 2023 23:51:16 -0800 [thread overview]
Message-ID: <20230107075118.1814503-26-richard.henderson@linaro.org> (raw)
In-Reply-To: <20230107075118.1814503-1-richard.henderson@linaro.org>
Give 64-bit comparison second operand a signed 33-bit immediate.
This is the smallest superset of uint32_t and int32_t, as used
by CLGFI and CGFI respectively. The rest of the 33-bit space
can be loaded into TCG_TMP0. Drop use of the constant pool.
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/s390x/tcg-target-con-set.h | 3 +++
tcg/s390x/tcg-target.c.inc | 27 ++++++++++++++-------------
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/tcg/s390x/tcg-target-con-set.h b/tcg/s390x/tcg-target-con-set.h
index baf3bc9037..15f1c55103 100644
--- a/tcg/s390x/tcg-target-con-set.h
+++ b/tcg/s390x/tcg-target-con-set.h
@@ -13,6 +13,7 @@ C_O0_I1(r)
C_O0_I2(L, L)
C_O0_I2(r, r)
C_O0_I2(r, ri)
+C_O0_I2(r, rA)
C_O0_I2(v, r)
C_O1_I1(r, L)
C_O1_I1(r, r)
@@ -24,6 +25,7 @@ C_O1_I2(r, 0, rI)
C_O1_I2(r, 0, rJ)
C_O1_I2(r, r, r)
C_O1_I2(r, r, ri)
+C_O1_I2(r, r, rA)
C_O1_I2(r, r, rI)
C_O1_I2(r, r, rJ)
C_O1_I2(r, r, rK)
@@ -35,6 +37,7 @@ C_O1_I2(v, v, r)
C_O1_I2(v, v, v)
C_O1_I3(v, v, v, v)
C_O1_I4(r, r, ri, rI, r)
+C_O1_I4(r, r, rA, rI, r)
C_O2_I2(o, m, 0, r)
C_O2_I2(o, m, r, r)
C_O2_I3(o, m, 0, 1, r)
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
index c0434fa2f8..4d113139e5 100644
--- a/tcg/s390x/tcg-target.c.inc
+++ b/tcg/s390x/tcg-target.c.inc
@@ -1249,22 +1249,20 @@ static int tgen_cmp2(TCGContext *s, TCGType type, TCGCond c, TCGReg r1,
tcg_out_insn_RIL(s, op, r1, c2);
goto exit;
}
+
+ /*
+ * Constraints are for a signed 33-bit operand, which is a
+ * convenient superset of this signed/unsigned test.
+ */
if (c2 == (is_unsigned ? (TCGArg)(uint32_t)c2 : (TCGArg)(int32_t)c2)) {
op = (is_unsigned ? RIL_CLGFI : RIL_CGFI);
tcg_out_insn_RIL(s, op, r1, c2);
goto exit;
}
- /* Use the constant pool, but not for small constants. */
- if (maybe_out_small_movi(s, type, TCG_TMP0, c2)) {
- c2 = TCG_TMP0;
- /* fall through to reg-reg */
- } else {
- op = (is_unsigned ? RIL_CLGRL : RIL_CGRL);
- tcg_out_insn_RIL(s, op, r1, 0);
- new_pool_label(s, c2, R_390_PC32DBL, s->code_ptr - 2, 2);
- goto exit;
- }
+ /* Load everything else into a register. */
+ tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, c2);
+ c2 = TCG_TMP0;
}
if (type == TCG_TYPE_I32) {
@@ -3105,8 +3103,9 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
case INDEX_op_rotr_i32:
case INDEX_op_rotr_i64:
case INDEX_op_setcond_i32:
- case INDEX_op_setcond_i64:
return C_O1_I2(r, r, ri);
+ case INDEX_op_setcond_i64:
+ return C_O1_I2(r, r, rA);
case INDEX_op_clz_i64:
return C_O1_I2(r, r, rI);
@@ -3154,8 +3153,9 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
return C_O1_I2(r, r, ri);
case INDEX_op_brcond_i32:
- case INDEX_op_brcond_i64:
return C_O0_I2(r, ri);
+ case INDEX_op_brcond_i64:
+ return C_O0_I2(r, rA);
case INDEX_op_bswap16_i32:
case INDEX_op_bswap16_i64:
@@ -3196,8 +3196,9 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
return C_O1_I2(r, rZ, r);
case INDEX_op_movcond_i32:
- case INDEX_op_movcond_i64:
return C_O1_I4(r, r, ri, rI, r);
+ case INDEX_op_movcond_i64:
+ return C_O1_I4(r, r, rA, rI, r);
case INDEX_op_div2_i32:
case INDEX_op_div2_i64:
--
2.34.1
next prev parent reply other threads:[~2023-01-07 7:53 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-07 7:50 [PULL 00/27] tcg/s390x patch queue Richard Henderson
2023-01-07 7:50 ` [PULL 01/27] tcg/s390x: Use register pair allocation for div and mulu2 Richard Henderson
2023-01-07 7:50 ` [PULL 02/27] tcg/s390x: Remove TCG_REG_TB Richard Henderson
2023-01-07 7:50 ` [PULL 03/27] tcg/s390x: Always set TCG_TARGET_HAS_direct_jump Richard Henderson
2023-01-07 7:50 ` [PULL 04/27] tcg/s390x: Remove USE_LONG_BRANCHES Richard Henderson
2023-01-07 7:50 ` [PULL 05/27] tcg/s390x: Check for long-displacement facility at startup Richard Henderson
2023-01-07 7:50 ` [PULL 06/27] tcg/s390x: Check for extended-immediate " Richard Henderson
2023-01-07 7:50 ` [PULL 07/27] tcg/s390x: Check for general-instruction-extension " Richard Henderson
2023-01-07 7:50 ` [PULL 08/27] tcg/s390x: Check for load-on-condition " Richard Henderson
2023-01-07 7:51 ` [PULL 09/27] tcg/s390x: Remove FAST_BCR_SER facility check Richard Henderson
2023-01-07 7:51 ` [PULL 10/27] tcg/s390x: Remove DISTINCT_OPERANDS " Richard Henderson
2023-01-07 7:51 ` [PULL 11/27] tcg/s390x: Use LARL+AGHI for odd addresses Richard Henderson
2023-01-07 7:51 ` [PULL 12/27] tcg/s390x: Distinguish RRF-a and RRF-c formats Richard Henderson
2023-01-07 7:51 ` [PULL 13/27] tcg/s390x: Distinguish RIE formats Richard Henderson
2023-01-07 7:51 ` [PULL 14/27] tcg/s390x: Support MIE2 multiply single instructions Richard Henderson
2023-01-07 7:51 ` [PULL 15/27] tcg/s390x: Support MIE2 MGRK instruction Richard Henderson
2023-01-07 7:51 ` [PULL 16/27] tcg/s390x: Issue XILF directly for xor_i32 Richard Henderson
2023-01-07 7:51 ` [PULL 17/27] tcg/s390x: Tighten constraints for or_i64 and xor_i64 Richard Henderson
2023-01-07 7:51 ` [PULL 18/27] tcg/s390x: Tighten constraints for and_i64 Richard Henderson
2023-01-07 7:51 ` [PULL 19/27] tcg/s390x: Support MIE3 logical operations Richard Henderson
2023-01-07 7:51 ` [PULL 20/27] tcg/s390x: Create tgen_cmp2 to simplify movcond Richard Henderson
2023-01-07 7:51 ` [PULL 21/27] tcg/s390x: Generalize movcond implementation Richard Henderson
2023-01-07 7:51 ` [PULL 22/27] tcg/s390x: Support SELGR instruction in movcond Richard Henderson
2023-01-07 7:51 ` [PULL 23/27] tcg/s390x: Use tgen_movcond_int in tgen_clz Richard Henderson
2023-01-07 7:51 ` [PULL 24/27] tcg/s390x: Implement ctpop operation Richard Henderson
2023-01-07 7:51 ` Richard Henderson [this message]
2023-01-07 7:51 ` [PULL 26/27] tcg/s390x: Cleanup tcg_out_movi Richard Henderson
2023-01-07 7:51 ` [PULL 27/27] tcg/s390x: Avoid the constant pool in tcg_out_movi Richard Henderson
2023-01-08 14:27 ` [PULL 00/27] tcg/s390x patch queue Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230107075118.1814503-26-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=iii@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).