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           | 12 ++++++------
  tcg/tcg-op.c             |  4 ++--
  tcg/tcg.c                |  6 ++----
  tcg/tci.c                | 12 ++++--------
  docs/devel/tcg-ops.rst   |  4 ++--
  tcg/tci/tcg-target.c.inc |  3 +--
  7 files changed, 18 insertions(+), 26 deletions(-)


diff --git a/tcg/optimize.c b/tcg/optimize.c
index a10fb67da8..edf5c1c77a 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -446,10 +446,10 @@ static uint64_t do_constant_folding_2(TCGOpcode op, 
TCGType type,
          }
          return (uint64_t)x >> (y & 63);
- case INDEX_op_sar_i32:
-        return (int32_t)x >> (y & 31);
-
-    case INDEX_op_sar_i64:
+    case INDEX_op_sar:
+        if (type == TCG_TYPE_I32) {
+            return (int32_t)x >> (y & 31);
+        }
          return (int64_t)x >> (y & 63);

Directly:

    return (tcg_target_long)x >> (y % TCG_TARGET_REG_BITS);


Reply via email to