[llvm] [AArch64] SimplifyDemandedBitsForTargetNode - add AArch64ISD::BICi handling (PR #76644)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 27 03:20:01 PDT 2024


================
@@ -24580,6 +24580,19 @@ SDValue AArch64TargetLowering::PerformDAGCombine(SDNode *N,
     if (auto R = foldOverflowCheck(N, DAG, /* IsAdd */ false))
       return R;
     return performFlagSettingCombine(N, DCI, AArch64ISD::SBC);
+  case AArch64ISD::BICi: {
+    KnownBits Known;
+    APInt DemandedBits =
+        APInt::getAllOnes(N->getValueType(0).getScalarSizeInBits());
+    APInt DemandedElts =
+        APInt::getAllOnes(N->getValueType(0).getVectorNumElements());
+    TargetLowering::TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(),
+                                          !DCI.isBeforeLegalizeOps());
+    if (DAG.getTargetLoweringInfo().SimplifyDemandedBits(
+            SDValue(N, 0), DemandedBits, DemandedElts, Known, TLO))
----------------
RKSimon wrote:

There is a DCI variant that you could use so you don't have to bother with the TargetLoweringOpt code:
```cpp
if (DAG.getTargetLoweringInfo().SimplifyDemandedBits(SDValue(N, 0), DemandedBits, DemandedElts, DCI))
```

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


More information about the llvm-commits mailing list