/// isSplatValue - Return true if the vector V has the same value
/// across all DemandedElts. For scalable vectors it does not make
-/// sense to specify which elements are demanded or undefined, therefore
-/// they are simply ignored.
+/// sense to specify which elements are demanded, therefore they are
+/// simply ignored. For undef elts this means either all lanes are
+/// undef, or no lanes are known undef.
bool SelectionDAG::isSplatValue(SDValue V, const APInt &DemandedElts,
APInt &UndefElts, unsigned Depth) const {
unsigned Opcode = V.getOpcode();
EVT VT = V.getValueType();
assert(VT.isVector() && "Vector type expected");
+ assert((!VT.isScalableVector() || DemandedElts.getBitWidth() == 1) &&
+ "scalable demanded bits are ignored");
if (!VT.isScalableVector() && !DemandedElts)
return false; // No demanded elts, better to assume we don't know anything.
APInt UndefElts;
APInt DemandedElts;
EXPECT_TRUE(DAG->isSplatValue(Op, DemandedElts, UndefElts));
-
- // Width=16, Mask=3. These bits should be ignored.
- DemandedElts = APInt(16, 3);
- EXPECT_TRUE(DAG->isSplatValue(Op, DemandedElts, UndefElts));
}
TEST_F(AArch64SelectionDAGTest, isSplatValue_Scalable_ADD_of_SPLAT_VECTOR) {
APInt UndefElts;
APInt DemandedElts;
EXPECT_TRUE(DAG->isSplatValue(Op, DemandedElts, UndefElts));
-
- // Width=16, Mask=3. These bits should be ignored.
- DemandedElts = APInt(16, 3);
- EXPECT_TRUE(DAG->isSplatValue(Op, DemandedElts, UndefElts));
}
TEST_F(AArch64SelectionDAGTest, getSplatSourceVector_Fixed_BUILD_VECTOR) {