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           | 10 +++++-----
  tcg/tcg-op.c             |  4 ++--
  tcg/tcg.c                |  6 ++----
  tcg/tci.c                | 13 ++++---------
  docs/devel/tcg-ops.rst   |  4 ++--
  tcg/tci/tcg-target.c.inc |  2 +-
  7 files changed, 17 insertions(+), 25 deletions(-)


diff --git a/tcg/optimize.c b/tcg/optimize.c
index 6f0887f808..bc882dbe31 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -434,10 +434,10 @@ static uint64_t do_constant_folding_2(TCGOpcode op, 
TCGType type,
      case INDEX_op_xor_vec:
          return x ^ y;
- case INDEX_op_shl_i32:
-        return (uint32_t)x << (y & 31);
-
-    case INDEX_op_shl_i64:
+    case INDEX_op_shl:
+        if (type == TCG_TYPE_I32) {
+            return (uint32_t)x << (y & 31);
+        }
          return (uint64_t)x << (y & 63);

Or directly:

    return (tcg_target_ulong)x << (y % TCG_TARGET_REG_BITS);

Reply via email to