From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [PATCH v6 1/8] tcg/sparc: Use tcg_out_movi_imm13 in tcg_out_addsub2_i64
Date: Tue, 8 Feb 2022 18:17:03 +1100 [thread overview]
Message-ID: <20220208071710.320122-2-richard.henderson@linaro.org> (raw)
In-Reply-To: <20220208071710.320122-1-richard.henderson@linaro.org>
When BH is constant, it is constrained to 10 bits for use in MOVCC.
For the cases in which we must load the constant BH into a register,
we do not need the full logic of tcg_out_movi; we can use the simpler
function for emitting a 13 bit constant.
This eliminates the only case in which TCG_REG_T2 was passed to
tcg_out_movi, which will shortly become invalid.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/sparc/tcg-target.c.inc | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc
index 0c062c60eb..82a7c684b6 100644
--- a/tcg/sparc/tcg-target.c.inc
+++ b/tcg/sparc/tcg-target.c.inc
@@ -795,7 +795,7 @@ static void tcg_out_addsub2_i64(TCGContext *s, TCGReg rl, TCGReg rh,
if (use_vis3_instructions && !is_sub) {
/* Note that ADDXC doesn't accept immediates. */
if (bhconst && bh != 0) {
- tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_T2, bh);
+ tcg_out_movi_imm13(s, TCG_REG_T2, bh);
bh = TCG_REG_T2;
}
tcg_out_arith(s, rh, ah, bh, ARITH_ADDXC);
@@ -811,9 +811,13 @@ static void tcg_out_addsub2_i64(TCGContext *s, TCGReg rl, TCGReg rh,
tcg_out_movcc(s, TCG_COND_GEU, MOVCC_XCC, rh, ah, 0);
}
} else {
- /* Otherwise adjust BH as if there is carry into T2 ... */
+ /*
+ * Otherwise adjust BH as if there is carry into T2.
+ * Note that constant BH is constrained to 10 bits for the MOVCC,
+ * so the adjustment fits 11 bits.
+ */
if (bhconst) {
- tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_T2, bh + (is_sub ? -1 : 1));
+ tcg_out_movi_imm13(s, TCG_REG_T2, bh + (is_sub ? -1 : 1));
} else {
tcg_out_arithi(s, TCG_REG_T2, bh, 1,
is_sub ? ARITH_SUB : ARITH_ADD);
--
2.25.1
next prev parent reply other threads:[~2022-02-08 7:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-08 7:17 [PATCH v6 0/8] tcg/sparc: Unaligned access for user-only Richard Henderson
2022-02-08 7:17 ` Richard Henderson [this message]
2022-02-08 10:40 ` [PATCH v6 1/8] tcg/sparc: Use tcg_out_movi_imm13 in tcg_out_addsub2_i64 Peter Maydell
2022-02-08 11:09 ` Richard Henderson
2022-02-08 11:16 ` Peter Maydell
2022-02-08 7:17 ` [PATCH v6 2/8] tcg/sparc: Split out tcg_out_movi_imm32 Richard Henderson
2022-02-08 10:44 ` Peter Maydell
2022-02-08 7:17 ` [PATCH v6 3/8] tcg/sparc: Add scratch argument to tcg_out_movi_int Richard Henderson
2022-02-08 10:51 ` Peter Maydell
2022-02-08 7:17 ` [PATCH v6 4/8] tcg/sparc: Improve code gen for shifted 32-bit constants Richard Henderson
2022-02-08 7:17 ` [PATCH v6 5/8] tcg/sparc: Convert patch_reloc to return bool Richard Henderson
2022-02-08 10:46 ` Philippe Mathieu-Daudé via
2022-02-08 7:17 ` [PATCH v6 6/8] tcg/sparc: Use the constant pool for 64-bit constants Richard Henderson
2022-02-08 7:17 ` [PATCH v6 7/8] tcg/sparc: Add tcg_out_jmpl_const for better tail calls Richard Henderson
2022-02-08 7:17 ` [PATCH v6 8/8] tcg/sparc: Support unaligned access for user-only Richard Henderson
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=20220208071710.320122-2-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=peter.maydell@linaro.org \
--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).