target/tcg: Rename some helpers common to various targets
v2 cover target/tcg: Rename some helpers common to various targets
TCG helpers are declared using the DEF_HELPER*() macros which imply global symbol scope. Unfortunately when building a single binary (containing multiple TCG 'target' frontends) these symbols clash.
This series takes the dumbest approach, renaming the symbols.
There are still around 20 symbol clashes (usually FPU helpers), but this series is good for my proof-of-concept.
Since v1:
- rebased on b0df6e2f2c6c45df8d4d286933799c623e124d98 (Merge tag 'pull-riscv-to-apply-20260616')
Philippe Mathieu-Daudé (4):
target/tcg: Rename bitswap() helpers
target/tcg: Rename crc32*() helpers
target/tcg: Rename raise_exception() helpers
target/tcg: Rename set_rounding_mode() helpers
target/arm/tcg/helper-defs.h | 4 ++-- target/hexagon/gen_tcg.h | 2 +- target/hexagon/helper.h | 2 +- target/i386/helper.h | 2 +- target/i386/ops_sse.h | 2 +- target/loongarch/tcg/helper.h | 8 ++++---- target/m68k/helper.h | 2 +- target/microblaze/helper.h | 2 +- target/mips/helper.h | 6 +++--- target/ppc/helper.h | 2 +- target/riscv/helper.h | 2 +- target/sparc/helper.h | 2 +- target/i386/tcg/ops_sse_header.h.inc | 2 +- target/arm/tcg/arith_helper.c | 4 ++-- target/arm/tcg/translate.c | 4 ++-- target/hexagon/op_helper.c | 2 +- target/hexagon/translate.c | 2 +- target/i386/tcg/excp_helper.c | 2 +- target/i386/tcg/translate.c | 2 +- target/loongarch/tcg/fpu_helper.c | 2 +- target/loongarch/tcg/op_helper.c | 6 +++--- target/m68k/op_helper.c | 2 +- target/m68k/translate.c | 2 +- target/microblaze/op_helper.c | 2 +- target/microblaze/translate.c | 2 +- target/mips/tcg/op_helper.c | 6 +++--- target/mips/tcg/translate.c | 6 +++--- target/ppc/tcg-excp_helper.c | 2 +- target/ppc/translate.c | 6 +++--- target/riscv/fpu_helper.c | 2 +- target/riscv/translate.c | 2 +- target/sparc/helper.c | 2 +- target/sparc/translate.c | 6 +++--- target/i386/tcg/emit.c.inc | 2 +- target/loongarch/tcg/insn_trans/trans_bit.c.inc | 4 ++-- .../loongarch/tcg/insn_trans/trans_extra.c.inc | 16 ++++++++-------- target/loongarch/tcg/insn_trans/trans_fmov.c.inc | 2 +- 37 files changed, 63 insertions(+), 63 deletions(-)
Signature · 1 line
2.53.0
RFC PATCH v2 1/4 target/tcg: Rename bitswap() helpers
From: Philippe Mathieu-Daudé <[email protected]>
In order to avoid symbol name clash when building a single binary, rename TCG helpers prefixing with the target name.
--- target/loongarch/tcg/helper.h | 2 +- target/mips/helper.h | 2 +- target/loongarch/tcg/op_helper.c | 2 +- target/mips/tcg/op_helper.c | 2 +- target/mips/tcg/translate.c | 2 +- target/loongarch/tcg/insn_trans/trans_bit.c.inc | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-)
target/loongarch/tcg/helper.h +1 -1
@@ -7,7 +7,7 @@ DEF_HELPER_2(raise_exception, noreturn, env, i32) DEF_HELPER_FLAGS_1(bitrev_w, TCG_CALL_NO_RWG_SE, tl, tl) DEF_HELPER_FLAGS_1(bitrev_d, TCG_CALL_NO_RWG_SE, tl, tl) -DEF_HELPER_FLAGS_1(bitswap, TCG_CALL_NO_RWG_SE, tl, tl) +DEF_HELPER_FLAGS_1(loongarch_bitswap, TCG_CALL_NO_RWG_SE, tl, tl) DEF_HELPER_FLAGS_3(asrtle_d, TCG_CALL_NO_WG, void, env, tl, tl)DEF_HELPER_FLAGS_3 (asrtgt_d,TCG_CALL_NO_WG , void, env, tl, tl)
target/mips/helper.h +1 -1
@@ -16,7 +16,7 @@ DEF_HELPER_3(lld, tl, env, tl, i32)#endif #endif -DEF_HELPER_FLAGS_1(bitswap, TCG_CALL_NO_RWG_SE, tl, tl) +DEF_HELPER_FLAGS_1(mips_bitswap, TCG_CALL_NO_RWG_SE, tl, tl)#ifdef TARGET_MIPS64 DEF_HELPER_FLAGS_1(dbitswap, TCG_CALL_NO_RWG_SE, tl, tl)#endif
target/loongarch/tcg/op_helper.c +1 -1
@@ -32,7 +32,7 @@ target_ulong helper_bitrev_d(target_ulong rj)return revbit64 (rj); } -target_ulong helper_bitswap (target_ulong v) +target_ulong helper_loongarch_bitswap (target_ulong v) { v = ((v >>1 ) & (target_ulong )0x5555555555555555ULL ) | ((v & (target_ulong )0x5555555555555555ULL ) <<1 );
target/mips/tcg/op_helper.c +1 -1
@@ -45,7 +45,7 @@ target_ulong helper_dbitswap(target_ulong rt) }#endif -target_ulong helper_bitswap (target_ulong rt) +target_ulong helper_mips_bitswap (target_ulong rt) {return (int32_t )bitswap (rt); }
target/mips/tcg/translate.c +1 -1
@@ -4842,7 +4842,7 @@ static void gen_bitswap(DisasContext *ctx, int opc, int rd, int rt)gen_load_gpr (t0, rt);switch (opc) {case OPC_BITSWAP : -gen_helper_bitswap (cpu_gpr[rd], t0); +gen_helper_mips_bitswap (cpu_gpr[rd], t0);break ;#if defined(TARGET_MIPS64 )case OPC_DBITSWAP :
target/loongarch/tcg/insn_trans/trans_bit.c.inc +2 -2
@@ -194,8 +194,8 @@ TRANS(revb_2w, 64, gen_rr, EXT_NONE, EXT_NONE, gen_revb_2w) TRANS(revb_d, 64, gen_rr, EXT_NONE, EXT_NONE, tcg_gen_bswap64_i64) TRANS(revh_2w, 64, gen_rr, EXT_NONE, EXT_NONE, gen_revh_2w) TRANS(revh_d, 64, gen_rr, EXT_NONE, EXT_NONE, gen_revh_d) -TRANS(bitrev_4b, ALL, gen_rr, EXT_ZERO, EXT_SIGN, gen_helper_bitswap) -TRANS(bitrev_8b, 64, gen_rr, EXT_NONE, EXT_NONE, gen_helper_bitswap) +TRANS(bitrev_4b, ALL, gen_rr, EXT_ZERO, EXT_SIGN, gen_helper_loongarch_bitswap) +TRANS(bitrev_8b, 64, gen_rr, EXT_NONE, EXT_NONE, gen_helper_loongarch_bitswap) TRANS(bitrev_w, ALL, gen_rr, EXT_NONE, EXT_SIGN, gen_helper_bitrev_w) TRANS(bitrev_d, 64, gen_rr, EXT_NONE, EXT_NONE, gen_helper_bitrev_d) TRANS(maskeqz, ALL, gen_rrr, EXT_NONE, EXT_NONE, EXT_NONE, gen_maskeqz)
Signature · 1 line
2.53.0
RFC PATCH v2 2/4 target/tcg: Rename crc32*() helpers
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
In order to avoid symbol name clash when building a single binary, rename TCG helpers prefixing with the target name.
--- target/arm/tcg/helper-defs.h | 4 ++-- target/i386/ops_sse.h | 2 +- target/loongarch/tcg/helper.h | 4 ++-- target/mips/helper.h | 4 ++-- target/i386/tcg/ops_sse_header.h.inc | 2 +- target/arm/tcg/arith_helper.c | 4 ++-- target/arm/tcg/translate.c | 4 ++-- target/loongarch/tcg/op_helper.c | 4 ++-- target/mips/tcg/op_helper.c | 4 ++-- target/mips/tcg/translate.c | 4 ++-- target/i386/tcg/emit.c.inc | 2 +- .../loongarch/tcg/insn_trans/trans_extra.c.inc | 16 ++++++++-------- 12 files changed, 27 insertions(+), 27 deletions(-)
target/arm/tcg/helper-defs.h +2 -2
@@ -493,8 +493,8 @@ DEF_HELPER_FLAGS_4(crypto_sm4ekey, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(crypto_rax1, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) -DEF_HELPER_FLAGS_3(crc32, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) -DEF_HELPER_FLAGS_3(crc32c, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) +DEF_HELPER_FLAGS_3(arm_crc32, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) +DEF_HELPER_FLAGS_3(arm_crc32c, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32)DEF_HELPER_FLAGS_5 (gvec_qrdmlah_s16,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, ptr, i32)
target/i386/ops_sse.h +1 -1
@@ -2111,7 +2111,7 @@ void glue(helper_pcmpistrm, SUFFIX)(CPUX86State *env, Reg *d, Reg *s,#define CRCPOLY 0x1edc6f41#define CRCPOLY_BITREV 0x82f63b78 -target_ulong helper_crc32 (uint32_t crc1,target_ulong msg,uint32_t len) +target_ulong helper_x86_crc32 (uint32_t crc1,target_ulong msg,uint32_t len) {target_ulong crc = (msg & ((target_ulong) -1 >> (TARGET_LONG_BITS - len))) ^ crc1;
target/loongarch/tcg/helper.h +2 -2
@@ -12,8 +12,8 @@ DEF_HELPER_FLAGS_1(loongarch_bitswap, TCG_CALL_NO_RWG_SE, tl, tl) DEF_HELPER_FLAGS_3(asrtle_d, TCG_CALL_NO_WG, void, env, tl, tl) DEF_HELPER_FLAGS_3(asrtgt_d, TCG_CALL_NO_WG, void, env, tl, tl) -DEF_HELPER_FLAGS_3(crc32, TCG_CALL_NO_RWG_SE, tl, tl, tl, tl) -DEF_HELPER_FLAGS_3(crc32c, TCG_CALL_NO_RWG_SE, tl, tl, tl, tl) +DEF_HELPER_FLAGS_3(loongarch_crc32, TCG_CALL_NO_RWG_SE, tl, tl, tl, tl) +DEF_HELPER_FLAGS_3(loongarch_crc32c, TCG_CALL_NO_RWG_SE, tl, tl, tl, tl)DEF_HELPER_FLAGS_2 (cpucfg,TCG_CALL_NO_RWG_SE , tl, env, tl)/* Floating-point helper */
target/mips/helper.h +2 -2
@@ -21,8 +21,8 @@ DEF_HELPER_FLAGS_1(mips_bitswap, TCG_CALL_NO_RWG_SE, tl, tl) DEF_HELPER_FLAGS_1(dbitswap, TCG_CALL_NO_RWG_SE, tl, tl)#endif -DEF_HELPER_3(crc32, tl, tl, tl, i32) -DEF_HELPER_3(crc32c, tl, tl, tl, i32) +DEF_HELPER_3(mips_crc32, tl, tl, tl, i32) +DEF_HELPER_3(mips_crc32c, tl, tl, tl, i32)DEF_HELPER_FLAGS_4 (rotx,TCG_CALL_NO_RWG_SE , tl, tl, i32, i32, i32)/* microMIPS functions */
target/i386/tcg/ops_sse_header.h.inc +1 -1
@@ -337,7 +337,7 @@ DEF_HELPER_4(glue(pcmpestri, SUFFIX), void, env, Reg, Reg, i32) DEF_HELPER_4(glue(pcmpestrm, SUFFIX), void, env, Reg, Reg, i32) DEF_HELPER_4(glue(pcmpistri, SUFFIX), void, env, Reg, Reg, i32) DEF_HELPER_4(glue(pcmpistrm, SUFFIX), void, env, Reg, Reg, i32) -DEF_HELPER_3(crc32, tl, i32, tl, i32) +DEF_HELPER_3(x86_crc32, tl, i32, tl, i32) #endif /* AES-NI op helpers */
target/arm/tcg/arith_helper.c +2 -2
@@ -275,7 +275,7 @@ uint32_t HELPER(sel_flags)(uint32_t flags, uint32_t a, uint32_t b)* The upper bytes of val (above the number specified by 'bytes') must have * been zeroed out by the caller. */ -uint32_t HELPER (crc32 )(uint32_t acc,uint32_t val,uint32_t bytes) +uint32_t HELPER (arm_crc32 )(uint32_t acc,uint32_t val,uint32_t bytes) {uint8_t buf[4 ];
@@ -285,7 +285,7 @@ uint32_t HELPER(crc32)(uint32_t acc, uint32_t val, uint32_t bytes)return crc32 (acc ^0xffffffff , buf, bytes) ^0xffffffff ; } -uint32_t HELPER (crc32c )(uint32_t acc,uint32_t val,uint32_t bytes) +uint32_t HELPER (arm_crc32c )(uint32_t acc,uint32_t val,uint32_t bytes) {uint8_t buf[4 ];
target/arm/tcg/translate.c +2 -2
@@ -3350,9 +3350,9 @@ static bool op_crc32(DisasContext *s, arg_rrr *a, bool c, MemOp sz) } t3 =tcg_constant_i32 (1 << sz);if (c) { -gen_helper_crc32c (t1, t1, t2, t3); +gen_helper_arm_crc32c (t1, t1, t2, t3); }else { -gen_helper_crc32 (t1, t1, t2, t3); +gen_helper_arm_crc32 (t1, t1, t2, t3); }store_reg (s, a->rd, t1);return true;
target/loongarch/tcg/op_helper.c +2 -2
@@ -64,7 +64,7 @@ void helper_asrtgt_d(CPULoongArchState *env, target_ulong rj, target_ulong rk) } } -target_ulong helper_crc32 (target_ulong val,target_ulong m,uint64_t sz) +target_ulong helper_loongarch_crc32 (target_ulong val,target_ulong m,uint64_t sz) {uint8_t buf[8 ];target_ulong mask = ((sz *8 ) ==64 ) ?-1ULL : ((1ULL << (sz *8 )) -1 );
@@ -74,7 +74,7 @@ target_ulong helper_crc32(target_ulong val, target_ulong m, uint64_t sz)return (int32_t ) (crc32 (val ^0xffffffff , buf, sz) ^0xffffffff ); } -target_ulong helper_crc32c (target_ulong val,target_ulong m,uint64_t sz) +target_ulong helper_loongarch_crc32c (target_ulong val,target_ulong m,uint64_t sz) {uint8_t buf[8 ];target_ulong mask = ((sz *8 ) ==64 ) ?-1ULL : ((1ULL << (sz *8 )) -1 );
target/mips/tcg/op_helper.c +2 -2
@@ -145,7 +145,7 @@ target_ulong helper_rotx(target_ulong rs, uint32_t shift, uint32_t shiftx, }/* these crc32 functions are based on target/loongarch/tcg/op_helper.c */ -target_ulong helper_crc32 (target_ulong val,target_ulong m,uint32_t sz) +target_ulong helper_mips_crc32 (target_ulong val,target_ulong m,uint32_t sz) {uint8_t buf[8 ]; target_ulong mask = ((sz * 8) == 64) ?
@@ -157,7 +157,7 @@ target_ulong helper_crc32(target_ulong val, target_ulong m, uint32_t sz)return (int32_t ) (crc32 (val ^0xffffffff , buf, sz) ^0xffffffff ); } -target_ulong helper_crc32c (target_ulong val,target_ulong m,uint32_t sz) +target_ulong helper_mips_crc32c (target_ulong val,target_ulong m,uint32_t sz) {uint8_t buf[8 ]; target_ulong mask = ((sz * 8) == 64) ?
target/mips/tcg/translate.c +2 -2
@@ -13445,9 +13445,9 @@ void gen_crc32(DisasContext *ctx, int rd, int rs, int rt, int sz,gen_load_gpr (t1, rs);if (crc32c) { -gen_helper_crc32c (cpu_gpr[rd], t0, t1, tsz); +gen_helper_mips_crc32c (cpu_gpr[rd], t0, t1, tsz); }else { -gen_helper_crc32 (cpu_gpr[rd], t0, t1, tsz); +gen_helper_mips_crc32 (cpu_gpr[rd], t0, t1, tsz); } }
target/i386/tcg/emit.c.inc +1 -1
@@ -1916,7 +1916,7 @@ static void gen_CRC32(DisasContext *s, X86DecodedInsn *decode) TCGv_i32 tmp = tcg_temp_new_i32(); tcg_gen_trunc_tl_i32(tmp, s->T0); - gen_helper_crc32(s->T0, tmp, s->T1, tcg_constant_i32(8 << ot)); + gen_helper_x86_crc32(s->T0, tmp, s->T1, tcg_constant_i32(8 << ot)); } static void gen_CVTPI2Px(DisasContext *s, X86DecodedInsn *decode)
target/loongarch/tcg/insn_trans/trans_extra.c.inc +8 -8
@@ -105,11 +105,11 @@ static bool gen_crc(DisasContext *ctx, arg_rrr *a, return true; } -TRANS(crc_w_b_w, CRC, gen_crc, gen_helper_crc32, tcg_constant_tl(1)) -TRANS(crc_w_h_w, CRC, gen_crc, gen_helper_crc32, tcg_constant_tl(2)) -TRANS(crc_w_w_w, CRC, gen_crc, gen_helper_crc32, tcg_constant_tl(4)) -TRANS64(crc_w_d_w, CRC, gen_crc, gen_helper_crc32, tcg_constant_tl(8)) -TRANS(crcc_w_b_w, CRC, gen_crc, gen_helper_crc32c, tcg_constant_tl(1)) -TRANS(crcc_w_h_w, CRC, gen_crc, gen_helper_crc32c, tcg_constant_tl(2)) -TRANS(crcc_w_w_w, CRC, gen_crc, gen_helper_crc32c, tcg_constant_tl(4)) -TRANS64(crcc_w_d_w, CRC, gen_crc, gen_helper_crc32c, tcg_constant_tl(8)) +TRANS(crc_w_b_w, CRC, gen_crc, gen_helper_loongarch_crc32, tcg_constant_tl(1)) +TRANS(crc_w_h_w, CRC, gen_crc, gen_helper_loongarch_crc32, tcg_constant_tl(2)) +TRANS(crc_w_w_w, CRC, gen_crc, gen_helper_loongarch_crc32, tcg_constant_tl(4)) +TRANS64(crc_w_d_w, CRC, gen_crc, gen_helper_loongarch_crc32, tcg_constant_tl(8)) +TRANS(crcc_w_b_w, CRC, gen_crc, gen_helper_loongarch_crc32c, tcg_constant_tl(1)) +TRANS(crcc_w_h_w, CRC, gen_crc, gen_helper_loongarch_crc32c, tcg_constant_tl(2)) +TRANS(crcc_w_w_w, CRC, gen_crc, gen_helper_loongarch_crc32c, tcg_constant_tl(4)) +TRANS64(crcc_w_d_w, CRC, gen_crc, gen_helper_loongarch_crc32c, tcg_constant_tl(8))
Signature · 1 line
2.53.0
RFC PATCH v2 3/4 target/tcg: Rename raise_exception() helpers
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
In order to avoid symbol name clash when building a single binary, rename TCG helpers prefixing with the target name.
--- target/hexagon/gen_tcg.h | 2 +- target/hexagon/helper.h | 2 +- target/i386/helper.h | 2 +- target/m68k/helper.h | 2 +- target/microblaze/helper.h | 2 +- target/ppc/helper.h | 2 +- target/sparc/helper.h | 2 +- target/hexagon/op_helper.c | 2 +- target/hexagon/translate.c | 2 +- target/i386/tcg/excp_helper.c | 2 +- target/i386/tcg/translate.c | 2 +- target/m68k/op_helper.c | 2 +- target/m68k/translate.c | 2 +- target/microblaze/op_helper.c | 2 +- target/microblaze/translate.c | 2 +- target/ppc/tcg-excp_helper.c | 2 +- target/ppc/translate.c | 6 +++--- target/sparc/helper.c | 2 +- target/sparc/translate.c | 6 +++--- 19 files changed, 23 insertions(+), 23 deletions(-)
target/hexagon/gen_tcg.h +1 -1
@@ -1345,7 +1345,7 @@ uiV = uiV; \tcg_gen_movi_tl (hex_gpr[HEX_REG_PC ], ctx->pkt.pc); \TCGv excp =tcg_constant_tl (HEX_EVENT_TRAP0 ); \ -gen_helper_raise_exception (tcg_env, excp); \ +gen_helper_hexagon_raise_exception (tcg_env, excp); \ } while (0)#endif
target/hexagon/helper.h +1 -1
@@ -18,7 +18,7 @@#include "internal.h" #include "helper_protos_generated.h.inc" -DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_RETURN, noreturn, env, i32) +DEF_HELPER_FLAGS_2(hexagon_raise_exception, TCG_CALL_NO_RETURN, noreturn, env, i32) DEF_HELPER_2(commit_store, void, env, int) DEF_HELPER_3(gather_store, void, env, i32, int)DEF_HELPER_1 (commit_hvx_stores, void, env)
target/i386/helper.h +1 -1
@@ -56,7 +56,7 @@ DEF_HELPER_2(syscall, void, env, int) DEF_HELPER_2(sysret, void, env, int) DEF_HELPER_FLAGS_1(pause, TCG_CALL_NO_WG, noreturn, env) DEF_HELPER_FLAGS_3(raise_interrupt, TCG_CALL_NO_WG, noreturn, env, int, int) -DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, noreturn, env, int) +DEF_HELPER_FLAGS_2(x86_raise_exception, TCG_CALL_NO_WG, noreturn, env, int) DEF_HELPER_FLAGS_1(icebp, TCG_CALL_NO_WG, noreturn, env) DEF_HELPER_3(boundw, void, env, tl, int)DEF_HELPER_3 (boundl, void, env, tl, int)
target/m68k/helper.h +1 -1
@@ -111,7 +111,7 @@ DEF_HELPER_3(set_mac_extu, void, env, i32, i32) DEF_HELPER_2(flush_flags, void, env, i32) DEF_HELPER_2(set_ccr, void, env, i32) DEF_HELPER_FLAGS_1(get_ccr, TCG_CALL_NO_WG_SE, i32, env) -DEF_HELPER_2(raise_exception, noreturn, env, i32) +DEF_HELPER_2(m68k_raise_exception, noreturn, env, i32)DEF_HELPER_FLAGS_3 (bfffo_reg,TCG_CALL_NO_RWG_SE , i32, i32, i32, i32)
target/microblaze/helper.h +1 -1
@@ -1,4 +1,4 @@ -DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, noreturn, env, i32) +DEF_HELPER_FLAGS_2(microblaze_raise_exception, TCG_CALL_NO_WG, noreturn, env, i32) DEF_HELPER_FLAGS_3(divs, TCG_CALL_NO_WG, i32, env, i32, i32)DEF_HELPER_FLAGS_3 (divu,TCG_CALL_NO_WG , i32, env, i32, i32)
target/ppc/helper.h +1 -1
@@ -1,5 +1,5 @@ DEF_HELPER_FLAGS_3(raise_exception_err, TCG_CALL_NO_WG, noreturn, env, i32, i32) -DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, noreturn, env, i32) +DEF_HELPER_FLAGS_2(ppc_raise_exception, TCG_CALL_NO_WG, noreturn, env, i32) DEF_HELPER_FLAGS_4(TW, TCG_CALL_NO_WG, void, env, tl, tl, i32)#if defined(TARGET_PPC64 )DEF_HELPER_FLAGS_4 (TD ,TCG_CALL_NO_WG , void, env, tl, tl, i32)
target/sparc/helper.h +1 -1
@@ -53,7 +53,7 @@ DEF_HELPER_FLAGS_3(fcmpq, TCG_CALL_NO_WG, i32, env, i128, i128) DEF_HELPER_FLAGS_3(fcmpeq, TCG_CALL_NO_WG, i32, env, i128, i128) DEF_HELPER_FLAGS_3(flcmps, TCG_CALL_NO_RWG_SE, i32, env, f32, f32) DEF_HELPER_FLAGS_3(flcmpd, TCG_CALL_NO_RWG_SE, i32, env, f64, f64) -DEF_HELPER_2(raise_exception, noreturn, env, int) +DEF_HELPER_2(sparc_raise_exception, noreturn, env, int) DEF_HELPER_FLAGS_3(faddd, TCG_CALL_NO_WG, f64, env, f64, f64)DEF_HELPER_FLAGS_3 (fsubd,TCG_CALL_NO_WG , f64, env, f64, f64)
target/hexagon/op_helper.c +1 -1
@@ -47,7 +47,7 @@ G_NORETURN void hexagon_raise_exception_err(CPUHexagonState *env,cpu_loop_exit_restore (cs, pc); } -G_NORETURN void HELPER(raise_exception)(CPUHexagonState *env, uint32_t excp) +G_NORETURN void HELPER(hexagon_raise_exception)(CPUHexagonState *env, uint32_t excp) {hexagon_raise_exception_err (env, excp,0 ); }
target/hexagon/translate.c +1 -1
@@ -119,7 +119,7 @@ intptr_t ctx_tmp_vreg_off(DisasContext *ctx, int regnum,static void gen_exception_raw (int excp) { -gen_helper_raise_exception (tcg_env,tcg_constant_i32 (excp)); +gen_helper_hexagon_raise_exception (tcg_env,tcg_constant_i32 (excp)); }static void gen_exec_counters (DisasContext *ctx)
target/i386/tcg/excp_helper.c +1 -1
@@ -32,7 +32,7 @@ G_NORETURN void helper_raise_interrupt(CPUX86State *env, int intno,raise_interrupt (env, intno, next_eip_addend); } -G_NORETURN void helper_raise_exception(CPUX86State *env, int exception_index) +G_NORETURN void helper_x86_raise_exception(CPUX86State *env, int exception_index) {raise_exception (env, exception_index); }
target/i386/tcg/translate.c +1 -1
@@ -1515,7 +1515,7 @@ static void gen_exception(DisasContext *s, int trapno) {gen_update_cc_op (s);gen_update_eip_cur (s); -gen_helper_raise_exception (tcg_env,tcg_constant_i32 (trapno)); +gen_helper_x86_raise_exception (tcg_env,tcg_constant_i32 (trapno)); s->base.is_jmp =DISAS_NORETURN ; }
target/m68k/op_helper.c +1 -1
@@ -553,7 +553,7 @@ G_NORETURN static void raise_exception(CPUM68KState *env, int tt)raise_exception_ra (env, tt,0 ); } -void HELPER (raise_exception )(CPUM68KState *env,uint32_t tt) +void HELPER (m68k_raise_exception )(CPUM68KState *env,uint32_t tt) {raise_exception (env, tt); }
target/m68k/translate.c +1 -1
@@ -252,7 +252,7 @@ static void gen_jmp(DisasContext *s, TCGv dest)static void gen_raise_exception (int nr) { -gen_helper_raise_exception (tcg_env,tcg_constant_i32 (nr)); +gen_helper_m68k_raise_exception (tcg_env,tcg_constant_i32 (nr)); } static void gen_raise_exception_format2(DisasContext *s, int nr,
target/microblaze/op_helper.c +1 -1
@@ -62,7 +62,7 @@ uint32_t helper_get(uint32_t id, uint32_t ctrl)return 0xdead0000 | id; } -void helper_raise_exception (CPUMBState *env,uint32_t index) +void helper_microblaze_raise_exception (CPUMBState *env,uint32_t index) {CPUState *cs =env_cpu (env);
target/microblaze/translate.c +1 -1
@@ -100,7 +100,7 @@ static void t_sync_flags(DisasContext *dc)static void gen_raise_exception (DisasContext *dc,uint32_t index) { -gen_helper_raise_exception (tcg_env,tcg_constant_i32 (index)); +gen_helper_microblaze_raise_exception (tcg_env,tcg_constant_i32 (index)); dc->base.is_jmp =DISAS_NORETURN ; }
target/ppc/tcg-excp_helper.c +1 -1
@@ -50,7 +50,7 @@ void helper_raise_exception_err(CPUPPCState *env, uint32_t exception,raise_exception_err_ra (env, exception, error_code,0 ); } -void helper_raise_exception (CPUPPCState *env,uint32_t exception) +void helper_ppc_raise_exception (CPUPPCState *env,uint32_t exception) {raise_exception_err_ra (env, exception,0 ,0 ); }
target/ppc/translate.c +3 -3
@@ -334,7 +334,7 @@ static void gen_exception_nip(DisasContext *ctx, uint32_t excp,gen_update_nip (ctx, nip); t0 =tcg_constant_i32 (excp); -gen_helper_raise_exception (tcg_env, t0); +gen_helper_ppc_raise_exception (tcg_env, t0); ctx->base.is_jmp =DISAS_NORETURN ; }
@@ -377,8 +377,8 @@ static void gen_debug_exception(DisasContext *ctx, bool rfi_type)gen_load_spr (t0,SPR_BOOKE_DBSR );tcg_gen_ori_tl (t0, t0, dbsr);gen_store_spr (SPR_BOOKE_DBSR , t0); -gen_helper_raise_exception (tcg_env, -tcg_constant_i32 (POWERPC_EXCP_DEBUG )); +gen_helper_ppc_raise_exception (tcg_env, +tcg_constant_i32 (POWERPC_EXCP_DEBUG )); ctx->base.is_jmp =DISAS_NORETURN ; }else {if (!rfi_type) {/* BookS does not single step rfi type instructions */
target/sparc/helper.c +1 -1
@@ -33,7 +33,7 @@ void cpu_raise_exception_ra(CPUSPARCState *env, int tt, uintptr_t ra)cpu_loop_exit_restore (cs, ra); } -void helper_raise_exception (CPUSPARCState *env,int tt) +void helper_sparc_raise_exception (CPUSPARCState *env,int tt) {CPUState *cs =env_cpu (env);
target/sparc/translate.c +3 -3
@@ -1048,7 +1048,7 @@ static void gen_exception(DisasContext *dc, int which) {finishing_insn (dc);save_state (dc); -gen_helper_raise_exception (tcg_env,tcg_constant_i32 (which)); +gen_helper_sparc_raise_exception (tcg_env,tcg_constant_i32 (which)); dc->base.is_jmp =DISAS_NORETURN ; }
@@ -2811,7 +2811,7 @@ static bool do_tcc(DisasContext *dc, int cond, int cc,/* Trap always. */ if (cond ==8 ) {save_state (dc); -gen_helper_raise_exception (tcg_env, trap); +gen_helper_sparc_raise_exception (tcg_env, trap); dc->base.is_jmp =DISAS_NORETURN ;return true; }
@@ -5833,7 +5833,7 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)if (e->npc %4 ==0 ) {tcg_gen_movi_tl (cpu_npc, e->npc); } -gen_helper_raise_exception (tcg_env, e->excp); +gen_helper_sparc_raise_exception (tcg_env, e->excp); e_next = e->next;g_free (e);
Signature · 1 line
2.53.0
RFC PATCH v2 4/4 target/tcg: Rename set_rounding_mode() helpers
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
In order to avoid symbol name clash when building a single binary, rename TCG helpers prefixing with the target name.
--- target/loongarch/tcg/helper.h | 2 +- target/riscv/helper.h | 2 +- target/loongarch/tcg/fpu_helper.c | 2 +- target/riscv/fpu_helper.c | 2 +- target/riscv/translate.c | 2 +- target/loongarch/tcg/insn_trans/trans_fmov.c.inc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)
target/loongarch/tcg/helper.h +1 -1
@@ -91,7 +91,7 @@ DEF_HELPER_2(ftint_w_d, i64, env, i64) DEF_HELPER_2(frint_s, i64, env, i64) DEF_HELPER_2(frint_d, i64, env, i64) -DEF_HELPER_FLAGS_1(set_rounding_mode, TCG_CALL_NO_RWG, void, env) +DEF_HELPER_FLAGS_1(loongarch_set_rounding_mode, TCG_CALL_NO_RWG, void, env)DEF_HELPER_1 (rdtime_d, i64, env)
target/riscv/helper.h +1 -1
@@ -2,7 +2,7 @@DEF_HELPER_2 (raise_exception, noreturn, env, i32) /* Floating Point - rounding mode */ -DEF_HELPER_FLAGS_2(set_rounding_mode, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_FLAGS_2(riscv_set_rounding_mode, TCG_CALL_NO_WG, void, env, i32)DEF_HELPER_FLAGS_2 (set_rounding_mode_chkfrm,TCG_CALL_NO_WG , void, env, i32)/* Floating Point - fused */
target/loongarch/tcg/fpu_helper.c +1 -1
@@ -878,7 +878,7 @@ uint64_t helper_ftint_w_d(CPULoongArchState *env, uint64_t fj)return fd; } -void helper_set_rounding_mode (CPULoongArchState *env) +void helper_loongarch_set_rounding_mode (CPULoongArchState *env) {set_float_rounding_mode (ieee_rm[(env->fcsr0 >>FCSR0_RM ) &0x3 ], &env->fp_status);
target/riscv/fpu_helper.c +1 -1
@@ -66,7 +66,7 @@ void riscv_cpu_check_fflags(CPURISCVState *env, FloatExceptionFlags pre_fflag) {}#endif -void helper_set_rounding_mode (CPURISCVState *env,uint32_t rm) +void helper_riscv_set_rounding_mode (CPURISCVState *env,uint32_t rm) {FloatRoundMode softrm;
target/riscv/translate.c +1 -1
@@ -759,7 +759,7 @@ static void gen_set_rm(DisasContext *ctx, uint8_t rm)/* The helper may raise ILLEGAL_INSN -- record binv for unwind. */ decode_save_opc (ctx,0 ); -gen_helper_set_rounding_mode (tcg_env,tcg_constant_i32 (rm)); +gen_helper_riscv_set_rounding_mode (tcg_env,tcg_constant_i32 (rm)); }static void gen_set_rm_chkfrm (DisasContext *ctx,uint8_t rm)
target/loongarch/tcg/insn_trans/trans_fmov.c.inc +1 -1
@@ -112,7 +112,7 @@ static bool trans_movgr2fcsr(DisasContext *ctx, arg_movgr2fcsr *a) * Note that FCSR3 is exactly the rounding mode field. */ if (mask & FCSR0_M3) { - gen_helper_set_rounding_mode(tcg_env); + gen_helper_loongarch_set_rounding_mode(tcg_env); } return true; }
Signature · 1 line
2.53.0
Re: [RFC PATCH v2 4/4] target/tcg: Rename set_rounding_mode() helpers
Quoted 10 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
In order to avoid symbol name clash when building a single binary, rename TCG helpers prefixing with the target name.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Brian Cain <[email protected]>Reviewed-by Pierrick Bouvier <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 87 lines
--- target/loongarch/tcg/helper.h | 2 +- target/riscv/helper.h | 2 +- target/loongarch/tcg/fpu_helper.c | 2 +- target/riscv/fpu_helper.c | 2 +- target/riscv/translate.c | 2 +- target/loongarch/tcg/insn_trans/trans_fmov.c.inc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)target/loongarch/tcg/helper.h +1
-1@@ -91,7 +91,7 @@ DEF_HELPER_2(ftint_w_d, i64, env, i64) DEF_HELPER_2(frint_s, i64, env, i64) DEF_HELPER_2(frint_d, i64, env, i64) -DEF_HELPER_FLAGS_1(set_rounding_mode, TCG_CALL_NO_RWG, void, env) +DEF_HELPER_FLAGS_1(loongarch_set_rounding_mode, TCG_CALL_NO_RWG, void, env)DEF_HELPER_1 (rdtime_d, i64, env)target/riscv/helper.h +1
-1@@ -2,7 +2,7 @@DEF_HELPER_2 (raise_exception, noreturn, env, i32) /* Floating Point - rounding mode */ -DEF_HELPER_FLAGS_2(set_rounding_mode, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_FLAGS_2(riscv_set_rounding_mode, TCG_CALL_NO_WG, void, env, i32)DEF_HELPER_FLAGS_2 (set_rounding_mode_chkfrm,TCG_CALL_NO_WG , void, env, i32)/* Floating Point - fused */ target/loongarch/tcg/fpu_helper.c +1
-1@@ -878,7 +878,7 @@ uint64_t helper_ftint_w_d(CPULoongArchState *env, uint64_t fj)return fd; } -void helper_set_rounding_mode (CPULoongArchState *env) +void helper_loongarch_set_rounding_mode (CPULoongArchState *env) {set_float_rounding_mode (ieee_rm[(env->fcsr0 >>FCSR0_RM ) &0x3 ], &env->fp_status);target/riscv/fpu_helper.c +1
-1@@ -66,7 +66,7 @@ void riscv_cpu_check_fflags(CPURISCVState *env, FloatExceptionFlags pre_fflag) {}#endif -void helper_set_rounding_mode (CPURISCVState *env,uint32_t rm) +void helper_riscv_set_rounding_mode (CPURISCVState *env,uint32_t rm) {FloatRoundMode softrm;target/riscv/translate.c +1
-1@@ -759,7 +759,7 @@ static void gen_set_rm(DisasContext *ctx, uint8_t rm)/* The helper may raise ILLEGAL_INSN -- record binv for unwind. */ decode_save_opc (ctx,0 ); -gen_helper_set_rounding_mode (tcg_env,tcg_constant_i32 (rm)); +gen_helper_riscv_set_rounding_mode (tcg_env,tcg_constant_i32 (rm)); }static void gen_set_rm_chkfrm (DisasContext *ctx,uint8_t rm)target/loongarch/tcg/insn_trans/trans_fmov.c.inc +1
-1@@ -112,7 +112,7 @@ static bool trans_movgr2fcsr(DisasContext *ctx, arg_movgr2fcsr *a) * Note that FCSR3 is exactly the rounding mode field. */ if (mask & FCSR0_M3) { - gen_helper_set_rounding_mode(tcg_env); + gen_helper_loongarch_set_rounding_mode(tcg_env); } return true; }
Re: [RFC PATCH v2 4/4] target/tcg: Rename set_rounding_mode() helpers
In reply to Philippe Mathieu-DaudéQuoted 11 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
In order to avoid symbol name clash when building a single binary, rename TCG helpers prefixing with the target name.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Brian Cain <[email protected]>Reviewed-by Pierrick Bouvier <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 91 lines
--- target/loongarch/tcg/helper.h | 2 +- target/riscv/helper.h | 2 +- target/loongarch/tcg/fpu_helper.c | 2 +- target/riscv/fpu_helper.c | 2 +- target/riscv/translate.c | 2 +- target/loongarch/tcg/insn_trans/trans_fmov.c.inc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)target/loongarch/tcg/helper.h +1
-1@@ -91,7 +91,7 @@ DEF_HELPER_2(ftint_w_d, i64, env, i64) DEF_HELPER_2(frint_s, i64, env, i64) DEF_HELPER_2(frint_d, i64, env, i64) -DEF_HELPER_FLAGS_1(set_rounding_mode, TCG_CALL_NO_RWG, void, env) +DEF_HELPER_FLAGS_1(loongarch_set_rounding_mode, TCG_CALL_NO_RWG, void, env)DEF_HELPER_1 (rdtime_d, i64, env)target/riscv/helper.h +1
-1@@ -2,7 +2,7 @@DEF_HELPER_2 (raise_exception, noreturn, env, i32) /* Floating Point - rounding mode */ -DEF_HELPER_FLAGS_2(set_rounding_mode, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_FLAGS_2(riscv_set_rounding_mode, TCG_CALL_NO_WG, void, env, i32)DEF_HELPER_FLAGS_2 (set_rounding_mode_chkfrm,TCG_CALL_NO_WG , void, env, i32)/* Floating Point - fused */ target/loongarch/tcg/fpu_helper.c +1
-1@@ -878,7 +878,7 @@ uint64_t helper_ftint_w_d(CPULoongArchState *env, uint64_t fj)return fd; } -void helper_set_rounding_mode (CPULoongArchState *env) +void helper_loongarch_set_rounding_mode (CPULoongArchState *env) {set_float_rounding_mode (ieee_rm[(env->fcsr0 >>FCSR0_RM ) &0x3 ], &env->fp_status);target/riscv/fpu_helper.c +1
-1@@ -66,7 +66,7 @@ void riscv_cpu_check_fflags(CPURISCVState *env, FloatExceptionFlags pre_fflag) {}#endif -void helper_set_rounding_mode (CPURISCVState *env,uint32_t rm) +void helper_riscv_set_rounding_mode (CPURISCVState *env,uint32_t rm) {FloatRoundMode softrm;target/riscv/translate.c +1
-1@@ -759,7 +759,7 @@ static void gen_set_rm(DisasContext *ctx, uint8_t rm)/* The helper may raise ILLEGAL_INSN -- record binv for unwind. */ decode_save_opc (ctx,0 ); -gen_helper_set_rounding_mode (tcg_env,tcg_constant_i32 (rm)); +gen_helper_riscv_set_rounding_mode (tcg_env,tcg_constant_i32 (rm)); }static void gen_set_rm_chkfrm (DisasContext *ctx,uint8_t rm)target/loongarch/tcg/insn_trans/trans_fmov.c.inc +1
-2@@ -112,7 +112,7 @@ static bool trans_movgr2fcsr(DisasContext *ctx, arg_movgr2fcsr *a) * Note that FCSR3 is exactly the rounding mode field. */ if (mask & FCSR0_M3) { - gen_helper_set_rounding_mode(tcg_env); + gen_helper_loongarch_set_rounding_mode(tcg_env); } return true; } --2.53.0