memset, ld_i128, and st_i128 are declared in ldst_common.h, and ldst_common.c.inc emits their helper info. Atomic helpers move to atomic_common.h, with info records emitted from atomic_common.c.inc. tcg-runtime.h keeps the integer helpers implemented in tcg-runtime.c.
Signed-off-by: Yonggang Luo <[email protected]> --- accel/tcg/atomic_common.c.inc | 4 + accel/tcg/{tcg-runtime.h => atomic_common.h} | 36 --------- accel/tcg/ldst_common.c.inc | 4 + accel/tcg/ldst_common.h | 13 +++ accel/tcg/tcg-runtime.h | 85 -------------------- include/exec/helper-gen-common.h | 8 ++ include/exec/helper-proto-common.h | 8 ++ 7 files changed, 37 insertions(+), 121 deletions(-) copy accel/tcg/{tcg-runtime.h => atomic_common.h} (65%) create mode 100644 accel/tcg/ldst_common.h diff --git a/accel/tcg/atomic_common.c.inc b/accel/tcg/atomic_common.c.inc index 7d779dd51db..a24250be75e 100644 --- a/accel/tcg/atomic_common.c.inc +++ b/accel/tcg/atomic_common.c.inc @@ -101,3 +101,7 @@ ATOMIC_HELPER(fetch_oro_le, Int128) #undef ATOMIC_HELPER #undef GEN_ATOMIC_HELPERS + +#define HELPER_H "accel/tcg/atomic_common.h" +#include "exec/helper-info.c.inc" +#undef HELPER_H diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/atomic_common.h similarity index 65% copy from accel/tcg/tcg-runtime.h copy to accel/tcg/atomic_common.h index 26e0baeca51..4fee73cf916 100644 --- a/accel/tcg/tcg-runtime.h +++ b/accel/tcg/atomic_common.h @@ -1,39 +1,3 @@ -DEF_HELPER_FLAGS_2(div_i32, TCG_CALL_NO_RWG_SE, s32, s32, s32) -DEF_HELPER_FLAGS_2(rem_i32, TCG_CALL_NO_RWG_SE, s32, s32, s32) -DEF_HELPER_FLAGS_2(divu_i32, TCG_CALL_NO_RWG_SE, i32, i32, i32) -DEF_HELPER_FLAGS_2(remu_i32, TCG_CALL_NO_RWG_SE, i32, i32, i32) - -DEF_HELPER_FLAGS_2(div_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64) -DEF_HELPER_FLAGS_2(rem_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64) -DEF_HELPER_FLAGS_2(divu_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64) -DEF_HELPER_FLAGS_2(remu_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64) - -DEF_HELPER_FLAGS_2(mulsh_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64) -DEF_HELPER_FLAGS_2(muluh_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64) - -DEF_HELPER_FLAGS_2(clz_i32, TCG_CALL_NO_RWG_SE, i32, i32, i32) -DEF_HELPER_FLAGS_2(ctz_i32, TCG_CALL_NO_RWG_SE, i32, i32, i32) -DEF_HELPER_FLAGS_2(clz_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64) -DEF_HELPER_FLAGS_2(ctz_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64) -DEF_HELPER_FLAGS_1(clrsb_i32, TCG_CALL_NO_RWG_SE, i32, i32) -DEF_HELPER_FLAGS_1(clrsb_i64, TCG_CALL_NO_RWG_SE, i64, i64) -DEF_HELPER_FLAGS_1(ctpop_i32, TCG_CALL_NO_RWG_SE, i32, i32) -DEF_HELPER_FLAGS_1(ctpop_i64, TCG_CALL_NO_RWG_SE, i64, i64) - -#ifndef IN_HELPER_PROTO -/* - * Pass calls to memset directly to libc, without a thunk in qemu. - * Do not re-declare memset, especially since we fudge the type here; - * we assume sizeof(void *) == sizeof(size_t), which is true for - * all supported hosts. - */ -#define helper_memset memset -DEF_HELPER_FLAGS_3(memset, TCG_CALL_NO_RWG, ptr, ptr, int, ptr) -#endif /* IN_HELPER_PROTO */ - -DEF_HELPER_FLAGS_3(ld_i128, TCG_CALL_NO_WG, i128, env, i64, i32) -DEF_HELPER_FLAGS_4(st_i128, TCG_CALL_NO_WG, void, env, i64, i128, i32) - DEF_HELPER_FLAGS_5(atomic_cmpxchgb, TCG_CALL_NO_WG, i32, env, i64, i32, i32, i32) DEF_HELPER_FLAGS_5(atomic_cmpxchgw_be, TCG_CALL_NO_WG, diff --git a/accel/tcg/ldst_common.c.inc b/accel/tcg/ldst_common.c.inc index 57f3e061924..bf74d65dd75 100644 --- a/accel/tcg/ldst_common.c.inc +++ b/accel/tcg/ldst_common.c.inc @@ -119,6 +119,10 @@ void helper_st_i128(CPUArchState *env, uint64_t addr, Int128 val, MemOpIdx oi) helper_st16_mmu(env, addr, val, oi, GETPC()); } +#define HELPER_H "accel/tcg/ldst_common.h" +#include "exec/helper-info.c.inc" +#undef HELPER_H + /* * Load helpers for cpu_ldst.h */ diff --git a/accel/tcg/ldst_common.h b/accel/tcg/ldst_common.h new file mode 100644 index 00000000000..cec4751ff16 --- /dev/null +++ b/accel/tcg/ldst_common.h @@ -0,0 +1,13 @@ +#ifndef IN_HELPER_PROTO +/* + * Pass calls to memset directly to libc, without a thunk in qemu. + * Do not re-declare memset, especially since we fudge the type here; + * we assume sizeof(void *) == sizeof(size_t), which is true for + * all supported hosts. + */ +#define helper_memset memset +DEF_HELPER_FLAGS_3(memset, TCG_CALL_NO_RWG, ptr, ptr, int, ptr) +#endif /* IN_HELPER_PROTO */ + +DEF_HELPER_FLAGS_3(ld_i128, TCG_CALL_NO_WG, i128, env, i64, i32) +DEF_HELPER_FLAGS_4(st_i128, TCG_CALL_NO_WG, void, env, i64, i128, i32) diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h index 26e0baeca51..d635e6b708b 100644 --- a/accel/tcg/tcg-runtime.h +++ b/accel/tcg/tcg-runtime.h @@ -19,88 +19,3 @@ DEF_HELPER_FLAGS_1(clrsb_i32, TCG_CALL_NO_RWG_SE, i32, i32) DEF_HELPER_FLAGS_1(clrsb_i64, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_1(ctpop_i32, TCG_CALL_NO_RWG_SE, i32, i32) DEF_HELPER_FLAGS_1(ctpop_i64, TCG_CALL_NO_RWG_SE, i64, i64) - -#ifndef IN_HELPER_PROTO -/* - * Pass calls to memset directly to libc, without a thunk in qemu. - * Do not re-declare memset, especially since we fudge the type here; - * we assume sizeof(void *) == sizeof(size_t), which is true for - * all supported hosts. - */ -#define helper_memset memset -DEF_HELPER_FLAGS_3(memset, TCG_CALL_NO_RWG, ptr, ptr, int, ptr) -#endif /* IN_HELPER_PROTO */ - -DEF_HELPER_FLAGS_3(ld_i128, TCG_CALL_NO_WG, i128, env, i64, i32) -DEF_HELPER_FLAGS_4(st_i128, TCG_CALL_NO_WG, void, env, i64, i128, i32) - -DEF_HELPER_FLAGS_5(atomic_cmpxchgb, TCG_CALL_NO_WG, - i32, env, i64, i32, i32, i32) -DEF_HELPER_FLAGS_5(atomic_cmpxchgw_be, TCG_CALL_NO_WG, - i32, env, i64, i32, i32, i32) -DEF_HELPER_FLAGS_5(atomic_cmpxchgw_le, TCG_CALL_NO_WG, - i32, env, i64, i32, i32, i32) -DEF_HELPER_FLAGS_5(atomic_cmpxchgl_be, TCG_CALL_NO_WG, - i32, env, i64, i32, i32, i32) -DEF_HELPER_FLAGS_5(atomic_cmpxchgl_le, TCG_CALL_NO_WG, - i32, env, i64, i32, i32, i32) -DEF_HELPER_FLAGS_5(atomic_cmpxchgq_be, TCG_CALL_NO_WG, - i64, env, i64, i64, i64, i32) -DEF_HELPER_FLAGS_5(atomic_cmpxchgq_le, TCG_CALL_NO_WG, - i64, env, i64, i64, i64, i32) -#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, - i128, env, i64, i128, i128, i32) -DEF_HELPER_FLAGS_4(atomic_xchgo_be, TCG_CALL_NO_WG, - i128, env, i64, i128, i32) -DEF_HELPER_FLAGS_4(atomic_xchgo_le, TCG_CALL_NO_WG, - i128, env, i64, i128, i32) -DEF_HELPER_FLAGS_4(atomic_fetch_ando_be, TCG_CALL_NO_WG, - i128, env, i64, i128, i32) -DEF_HELPER_FLAGS_4(atomic_fetch_ando_le, TCG_CALL_NO_WG, - i128, env, i64, i128, i32) -DEF_HELPER_FLAGS_4(atomic_fetch_oro_be, TCG_CALL_NO_WG, - i128, env, i64, i128, i32) -DEF_HELPER_FLAGS_4(atomic_fetch_oro_le, TCG_CALL_NO_WG, - i128, env, i64, i128, i32) -#endif - -#define GEN_ATOMIC_HELPERS(NAME) \ - DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), b), \ - TCG_CALL_NO_WG, i32, env, i64, i32, i32) \ - DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), w_le), \ - TCG_CALL_NO_WG, i32, env, i64, i32, i32) \ - DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), w_be), \ - TCG_CALL_NO_WG, i32, env, i64, i32, i32) \ - DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), l_le), \ - TCG_CALL_NO_WG, i32, env, i64, i32, i32) \ - DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), l_be), \ - TCG_CALL_NO_WG, i32, env, i64, i32, i32) \ - DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), q_le), \ - TCG_CALL_NO_WG, i64, env, i64, i64, i32) \ - DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), q_be), \ - TCG_CALL_NO_WG, i64, env, i64, i64, i32) - -GEN_ATOMIC_HELPERS(fetch_add) -GEN_ATOMIC_HELPERS(fetch_and) -GEN_ATOMIC_HELPERS(fetch_or) -GEN_ATOMIC_HELPERS(fetch_xor) -GEN_ATOMIC_HELPERS(fetch_smin) -GEN_ATOMIC_HELPERS(fetch_umin) -GEN_ATOMIC_HELPERS(fetch_smax) -GEN_ATOMIC_HELPERS(fetch_umax) - -GEN_ATOMIC_HELPERS(add_fetch) -GEN_ATOMIC_HELPERS(and_fetch) -GEN_ATOMIC_HELPERS(or_fetch) -GEN_ATOMIC_HELPERS(xor_fetch) -GEN_ATOMIC_HELPERS(smin_fetch) -GEN_ATOMIC_HELPERS(umin_fetch) -GEN_ATOMIC_HELPERS(smax_fetch) -GEN_ATOMIC_HELPERS(umax_fetch) - -GEN_ATOMIC_HELPERS(xchg) - -#undef GEN_ATOMIC_HELPERS diff --git a/include/exec/helper-gen-common.h b/include/exec/helper-gen-common.h index 73e979a35f3..5943a3aedf0 100644 --- a/include/exec/helper-gen-common.h +++ b/include/exec/helper-gen-common.h @@ -19,6 +19,14 @@ #include "exec/helper-gen.h.inc" #undef HELPER_H +#define HELPER_H "accel/tcg/ldst_common.h" +#include "exec/helper-gen.h.inc" +#undef HELPER_H + +#define HELPER_H "accel/tcg/atomic_common.h" +#include "exec/helper-gen.h.inc" +#undef HELPER_H + #define HELPER_H "accel/tcg/tcg-runtime-gvec.h" #include "exec/helper-gen.h.inc" #undef HELPER_H diff --git a/include/exec/helper-proto-common.h b/include/exec/helper-proto-common.h index 3c32f95f4c1..eabe7828047 100644 --- a/include/exec/helper-proto-common.h +++ b/include/exec/helper-proto-common.h @@ -21,6 +21,14 @@ #include "exec/helper-proto.h.inc" #undef HELPER_H +#define HELPER_H "accel/tcg/ldst_common.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H + +#define HELPER_H "accel/tcg/atomic_common.h" +#include "exec/helper-proto.h.inc" +#undef HELPER_H + #define HELPER_H "accel/tcg/tcg-runtime-gvec.h" #include "exec/helper-proto.h.inc" #undef HELPER_H -- 2.52.0.windows.1
