From: Richard Henderson Date: Fri, 19 Dec 2025 04:30:39 +0000 (+1100) Subject: tcg: Replace TCG_TARGET_REG_BITS / 8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=186993f23d88aabd8e99ebedd7f4920897856691;p=thirdparty%2Fqemu.git tcg: Replace TCG_TARGET_REG_BITS / 8 Use sizeof(tcg_target_long) instead of division. Reviewed-by: Thomas Huth Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index 10c69211ac..c3350c90fc 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -2604,7 +2604,7 @@ static const int tcg_target_callee_save_regs[] = { }; /* Stack frame parameters. */ -#define REG_SIZE (TCG_TARGET_REG_BITS / 8) +#define REG_SIZE ((int)sizeof(tcg_target_long)) #define SAVE_SIZE ((int)ARRAY_SIZE(tcg_target_callee_save_regs) * REG_SIZE) #define TEMP_SIZE (CPU_TEMP_BUF_NLONGS * (int)sizeof(long)) #define FRAME_SIZE ((TCG_STATIC_CALL_ARGS_SIZE + TEMP_SIZE + SAVE_SIZE \ @@ -2731,7 +2731,7 @@ static const DebugFrame debug_frame = { .h.cie.id = -1, .h.cie.version = 1, .h.cie.code_align = 1, - .h.cie.data_align = -(TCG_TARGET_REG_BITS / 8) & 0x7f, /* sleb128 */ + .h.cie.data_align = -sizeof(tcg_target_long) & 0x7f, /* sleb128 */ .h.cie.return_column = TCG_REG_RA, /* Total FDE size does not include the "len" member. */ diff --git a/tcg/ppc64/tcg-target.c.inc b/tcg/ppc64/tcg-target.c.inc index 3c36b26f25..b54afa0b6d 100644 --- a/tcg/ppc64/tcg-target.c.inc +++ b/tcg/ppc64/tcg-target.c.inc @@ -70,7 +70,7 @@ #define SZP ((int)sizeof(void *)) /* Shorthand for size of a register. */ -#define SZR (TCG_TARGET_REG_BITS / 8) +#define SZR ((int)sizeof(tcg_target_long)) #define TCG_CT_CONST_S16 0x00100 #define TCG_CT_CONST_U16 0x00200 diff --git a/tcg/riscv64/tcg-target.c.inc b/tcg/riscv64/tcg-target.c.inc index 0967a445a3..76dd4fca97 100644 --- a/tcg/riscv64/tcg-target.c.inc +++ b/tcg/riscv64/tcg-target.c.inc @@ -2934,7 +2934,7 @@ static const int tcg_target_callee_save_regs[] = { }; /* Stack frame parameters. */ -#define REG_SIZE (TCG_TARGET_REG_BITS / 8) +#define REG_SIZE ((int)sizeof(tcg_target_long)) #define SAVE_SIZE ((int)ARRAY_SIZE(tcg_target_callee_save_regs) * REG_SIZE) #define TEMP_SIZE (CPU_TEMP_BUF_NLONGS * (int)sizeof(long)) #define FRAME_SIZE ((TCG_STATIC_CALL_ARGS_SIZE + TEMP_SIZE + SAVE_SIZE \ @@ -3114,7 +3114,7 @@ static const DebugFrame debug_frame = { .h.cie.id = -1, .h.cie.version = 1, .h.cie.code_align = 1, - .h.cie.data_align = -(TCG_TARGET_REG_BITS / 8) & 0x7f, /* sleb128 */ + .h.cie.data_align = -sizeof(tcg_target_long) & 0x7f, /* sleb128 */ .h.cie.return_column = TCG_REG_RA, /* Total FDE size does not include the "len" member. */ diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 2d184547ba..9c33430638 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -607,7 +607,7 @@ static void do_dup(unsigned vece, TCGv_ptr dbase, uint32_t dofs, } /* Otherwise, inline with an integer type, unless "large". */ - if (check_size_impl(oprsz, TCG_TARGET_REG_BITS / 8)) { + if (check_size_impl(oprsz, sizeof(tcg_target_long))) { t_64 = NULL; t_32 = NULL;