[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 52/57] tcg/i386: Honor 64-bit atomicity in 32-bit mode
From: |
Peter Maydell |
Subject: |
Re: [PATCH v4 52/57] tcg/i386: Honor 64-bit atomicity in 32-bit mode |
Date: |
Fri, 5 May 2023 14:27:57 +0100 |
On Wed, 3 May 2023 at 08:18, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Use the fpu to perform 64-bit loads and stores.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> @@ -2091,7 +2095,20 @@ static void tcg_out_qemu_ld_direct(TCGContext *s,
> TCGReg datalo, TCGReg datahi,
> datalo = datahi;
> datahi = t;
> }
> - if (h.base == datalo || h.index == datalo) {
> + if (h.atom == MO_64) {
> + /*
> + * Atomicity requires that we use use a single 8-byte load.
> + * For simplicity and code size, always use the FPU for this.
> + * Similar insns using SSE/AVX are merely larger.
I'm surprised there's no performance penalty for throwing old-school
FPU insns into what is presumably otherwise code that's only
using modern SSE.
> + * Load from memory in one go, then store back to the stack,
> + * from whence we can load into the correct integer regs.
> + */
> + tcg_out_modrm_sib_offset(s, OPC_ESCDF + h.seg, ESCDF_FILD_m64,
> + h.base, h.index, 0, h.ofs);
> + tcg_out_modrm_offset(s, OPC_ESCDF, ESCDF_FISTP_m64, TCG_REG_ESP,
> 0);
> + tcg_out_modrm_offset(s, movop, datalo, TCG_REG_ESP, 0);
> + tcg_out_modrm_offset(s, movop, datahi, TCG_REG_ESP, 4);
> + } else if (h.base == datalo || h.index == datalo) {
> tcg_out_modrm_sib_offset(s, OPC_LEA, datahi,
> h.base, h.index, 0, h.ofs);
> tcg_out_modrm_offset(s, movop + h.seg, datalo, datahi, 0);
I assume the caller has arranged that the top of the stack
is trashable at this point?
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-- PMM
- Re: [PATCH v4 46/57] tcg/loongarch64: Use atom_and_align_for_opc, (continued)
- [PATCH v4 41/57] tcg: Support TCG_TYPE_I128 in tcg_out_{ld, st}_helper_{args, ret}, Richard Henderson, 2023/05/03
- [PATCH v4 50/57] tcg/s390x: Use atom_and_align_for_opc, Richard Henderson, 2023/05/03
- [PATCH v4 45/57] tcg/arm: Use atom_and_align_for_opc, Richard Henderson, 2023/05/03
- [PATCH v4 42/57] tcg: Introduce atom_and_align_for_opc, Richard Henderson, 2023/05/03
- [PATCH v4 52/57] tcg/i386: Honor 64-bit atomicity in 32-bit mode, Richard Henderson, 2023/05/03
- Re: [PATCH v4 52/57] tcg/i386: Honor 64-bit atomicity in 32-bit mode,
Peter Maydell <=
- [PATCH v4 51/57] tcg/sparc64: Use atom_and_align_for_opc, Richard Henderson, 2023/05/03
- [PATCH v4 53/57] tcg/i386: Support 128-bit load/store with have_atomic16, Richard Henderson, 2023/05/03
- [PATCH v4 49/57] tcg/riscv: Use atom_and_align_for_opc, Richard Henderson, 2023/05/03
- [PATCH v4 54/57] tcg/aarch64: Rename temporaries, Richard Henderson, 2023/05/03