This patch adds a new option to the LoopVectorizer to control how
scalable vectors can be used.
Initially, this suggests three levels to control scalable
vectorization, although other more aggressive options can be added in
the future.
The possible options are:
- Disabled: Disables vectorization with scalable vectors.
- Enabled: Vectorize loops using scalable vectors or fixed-width
vectors, but favors fixed-width vectors when the cost
is a tie.
- Preferred: Like 'Enabled', but favoring scalable vectors when the
cost-model is inconclusive.
Reviewed By: paulwalker-arm, vkmr
Differential Revision: https://reviews.llvm.org/D101945
28 lines
965 B
LLVM
28 lines
965 B
LLVM
; REQUIRES: asserts
|
|
; RUN: opt < %s -passes='loop-vectorize' -force-vector-width=2 -force-target-supports-scalable-vectors=true -enable-epilogue-vectorization -epilogue-vectorization-force-VF=2 --debug-only=loop-vectorize -S -scalable-vectorization=on 2>&1 | FileCheck %s
|
|
|
|
target datalayout = "e-m:e-i64:64-n32:64-v256:256:256-v512:512:512"
|
|
|
|
; Currently we cannot handle scalable vectorization factors.
|
|
; CHECK: LV: Checking a loop in "f1"
|
|
; CHECK: LEV: Epilogue vectorization for scalable vectors not yet supported.
|
|
|
|
define void @f1(i8* %A) {
|
|
entry:
|
|
br label %for.body
|
|
|
|
for.body:
|
|
%iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
|
|
%arrayidx = getelementptr inbounds i8, i8* %A, i64 %iv
|
|
store i8 1, i8* %arrayidx, align 1
|
|
%iv.next = add nuw nsw i64 %iv, 1
|
|
%exitcond = icmp ne i64 %iv.next, 1024
|
|
br i1 %exitcond, label %for.body, label %exit, !llvm.loop !0
|
|
|
|
exit:
|
|
ret void
|
|
}
|
|
|
|
!0 = !{!0, !1}
|
|
!1 = !{!"llvm.loop.vectorize.scalable.enable", i1 true}
|