[llvm] [RISCV] Pass sign-extended value to isInt check in expandMul (PR #150211)

Sudharsan Veeravalli via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 23 04:27:13 PDT 2025


https://github.com/svs-quic created https://github.com/llvm/llvm-project/pull/150211

In the `isInt` check that was added in #147661 we were passing the zero-extended `uint64_t` value instead of the sign-extended one.

>From a5a125c4ecc10902ab43f958eee81ce0ad3adf7c Mon Sep 17 00:00:00 2001
From: Sudharsan Veeravalli <quic_svs at quicinc.com>
Date: Wed, 23 Jul 2025 16:53:53 +0530
Subject: [PATCH] [RISCV] Pass sign-extended value to isInt check in expandMul

In the isInt check that was added in # we were passing the zero-extended uint64_t
value instead of the sign-extended one.
---
 llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 3918dd21bc09d..fa0196ff25339 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -16079,7 +16079,7 @@ static SDValue expandMul(SDNode *N, SelectionDAG &DAG,
   uint64_t MulAmt = CNode->getZExtValue();
 
   // Don't do this if the Xqciac extension is enabled and the MulAmt in simm12.
-  if (Subtarget.hasVendorXqciac() && isInt<12>(MulAmt))
+  if (Subtarget.hasVendorXqciac() && isInt<12>(CNode->getSExtValue()))
     return SDValue();
 
   const bool HasShlAdd = Subtarget.hasStdExtZba() ||



More information about the llvm-commits mailing list