[llvm] [RISCV] Select signed bitfield insert for XAndesPerf (PR #143356)

Jim Lin via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 19:26:00 PDT 2025


================
@@ -671,6 +671,59 @@ bool RISCVDAGToDAGISel::trySignedBitfieldExtract(SDNode *Node) {
   return false;
 }
 
+bool RISCVDAGToDAGISel::trySignedBitfieldInsertInSign(SDNode *Node) {
+  // Only supported with XAndesPerf at the moment.
+  if (!Subtarget->hasVendorXAndesPerf())
+    return false;
+
+  auto *N1C = dyn_cast<ConstantSDNode>(Node->getOperand(1));
+  if (!N1C)
+    return false;
+
+  SDValue N0 = Node->getOperand(0);
+  if (!N0.hasOneUse())
+    return false;
+
+  auto BitfieldInsert = [&](SDValue N0, unsigned Msb, unsigned Lsb, SDLoc DL,
----------------
tclin914 wrote:

Done.

https://github.com/llvm/llvm-project/pull/143356


More information about the llvm-commits mailing list