]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
tcg: Use HAVE_CMPXCHG128 instead of CONFIG_CMPXCHG128
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 13 Jul 2023 20:06:15 +0000 (20:06 +0000)
committerRichard Henderson <richard.henderson@linaro.org>
Sat, 15 Jul 2023 07:02:49 +0000 (08:02 +0100)
We adjust CONFIG_ATOMIC128 and CONFIG_CMPXCHG128 with
CONFIG_ATOMIC128_OPT in atomic128.h.  It is difficult
to tell when those changes have been applied with the
ifdef we must use with CONFIG_CMPXCHG128.  So instead
use HAVE_CMPXCHG128, which triggers -Werror-undef when
the proper header has not been included.

Improves tcg_gen_atomic_cmpxchg_i128 for s390x host, which
requires CONFIG_ATOMIC128_OPT.  Without this we fall back
to EXCP_ATOMIC to single-step 128-bit atomics, which is
slow enough to cause some tests to time out.

Reported-by: Thomas Huth <thuth@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
accel/tcg/atomic_common.c.inc
accel/tcg/cputlb.c
accel/tcg/tcg-runtime.h
accel/tcg/user-exec.c
include/exec/helper-proto-common.h
tcg/tcg-op-ldst.c

index ee222fd7e7846be7a0ee21b56a99909385fea1de..95a5c5ff12d9e6f4fd3bc8cab3a5f38a222dfdc1 100644 (file)
@@ -41,7 +41,7 @@ CMPXCHG_HELPER(cmpxchgq_be, uint64_t)
 CMPXCHG_HELPER(cmpxchgq_le, uint64_t)
 #endif
 
-#ifdef CONFIG_CMPXCHG128
+#if HAVE_CMPXCHG128
 CMPXCHG_HELPER(cmpxchgo_be, Int128)
 CMPXCHG_HELPER(cmpxchgo_le, Int128)
 #endif
index c2b81ec5692e8c414af59fc92d09b25f84c64012..e0079c9a9d74e8ffa9cb7c4a49911f5a9d5cffd1 100644 (file)
@@ -3105,7 +3105,7 @@ void cpu_st16_mmu(CPUArchState *env, target_ulong addr, Int128 val,
 #include "atomic_template.h"
 #endif
 
-#if defined(CONFIG_ATOMIC128) || defined(CONFIG_CMPXCHG128)
+#if defined(CONFIG_ATOMIC128) || HAVE_CMPXCHG128
 #define DATA_SIZE 16
 #include "atomic_template.h"
 #endif
index 39e68007f908f31de6a13d875336b9f651dfa3a0..186899a2c7ec5eb3206001001047eef9e018b1d2 100644 (file)
@@ -58,7 +58,7 @@ DEF_HELPER_FLAGS_5(atomic_cmpxchgq_be, TCG_CALL_NO_WG,
 DEF_HELPER_FLAGS_5(atomic_cmpxchgq_le, TCG_CALL_NO_WG,
                    i64, env, i64, i64, i64, i32)
 #endif
-#ifdef CONFIG_CMPXCHG128
+#if HAVE_CMPXCHG128
 DEF_HELPER_FLAGS_5(atomic_cmpxchgo_be, TCG_CALL_NO_WG,
                    i128, env, i64, i128, i128, i32)
 DEF_HELPER_FLAGS_5(atomic_cmpxchgo_le, TCG_CALL_NO_WG,
index df60c7d673f843f5cf154260aceb6d3ec79fa009..ac38c2bf96c0f72230c43791e42c031bc060751b 100644 (file)
@@ -1433,7 +1433,7 @@ static void *atomic_mmu_lookup(CPUArchState *env, vaddr addr, MemOpIdx oi,
 #include "atomic_template.h"
 #endif
 
-#if defined(CONFIG_ATOMIC128) || defined(CONFIG_CMPXCHG128)
+#if defined(CONFIG_ATOMIC128) || HAVE_CMPXCHG128
 #define DATA_SIZE 16
 #include "atomic_template.h"
 #endif
index 4d4b022668ca7118884db84037351eab07770bc6..8b67170a22c03ded694f04f72256397e9dd90c06 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef HELPER_PROTO_COMMON_H
 #define HELPER_PROTO_COMMON_H
 
+#include "qemu/atomic128.h"  /* for HAVE_CMPXCHG128 */
+
 #define HELPER_H "accel/tcg/tcg-runtime.h"
 #include "exec/helper-proto.h.inc"
 #undef  HELPER_H
index 0fcc1618e51a2d4d31f4649d62bbe22985e64808..d54c30559889114faf2ef1c0cad62acd73d24dce 100644 (file)
@@ -778,7 +778,7 @@ typedef void (*gen_atomic_op_i64)(TCGv_i64, TCGv_env, TCGv_i64,
 #else
 # define WITH_ATOMIC64(X)
 #endif
-#ifdef CONFIG_CMPXCHG128
+#if HAVE_CMPXCHG128
 # define WITH_ATOMIC128(X) X,
 #else
 # define WITH_ATOMIC128(X)