[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 47/54] tcg/s390x: Use atom_and_align_for_opc
From: |
Richard Henderson |
Subject: |
[PATCH v5 47/54] tcg/s390x: Use atom_and_align_for_opc |
Date: |
Mon, 15 May 2023 07:33:06 -0700 |
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/s390x/tcg-target.c.inc | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
index 22f0206b5a..8e34b214fc 100644
--- a/tcg/s390x/tcg-target.c.inc
+++ b/tcg/s390x/tcg-target.c.inc
@@ -1572,6 +1572,7 @@ typedef struct {
TCGReg base;
TCGReg index;
int disp;
+ TCGAtomAlign aa;
} HostAddress;
bool tcg_target_has_memory_bswap(MemOp memop)
@@ -1733,8 +1734,10 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext
*s, HostAddress *h,
{
TCGLabelQemuLdst *ldst = NULL;
MemOp opc = get_memop(oi);
- unsigned a_bits = get_alignment_bits(opc);
- unsigned a_mask = (1u << a_bits) - 1;
+ unsigned a_mask;
+
+ h->aa = atom_and_align_for_opc(s, opc, MO_ATOM_IFALIGN, false);
+ a_mask = (1 << h->aa.align) - 1;
#ifdef CONFIG_SOFTMMU
unsigned s_bits = opc & MO_SIZE;
@@ -1764,7 +1767,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s,
HostAddress *h,
* bits within the address. For unaligned access, we check that we don't
* cross pages using the address of the last byte of the access.
*/
- a_off = (a_bits >= s_bits ? 0 : s_mask - a_mask);
+ a_off = (a_mask >= s_mask ? 0 : s_mask - a_mask);
tlb_mask = (uint64_t)TARGET_PAGE_MASK | a_mask;
if (a_off == 0) {
tgen_andi_risbg(s, TCG_REG_R0, addr_reg, tlb_mask);
@@ -1806,7 +1809,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s,
HostAddress *h,
ldst->addrlo_reg = addr_reg;
/* We are expecting a_bits to max out at 7, much lower than TMLL. */
- tcg_debug_assert(a_bits < 16);
+ tcg_debug_assert(a_mask <= 0xffff);
tcg_out_insn(s, RI, TMLL, addr_reg, a_mask);
tcg_out16(s, RI_BRC | (7 << 4)); /* CC in {1,2,3} */
--
2.34.1
- [PATCH v5 42/54] tcg/arm: Use atom_and_align_for_opc, (continued)
- [PATCH v5 42/54] tcg/arm: Use atom_and_align_for_opc, Richard Henderson, 2023/05/15
- [PATCH v5 40/54] tcg/i386: Use atom_and_align_for_opc, Richard Henderson, 2023/05/15
- [PATCH v5 43/54] tcg/loongarch64: Use atom_and_align_for_opc, Richard Henderson, 2023/05/15
- [PATCH v5 41/54] tcg/aarch64: Use atom_and_align_for_opc, Richard Henderson, 2023/05/15
- [PATCH v5 44/54] tcg/mips: Use atom_and_align_for_opc, Richard Henderson, 2023/05/15
- [PATCH v5 45/54] tcg/ppc: Use atom_and_align_for_opc, Richard Henderson, 2023/05/15
- [PATCH v5 50/54] tcg/i386: Support 128-bit load/store with have_atomic16, Richard Henderson, 2023/05/15
- [PATCH v5 51/54] tcg/aarch64: Rename temporaries, Richard Henderson, 2023/05/15
- [PATCH v5 47/54] tcg/s390x: Use atom_and_align_for_opc,
Richard Henderson <=
- [PATCH v5 46/54] tcg/riscv: Use atom_and_align_for_opc, Richard Henderson, 2023/05/15
- [PATCH v5 48/54] tcg/sparc64: Use atom_and_align_for_opc, Richard Henderson, 2023/05/15
- [PATCH v5 49/54] tcg/i386: Honor 64-bit atomicity in 32-bit mode, Richard Henderson, 2023/05/15
- [PATCH v5 54/54] tcg/s390x: Support 128-bit load/store, Richard Henderson, 2023/05/15
- [PATCH v5 52/54] tcg/aarch64: Support 128-bit load/store, Richard Henderson, 2023/05/15
- [PATCH v5 53/54] tcg/ppc: Support 128-bit load/store, Richard Henderson, 2023/05/15