On 17/2/25 00:08, Richard Henderson wrote:
Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
---
  include/tcg/tcg-opc.h    |  3 +--
  tcg/optimize.c           |  9 +++++----
  tcg/tcg-op.c             | 16 ++++++++--------
  tcg/tcg.c                |  6 ++----
  tcg/tci.c                |  5 ++---
  docs/devel/tcg-ops.rst   |  2 +-
  tcg/tci/tcg-target.c.inc |  2 +-
  7 files changed, 20 insertions(+), 23 deletions(-)


diff --git a/tcg/optimize.c b/tcg/optimize.c
index 127d0f9390..77386eacb7 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -551,9 +551,10 @@ static uint64_t do_constant_folding_2(TCGOpcode op, 
TCGType type,
          }
          return (int64_t)x / ((int64_t)y ? : 1);
- case INDEX_op_divu_i32:
-        return (uint32_t)x / ((uint32_t)y ? : 1);
-    case INDEX_op_divu_i64:
+    case INDEX_op_divu:
+        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);


Reply via email to