Skip to content

Commit 60195c1

Browse files
committed
Merge handling of v4i8 and v2i16 in tryLDULDG
1 parent edc9c7f commit 60195c1

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,17 +1230,16 @@ bool NVPTXDAGToDAGISel::tryLDGLDU(SDNode *N) {
12301230
if (EltVT.isVector()) {
12311231
NumElts = EltVT.getVectorNumElements();
12321232
EltVT = EltVT.getVectorElementType();
1233-
// vectors of 16bits type are loaded/stored as multiples of v2x16 elements.
1233+
// vectors of 8/16bits type are loaded/stored as multiples of v4i8/v2x16
1234+
// elements.
12341235
if ((EltVT == MVT::f16 && OrigType == MVT::v2f16) ||
12351236
(EltVT == MVT::bf16 && OrigType == MVT::v2bf16) ||
1236-
(EltVT == MVT::i16 && OrigType == MVT::v2i16)) {
1237-
assert(NumElts % 2 == 0 && "Vector must have even number of elements");
1237+
(EltVT == MVT::i16 && OrigType == MVT::v2i16) ||
1238+
(EltVT == MVT::i8 && OrigType == MVT::v4i8)) {
1239+
assert(NumElts % OrigType.getVectorNumElements() == 0 &&
1240+
"NumElts must be divisible by the number of elts in subvectors");
12381241
EltVT = OrigType;
1239-
NumElts /= 2;
1240-
} else if (OrigType == MVT::v4i8) {
1241-
assert(NumElts % 4 == 0 && "NumElts must be a multuple of 4");
1242-
EltVT = OrigType;
1243-
NumElts /= 4;
1242+
NumElts /= OrigType.getVectorNumElements();
12441243
}
12451244
}
12461245

0 commit comments

Comments
 (0)