[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 25/28] qemu/atomic128: Improve cmpxchg fallback for atomic16_set
|
From: |
Richard Henderson |
|
Subject: |
[PULL 25/28] qemu/atomic128: Improve cmpxchg fallback for atomic16_set |
|
Date: |
Tue, 23 May 2023 16:58:01 -0700 |
Use __sync_bool_compare_and_swap_16 to control the loop,
rather than a separate comparison.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
host/include/generic/host/atomic128-ldst.h | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/host/include/generic/host/atomic128-ldst.h
b/host/include/generic/host/atomic128-ldst.h
index 79d208b7a4..80fff0643a 100644
--- a/host/include/generic/host/atomic128-ldst.h
+++ b/host/include/generic/host/atomic128-ldst.h
@@ -58,11 +58,14 @@ atomic16_read_rw(Int128 *ptr)
static inline void ATTRIBUTE_ATOMIC128_OPT
atomic16_set(Int128 *ptr, Int128 val)
{
- Int128 old = *ptr, cmp;
+ __int128_t *ptr_align = __builtin_assume_aligned(ptr, 16);
+ __int128_t old;
+ Int128Alias new;
+
+ new.s = val;
do {
- cmp = old;
- old = atomic16_cmpxchg(ptr, cmp, val);
- } while (int128_ne(old, cmp));
+ old = *ptr_align;
+ } while (!__sync_bool_compare_and_swap_16(ptr_align, old, new.i));
}
#else
--
2.34.1
- [PULL 20/28] accel/tcg: Remove prot argument to atomic_mmu_lookup, (continued)
- [PULL 20/28] accel/tcg: Remove prot argument to atomic_mmu_lookup, Richard Henderson, 2023/05/23
- [PULL 12/28] meson: Fix detect atomic128 support with optimization, Richard Henderson, 2023/05/23
- [PULL 13/28] include/qemu: Move CONFIG_ATOMIC128_OPT handling to atomic128.h, Richard Henderson, 2023/05/23
- [PULL 14/28] target/ppc: Use tcg_gen_qemu_{ld, st}_i128 for LQARX, LQ, STQ, Richard Henderson, 2023/05/23
- [PULL 18/28] target/s390x: Always use cpu_atomic_cmpxchgl_be_mmu in do_csst, Richard Henderson, 2023/05/23
- [PULL 27/28] tcg: Remove DEBUG_DISAS, Richard Henderson, 2023/05/23
- [PULL 19/28] accel/tcg: Remove cpu_atomic_{ld,st}o_*_mmu, Richard Henderson, 2023/05/23
- [PULL 24/28] tcg: Split out tcg/debug-assert.h, Richard Henderson, 2023/05/23
- [PULL 15/28] target/s390x: Use tcg_gen_qemu_{ld, st}_i128 for LPQ, STPQ, Richard Henderson, 2023/05/23
- [PULL 22/28] qemu/atomic128: Split atomic16_read, Richard Henderson, 2023/05/23
- [PULL 25/28] qemu/atomic128: Improve cmpxchg fallback for atomic16_set,
Richard Henderson <=
- [PULL 23/28] accel/tcg: Correctly use atomic128.h in ldst_atomicity.c.inc, Richard Henderson, 2023/05/23
- [PULL 28/28] tcg: Remove USE_TCG_OPTIMIZATIONS, Richard Henderson, 2023/05/23
- [PULL 26/28] qemu/atomic128: Add runtime test for FEAT_LSE2, Richard Henderson, 2023/05/23