[llvm] [X86] added computeKnownBits for X86ISD::GF2P8AFFINEQB (PR #194197)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 1 21:33:27 PDT 2026
================
@@ -39022,6 +39026,51 @@ void X86TargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
Known.resetAll();
switch (Opc) {
default: break;
+ case X86ISD::GF2P8AFFINEQB: {
+ SDValue Input = Op.getOperand(0);
+ SDValue Matrix = Op.getOperand(1);
+ SDValue Imm = Op.getOperand(2);
+
+ auto *ImmN = dyn_cast<ConstantSDNode>(Imm);
+ if (!ImmN)
+ break;
+
+ uint8_t Imm8 = ImmN->getZExtValue();
+ APInt UndefElts;
+ SmallVector<APInt, 64> MatEltBits;
+ if (!getTargetConstantBitsFromNode(Matrix, 8, UndefElts, MatEltBits,
+ /*AllowWholeUndefs=*/false,
+ /*AllowPartialUndefs=*/false))
+ break;
+
+ KnownBits InputKnown = DAG.computeKnownBits(Input, DemandedElts, Depth + 1);
+
+ APInt KnownMask = InputKnown.Zero | InputKnown.One;
+ KnownBits Res(BitWidth);
+ Res.resetAll();
+
+ for (unsigned OutBit = 0; OutBit != 8; ++OutBit) {
+ unsigned RowIdx = 7 - OutBit;
+
+ uint8_t Row = MatEltBits[RowIdx].getZExtValue();
----------------
WalterKruger wrote:
Or you can guard the entire analysis by checking if the matrix is splat. Although it shouldn't be too expensive since it doesn't need additional `computeKnownBits` calls.
https://github.com/llvm/llvm-project/pull/194197
More information about the llvm-commits
mailing list