Skip to content

Commit

Permalink
[SLP][REVEC] Make Instruction::Call support vector instructions. (llv…
Browse files Browse the repository at this point in the history
  • Loading branch information
HanKuanChen authored and sgundapa committed Jul 23, 2024
1 parent de36426 commit ebe7b9c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13499,7 +13499,7 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E, bool PostponedPHIs) {
}
ScalarArg = CEI->getArgOperand(I);
if (cast<VectorType>(OpVec->getType())->getElementType() !=
ScalarArg->getType() &&
ScalarArg->getType()->getScalarType() &&
It == MinBWs.end()) {
auto *CastTy =
getWidenedType(ScalarArg->getType(), VecTy->getNumElements());
Expand Down
20 changes: 20 additions & 0 deletions llvm/test/Transforms/SLPVectorizer/revec.ll
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,23 @@ entry:
store <4 x i32> %add.i65, ptr %arrayidx42, align 4
ret void
}

define void @test2(ptr %in, ptr %out) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = load <16 x i16>, ptr [[IN:%.*]], align 2
; CHECK-NEXT: [[TMP1:%.*]] = call <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16> [[TMP0]], <16 x i16> [[TMP0]])
; CHECK-NEXT: store <16 x i16> [[TMP1]], ptr [[OUT:%.*]], align 2
; CHECK-NEXT: ret void
;
entry:
%0 = getelementptr i16, ptr %in, i64 8
%1 = load <8 x i16>, ptr %in, align 2
%2 = load <8 x i16>, ptr %0, align 2
%3 = call <8 x i16> @llvm.sadd.sat.v8i16(<8 x i16> %1, <8 x i16> %1)
%4 = call <8 x i16> @llvm.sadd.sat.v8i16(<8 x i16> %2, <8 x i16> %2)
%5 = getelementptr i16, ptr %out, i64 8
store <8 x i16> %3, ptr %out, align 2
store <8 x i16> %4, ptr %5, align 2
ret void
}

0 comments on commit ebe7b9c

Please sign in to comment.