[llvm] 70218f6 - [X86] Add getConstVector helper variant without undef mask
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sun May 7 10:26:34 PDT 2023
Author: Simon Pilgrim
Date: 2023-05-07T18:26:17+01:00
New Revision: 70218f6f83fe8aab28277e0b4507724b5e999ee4
URL: https://github.com/llvm/llvm-project/commit/70218f6f83fe8aab28277e0b4507724b5e999ee4
DIFF: https://github.com/llvm/llvm-project/commit/70218f6f83fe8aab28277e0b4507724b5e999ee4.diff
LOG: [X86] Add getConstVector helper variant without undef mask
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 19a9b402c930..eda35864675e 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -6468,7 +6468,7 @@ static SDValue getConstVector(ArrayRef<int> Values, MVT VT, SelectionDAG &DAG,
return ConstsNode;
}
-static SDValue getConstVector(ArrayRef<APInt> Bits, APInt &Undefs,
+static SDValue getConstVector(ArrayRef<APInt> Bits, const APInt &Undefs,
MVT VT, SelectionDAG &DAG, const SDLoc &dl) {
assert(Bits.size() == Undefs.getBitWidth() &&
"Unequal constant and undef arrays");
@@ -6509,6 +6509,12 @@ static SDValue getConstVector(ArrayRef<APInt> Bits, APInt &Undefs,
return DAG.getBitcast(VT, ConstsNode);
}
+static SDValue getConstVector(ArrayRef<APInt> Bits, MVT VT,
+ SelectionDAG &DAG, const SDLoc &dl) {
+ APInt Undefs = APInt::getZero(Bits.size());
+ return getConstVector(Bits, Undefs, VT, DAG, dl);
+}
+
/// Returns a vector of specified type with all zero elements.
static SDValue getZeroVector(MVT VT, const X86Subtarget &Subtarget,
SelectionDAG &DAG, const SDLoc &dl) {
@@ -53964,13 +53970,11 @@ static SDValue combineAndnp(SDNode *N, SelectionDAG &DAG,
SmallVector<APInt> EltBits0, EltBits1;
if (getTargetConstantBitsFromNode(N0, EltSizeInBits, Undefs0, EltBits0)) {
SDLoc DL(N);
- APInt ResultUndefs = APInt::getZero(NumElts);
-
if (getTargetConstantBitsFromNode(N1, EltSizeInBits, Undefs1, EltBits1)) {
SmallVector<APInt> ResultBits;
for (int I = 0; I != NumElts; ++I)
ResultBits.push_back(~EltBits0[I] & EltBits1[I]);
- return getConstVector(ResultBits, ResultUndefs, VT, DAG, DL);
+ return getConstVector(ResultBits, VT, DAG, DL);
}
// Constant fold NOT(N0) to allow us to use AND.
@@ -53981,7 +53985,7 @@ static SDValue combineAndnp(SDNode *N, SelectionDAG &DAG,
if (BC0.getOpcode() != ISD::BITCAST) {
for (APInt &Elt : EltBits0)
Elt = ~Elt;
- SDValue Not = getConstVector(EltBits0, ResultUndefs, VT, DAG, DL);
+ SDValue Not = getConstVector(EltBits0, VT, DAG, DL);
return DAG.getNode(ISD::AND, DL, VT, Not, N1);
}
}
More information about the llvm-commits
mailing list