On 2/17/25 00:29, Philippe Mathieu-Daudé wrote:
On 17/2/25 00:08, Richard Henderson wrote:
Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
---
include/tcg/tcg-opc.h | 5 +----
tcg/optimize.c | 9 +++++----
tcg/tcg-op.c | 8 ++++----
tcg/tcg.c | 6 ++----
tcg/tci.c | 4 ++--
docs/devel/tcg-ops.rst | 2 +-
tcg/tci/tcg-target.c.inc | 2 +-
7 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 55663ff4c3..6f0887f808 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -563,9 +563,10 @@ static uint64_t do_constant_folding_2(TCGOpcode op,
TCGType type,
}
return (int64_t)x % ((int64_t)y ? : 1);
- case INDEX_op_remu_i32:
- return (uint32_t)x % ((uint32_t)y ? : 1);
- case INDEX_op_remu_i64:
+ case INDEX_op_remu:
+ if (type == TCG_TYPE_I32) {
+ return (uint32_t)x % ((uint32_t)y ? : 1);
+ }
return (uint64_t)x % ((uint64_t)y ? : 1);
Or directly:
return (tcg_target_ulong)x % ((tcg_target_ulong)y ? : 1);
64-bit hosts need both expressions.
r~