[llvm] [X86][ISel] Improve VPTERNLOG matching for negated logic trees (PR #164863)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 23 18:56:29 PDT 2025
================
@@ -4740,6 +4737,35 @@ bool X86DAGToDAGISel::tryVPTERNLOG(SDNode *N) {
return SDValue();
};
+ // Identify and (optionally) peel an outer NOT that wraps a pure logic tree
+ auto tryPeelOuterNotWrappingLogic = [&](SDNode *Op) {
+ if (Op->getOpcode() == ISD::XOR && Op->hasOneUse() &&
+ ISD::isBuildVectorAllOnes(Op->getOperand(1).getNode())) {
+ SDNode *InnerN = Op->getOperand(0).getNode();
----------------
phoebewang wrote:
Use SDValue and `SDValue()` for the return, then we can use
```
if (SDValue InnerOp = tryPeelOuterNotWrappingLogic(N)) {
PeeledOuterNot = true;
N = InnerOp.getNode();
}
```
https://github.com/llvm/llvm-project/pull/164863
More information about the llvm-commits
mailing list