Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
target/arm: Use tcg_gen_qemu_st_i128 for STZG, STZ2G
This fixes a bug in that these two insns should have been using atomic
16-byte stores, since MTE is ARMv8.5 and LSE2 is mandatory from ARMv8.4.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230530191438.411344-7-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
rth7680 authored and pm215 committed Jun 6, 2023
1 parent d450bd0 commit e6073d8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions target/arm/tcg/translate-a64.c
Expand Up @@ -4058,15 +4058,18 @@ static void disas_ldst_tag(DisasContext *s, uint32_t insn)

if (is_zero) {
TCGv_i64 clean_addr = clean_data_tbi(s, addr);
TCGv_i64 tcg_zero = tcg_constant_i64(0);
TCGv_i64 zero64 = tcg_constant_i64(0);
TCGv_i128 zero128 = tcg_temp_new_i128();
int mem_index = get_mem_index(s);
int i, n = (1 + is_pair) << LOG2_TAG_GRANULE;
MemOp mop = finalize_memop(s, MO_128 | MO_ALIGN);

tcg_gen_concat_i64_i128(zero128, zero64, zero64);

tcg_gen_qemu_st_i64(tcg_zero, clean_addr, mem_index,
MO_UQ | MO_ALIGN_16);
for (i = 8; i < n; i += 8) {
tcg_gen_addi_i64(clean_addr, clean_addr, 8);
tcg_gen_qemu_st_i64(tcg_zero, clean_addr, mem_index, MO_UQ);
/* This is 1 or 2 atomic 16-byte operations. */
tcg_gen_qemu_st_i128(zero128, clean_addr, mem_index, mop);
if (is_pair) {
tcg_gen_addi_i64(clean_addr, clean_addr, 16);
tcg_gen_qemu_st_i128(zero128, clean_addr, mem_index, mop);
}
}

Expand Down

0 comments on commit e6073d8

Please sign in to comment.