aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-11-30 01:27:28 +0000
committerRichard Henderson <richard.henderson@linaro.org>2023-01-06 23:07:04 +0000
commit1b74cf6ea2782f4ffdecc85fdd22b2082a08502d (patch)
treefbbf3064f5b8cc6c504d541069f310fb55838cc8
parent238da1c942037412033a08288f73bc9815bb8c2c (diff)
downloadqemu-1b74cf6ea2782f4ffdecc85fdd22b2082a08502d.zip
qemu-1b74cf6ea2782f4ffdecc85fdd22b2082a08502d.tar.gz
qemu-1b74cf6ea2782f4ffdecc85fdd22b2082a08502d.tar.bz2
tcg/s390x: Use LARL+AGHI for odd addresses
Add one instead of dropping odd addresses to the constant pool. Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--tcg/s390x/tcg-target.c.inc15
1 files changed, 8 insertions, 7 deletions
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
index e4403ff..6cf0715 100644
--- a/tcg/s390x/tcg-target.c.inc
+++ b/tcg/s390x/tcg-target.c.inc
@@ -806,6 +806,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)) {
@@ -832,14 +833,14 @@ static void tcg_out_movi(TCGContext *s, TCGType type,
return;
}
- /* 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;
}
/* Otherwise, stuff it in the constant pool. */