[llvm] [ValueTracking][X86] Compute KnownBits for phadd/phsub (PR #92429)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu May 16 10:11:52 PDT 2024
================
@@ -37262,6 +37262,27 @@ void X86TargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
}
break;
}
+ case X86ISD::HADD: {
+ Known = DAG.computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
----------------
RKSimon wrote:
You can't use the result DemandedElts for the source operands you'll need something like:
```cpp
APInt DemandedLHS, DemandedRHS;
getHorizDemandedElts(VT, DemandedElts, DemandedLHS, DemandedRHS);
```
You can avoid computeKnownBits calls for cases where either DemandedLHS/RHS are zero.
Plus you can probably get more refined knownbits by getting the known bits of the odd/even elements separately, although that could mean 4 computeKnownBits calls.
https://github.com/llvm/llvm-project/pull/92429
More information about the llvm-commits
mailing list