Skip to content

Commit 44cff96

Browse files
committed
[X86] computeKnownBitsForPMADDWD/PMADDUBSW - tidyup line overflow by moving extensions to the multiply stage. NFC.
1 parent 9e6625d commit 44cff96

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37092,16 +37092,12 @@ static void computeKnownBitsForPMADDWD(SDValue LHS, SDValue RHS,
3709237092
DemandedSrcElts & APInt::getSplat(NumSrcElts, APInt(2, 0b01));
3709337093
APInt DemandedHiElts =
3709437094
DemandedSrcElts & APInt::getSplat(NumSrcElts, APInt(2, 0b10));
37095-
KnownBits LHSLo =
37096-
DAG.computeKnownBits(LHS, DemandedLoElts, Depth + 1).sext(32);
37097-
KnownBits LHSHi =
37098-
DAG.computeKnownBits(LHS, DemandedHiElts, Depth + 1).sext(32);
37099-
KnownBits RHSLo =
37100-
DAG.computeKnownBits(RHS, DemandedLoElts, Depth + 1).sext(32);
37101-
KnownBits RHSHi =
37102-
DAG.computeKnownBits(RHS, DemandedHiElts, Depth + 1).sext(32);
37103-
KnownBits Lo = KnownBits::mul(LHSLo, RHSLo);
37104-
KnownBits Hi = KnownBits::mul(LHSHi, RHSHi);
37095+
KnownBits LHSLo = DAG.computeKnownBits(LHS, DemandedLoElts, Depth + 1);
37096+
KnownBits LHSHi = DAG.computeKnownBits(LHS, DemandedHiElts, Depth + 1);
37097+
KnownBits RHSLo = DAG.computeKnownBits(RHS, DemandedLoElts, Depth + 1);
37098+
KnownBits RHSHi = DAG.computeKnownBits(RHS, DemandedHiElts, Depth + 1);
37099+
KnownBits Lo = KnownBits::mul(LHSLo.sext(32), RHSLo.sext(32));
37100+
KnownBits Hi = KnownBits::mul(LHSHi.sext(32), RHSHi.sext(32));
3710537101
Known = KnownBits::computeForAddSub(/*Add=*/true, /*NSW=*/true,
3710637102
/*NUW=*/false, Lo, Hi);
3710737103
}
@@ -37113,23 +37109,19 @@ static void computeKnownBitsForPMADDUBSW(SDValue LHS, SDValue RHS,
3711337109
unsigned Depth) {
3711437110
unsigned NumSrcElts = LHS.getValueType().getVectorNumElements();
3711537111

37116-
// Multiply signed/unsigned i8 elements to create i16 values and add_sat Lo/Hi
37112+
// Multiply unsigned/signed i8 elements to create i16 values and add_sat Lo/Hi
3711737113
// pairs.
3711837114
APInt DemandedSrcElts = APIntOps::ScaleBitMask(DemandedElts, NumSrcElts);
3711937115
APInt DemandedLoElts =
3712037116
DemandedSrcElts & APInt::getSplat(NumSrcElts, APInt(2, 0b01));
3712137117
APInt DemandedHiElts =
3712237118
DemandedSrcElts & APInt::getSplat(NumSrcElts, APInt(2, 0b10));
37123-
KnownBits LHSLo =
37124-
DAG.computeKnownBits(LHS, DemandedLoElts, Depth + 1).zext(16);
37125-
KnownBits LHSHi =
37126-
DAG.computeKnownBits(LHS, DemandedHiElts, Depth + 1).zext(16);
37127-
KnownBits RHSLo =
37128-
DAG.computeKnownBits(RHS, DemandedLoElts, Depth + 1).sext(16);
37129-
KnownBits RHSHi =
37130-
DAG.computeKnownBits(RHS, DemandedHiElts, Depth + 1).sext(16);
37131-
KnownBits Lo = KnownBits::mul(LHSLo, RHSLo);
37132-
KnownBits Hi = KnownBits::mul(LHSHi, RHSHi);
37119+
KnownBits LHSLo = DAG.computeKnownBits(LHS, DemandedLoElts, Depth + 1);
37120+
KnownBits LHSHi = DAG.computeKnownBits(LHS, DemandedHiElts, Depth + 1);
37121+
KnownBits RHSLo = DAG.computeKnownBits(RHS, DemandedLoElts, Depth + 1);
37122+
KnownBits RHSHi = DAG.computeKnownBits(RHS, DemandedHiElts, Depth + 1);
37123+
KnownBits Lo = KnownBits::mul(LHSLo.zext(16), RHSLo.sext(16));
37124+
KnownBits Hi = KnownBits::mul(LHSHi.zext(16), RHSHi.sext(16));
3713337125
Known = KnownBits::sadd_sat(Lo, Hi);
3713437126
}
3713537127

0 commit comments

Comments
 (0)