[llvm] [RISCV] Use QC.INSBI instead of ORI when possible (PR #147349)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 7 20:51:05 PDT 2025


================
@@ -681,6 +681,43 @@ bool RISCVDAGToDAGISel::trySignedBitfieldExtract(SDNode *Node) {
   return false;
 }
 
+bool RISCVDAGToDAGISel::trySignedBitfieldInsertInMask(SDNode *Node) {
+  // Supported only in Xqcibm for now.
+  if (!Subtarget->hasVendorXqcibm())
+    return false;
+
+  auto *N1C = dyn_cast<ConstantSDNode>(Node->getOperand(1));
+  if (!N1C)
+    return false;
+
+  int32_t C1 = N1C->getSExtValue();
+  if (!(isShiftedMask_32(C1) && !isInt<12>(C1)))
----------------
topperc wrote:

```suggestion
  if (!isShiftedMask_32(C1) || isInt<12>(C1))
```

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


More information about the llvm-commits mailing list