[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 03/13] tcg/s390x: Use LARL+AGHI for odd addresses
From: |
Richard Henderson |
Subject: |
[PATCH v3 03/13] tcg/s390x: Use LARL+AGHI for odd addresses |
Date: |
Thu, 1 Dec 2022 22:51:50 -0800 |
Add one instead of dropping odd addresses to the constant pool.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/s390x/tcg-target.c.inc | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
index 8a4bec0a28..34de5c5ebe 100644
--- a/tcg/s390x/tcg-target.c.inc
+++ b/tcg/s390x/tcg-target.c.inc
@@ -811,6 +811,7 @@ static void tcg_out_movi(TCGContext *s, TCGType type,
TCGReg ret, tcg_target_long sval)
{
tcg_target_ulong uval;
+ ptrdiff_t pc_off;
/* Try all 32-bit insns that can load it in one go. */
if (maybe_out_small_movi(s, type, ret, sval)) {
@@ -839,14 +840,14 @@ static void tcg_out_movi(TCGContext *s, TCGType type,
}
}
- /* Try for PC-relative address load. For odd addresses,
- attempt to use an offset from the start of the TB. */
- if ((sval & 1) == 0) {
- ptrdiff_t off = tcg_pcrel_diff(s, (void *)sval) >> 1;
- if (off == (int32_t)off) {
- tcg_out_insn(s, RIL, LARL, ret, off);
- return;
+ /* Try for PC-relative address load. For odd addresses, add one. */
+ pc_off = tcg_pcrel_diff(s, (void *)sval) >> 1;
+ if (pc_off == (int32_t)pc_off) {
+ tcg_out_insn(s, RIL, LARL, ret, pc_off);
+ if (sval & 1) {
+ tcg_out_insn(s, RI, AGHI, ret, 1);
}
+ return;
}
/* A 32-bit unsigned value can be loaded in 2 insns. And given
--
2.34.1
- Re: [PATCH v3 02/13] tcg/s390x: Remove TCG_REG_TB, (continued)
- Re: [PATCH v3 02/13] tcg/s390x: Remove TCG_REG_TB, Thomas Huth, 2022/12/07
- Re: [PATCH v3 02/13] tcg/s390x: Remove TCG_REG_TB, Richard Henderson, 2022/12/07
- Re: [PATCH v3 02/13] tcg/s390x: Remove TCG_REG_TB, Ilya Leoshkevich, 2022/12/07
- Re: [PATCH v3 02/13] tcg/s390x: Remove TCG_REG_TB, Christian Borntraeger, 2022/12/07
- Re: [PATCH v3 02/13] tcg/s390x: Remove TCG_REG_TB, Ilya Leoshkevich, 2022/12/07
[PATCH v3 06/13] tcg/s390x: Support MIE2 multiply single instructions, Richard Henderson, 2022/12/02
[PATCH v3 03/13] tcg/s390x: Use LARL+AGHI for odd addresses,
Richard Henderson <=
[PATCH v3 05/13] tcg/s390x: Distinguish RIE formats, Richard Henderson, 2022/12/02
[PATCH v3 07/13] tcg/s390x: Support MIE2 MGRK instruction, Richard Henderson, 2022/12/02
[PATCH v3 10/13] tcg/s390x: Generalize movcond implementation, Richard Henderson, 2022/12/02
[PATCH v3 09/13] tcg/s390x: Create tgen_cmp2 to simplify movcond, Richard Henderson, 2022/12/02
[PATCH v3 08/13] tcg/s390x: Support MIE3 logical operations, Richard Henderson, 2022/12/02