aboutsummaryrefslogtreecommitdiff
path: root/tcg
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2014-03-03 23:03:51 -0500
committerRichard Henderson <rth@redhat.com>2014-04-16 12:13:01 -0400
commita056c9faa4a0bd790630caac4ff9f5a841a33177 (patch)
treee14c8e441f946b0460ed189906109ec983c14878 /tcg
parent3d4299f425eef29bbb883132d66b1a8c7910dfaf (diff)
downloadqemu-a056c9faa4a0bd790630caac4ff9f5a841a33177.zip
qemu-a056c9faa4a0bd790630caac4ff9f5a841a33177.tar.gz
qemu-a056c9faa4a0bd790630caac4ff9f5a841a33177.tar.bz2
tcg-aarch64: Prefer unsigned offsets before signed offsets for ldst
The assembler seems to prefer them, perhaps we should too. Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com> Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'tcg')
-rw-r--r--tcg/aarch64/tcg-target.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c
index 3235824..7ff4be7 100644
--- a/tcg/aarch64/tcg-target.c
+++ b/tcg/aarch64/tcg-target.c
@@ -669,11 +669,6 @@ static void tcg_out_ldst(TCGContext *s, AArch64Insn insn,
{
TCGMemOp size = (uint32_t)insn >> 30;
- if (offset >= -256 && offset < 256) {
- tcg_out_insn_3312(s, insn, rd, rn, offset);
- return;
- }
-
/* If the offset is naturally aligned and in range, then we can
use the scaled uimm12 encoding */
if (offset >= 0 && !(offset & ((1 << size) - 1))) {
@@ -684,6 +679,12 @@ static void tcg_out_ldst(TCGContext *s, AArch64Insn insn,
}
}
+ /* Small signed offsets can use the unscaled encoding. */
+ if (offset >= -256 && offset < 256) {
+ tcg_out_insn_3312(s, insn, rd, rn, offset);
+ return;
+ }
+
/* Worst-case scenario, move offset to temp register, use reg offset. */
tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_TMP, offset);
tcg_out_ldst_r(s, insn, rd, rn, TCG_REG_TMP);