[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/42] tcg/i386: Generalize multi-part load overlap test
|
From: |
Richard Henderson |
|
Subject: |
[PULL 20/42] tcg/i386: Generalize multi-part load overlap test |
|
Date: |
Fri, 5 May 2023 22:24:25 +0100 |
Test for both base and index; use datahi as a temporary, overwritten
by the final load. Always perform the loads in ascending order, so
that any (user-only) fault sees the correct address.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/i386/tcg-target.c.inc | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
index cfa2349b03..173f3c3172 100644
--- a/tcg/i386/tcg-target.c.inc
+++ b/tcg/i386/tcg-target.c.inc
@@ -2221,23 +2221,22 @@ static void tcg_out_qemu_ld_direct(TCGContext *s,
TCGReg datalo, TCGReg datahi,
if (TCG_TARGET_REG_BITS == 64) {
tcg_out_modrm_sib_offset(s, movop + P_REXW + seg, datalo,
base, index, 0, ofs);
+ break;
+ }
+ if (use_movbe) {
+ TCGReg t = datalo;
+ datalo = datahi;
+ datahi = t;
+ }
+ if (base == datalo || index == datalo) {
+ tcg_out_modrm_sib_offset(s, OPC_LEA, datahi, base, index, 0, ofs);
+ tcg_out_modrm_offset(s, movop + seg, datalo, datahi, 0);
+ tcg_out_modrm_offset(s, movop + seg, datahi, datahi, 4);
} else {
- if (use_movbe) {
- TCGReg t = datalo;
- datalo = datahi;
- datahi = t;
- }
- if (base != datalo) {
- tcg_out_modrm_sib_offset(s, movop + seg, datalo,
- base, index, 0, ofs);
- tcg_out_modrm_sib_offset(s, movop + seg, datahi,
- base, index, 0, ofs + 4);
- } else {
- tcg_out_modrm_sib_offset(s, movop + seg, datahi,
- base, index, 0, ofs + 4);
- tcg_out_modrm_sib_offset(s, movop + seg, datalo,
- base, index, 0, ofs);
- }
+ tcg_out_modrm_sib_offset(s, movop + seg, datalo,
+ base, index, 0, ofs);
+ tcg_out_modrm_sib_offset(s, movop + seg, datahi,
+ base, index, 0, ofs + 4);
}
break;
default:
--
2.34.1
- [PULL 22/42] tcg/i386: Drop r0+r1 local variables from tcg_out_tlb_load, (continued)
- [PULL 22/42] tcg/i386: Drop r0+r1 local variables from tcg_out_tlb_load, Richard Henderson, 2023/05/05
- [PULL 28/42] tcg/loongarch64: Rationalize args to tcg_out_qemu_{ld, st}, Richard Henderson, 2023/05/05
- [PULL 31/42] tcg/ppc: Rationalize args to tcg_out_qemu_{ld,st}, Richard Henderson, 2023/05/05
- [PULL 24/42] tcg/aarch64: Rationalize args to tcg_out_qemu_{ld,st}, Richard Henderson, 2023/05/05
- [PULL 26/42] tcg/arm: Rationalize args to tcg_out_qemu_{ld,st}, Richard Henderson, 2023/05/05
- [PULL 29/42] tcg/loongarch64: Introduce HostAddress, Richard Henderson, 2023/05/05
- [PULL 30/42] tcg/mips: Rationalize args to tcg_out_qemu_{ld,st}, Richard Henderson, 2023/05/05
- [PULL 32/42] tcg/ppc: Introduce HostAddress, Richard Henderson, 2023/05/05
- [PULL 27/42] tcg/arm: Introduce HostAddress, Richard Henderson, 2023/05/05
- [PULL 19/42] tcg/i386: Rationalize args to tcg_out_qemu_{ld,st}, Richard Henderson, 2023/05/05
- [PULL 20/42] tcg/i386: Generalize multi-part load overlap test,
Richard Henderson <=
- [PULL 34/42] tcg/riscv: Rationalize args to tcg_out_qemu_{ld,st}, Richard Henderson, 2023/05/05
- [PULL 35/42] tcg/s390x: Pass TCGType to tcg_out_qemu_{ld,st}, Richard Henderson, 2023/05/05
- [PULL 38/42] tcg/sparc64: Pass TCGType to tcg_out_qemu_{ld,st}, Richard Henderson, 2023/05/05
- [PULL 33/42] tcg/riscv: Require TCG_TARGET_REG_BITS == 64, Richard Henderson, 2023/05/05
- [PULL 39/42] tcg: Move TCGLabelQemuLdst to tcg.c, Richard Henderson, 2023/05/05
- [PULL 36/42] tcg/s390x: Introduce HostAddress, Richard Henderson, 2023/05/05
- [PULL 23/42] tcg/i386: Introduce tcg_out_testi, Richard Henderson, 2023/05/05
- [PULL 37/42] tcg/sparc64: Drop is_64 test from tcg_out_qemu_ld data return, Richard Henderson, 2023/05/05
- [PULL 40/42] tcg: Replace REG_P with arg_loc_reg_p, Richard Henderson, 2023/05/05
- [PULL 41/42] tcg: Introduce arg_slot_stk_ofs, Richard Henderson, 2023/05/05