This patch implements support for the VECTOR ALWAYS directive, which forces vectorization to occurr when possible regardless of a decision by the cost model. This is done by adding an attribute to the branch into the loop in LLVM to indicate that the loop should always be vectorized. This patch only implements this directive on plan structured do loops without labels. Support for unstructured loops and array expressions is planned for future patches.
15 lines
438 B
Fortran
15 lines
438 B
Fortran
! RUN: %flang_fc1 -emit-llvm -o - %s | FileCheck %s
|
|
|
|
! CHECK-LABEL: vector_always
|
|
subroutine vector_always
|
|
integer :: a(10)
|
|
!dir$ vector always
|
|
! CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}, !llvm.loop ![[ANNOTATION:.*]]
|
|
do i=1,10
|
|
a(i)=i
|
|
end do
|
|
end subroutine vector_always
|
|
|
|
! CHECK: ![[ANNOTATION]] = distinct !{![[ANNOTATION]], ![[VECTORIZE:.*]]}
|
|
! CHECK: ![[VECTORIZE]] = !{!"llvm.loop.vectorize.enable", i1 true}
|