Files
TheRock/compiler/amd-llvm/flang/test/Integration/ivdep.f90
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

131 lines
6.5 KiB
Fortran

! RUN: %flang_fc1 -emit-llvm -o - %s | FileCheck %s
! CHECK-LABEL: ivdep_test1
subroutine ivdep_test1
integer :: a(10)
!dir$ ivdep
! CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}
do i=1,10
a(i)=i
!CHECK: store i32 {{.*}}, ptr {{.*}}, align 4, !llvm.access.group [[DISTRINCT:.*]]
!CHECK: %[[VAL_8:.*]] = load i32, ptr {{.*}}, align 4, !llvm.access.group [[DISTRINCT]]
!CHECK: %[[VAL_9:.*]] = sext i32 %[[VAL_8]] to i64
!CHECK: %[[VAL_10:.*]] = sub nuw nsw i64 %[[VAL_9]], 1
!CHECK: %[[VAL_11:.*]] = mul nuw nsw i64 %[[VAL_10]], 1
!CHECK: %[[VAL_12:.*]] = mul nuw nsw i64 %[[VAL_11]], 1
!CHECK: %[[VAL_13:.*]] = add nuw nsw i64 %[[VAL_12]], 0
!CHECK: %[[VAL_14:.*]] = getelementptr nusw nuw i32, ptr {{.*}}, i64 %[[VAL_13]]
!CHECK: store i32 %[[VAL_8]], ptr %[[VAL_14]], align 4, !llvm.access.group [[DISTRINCT]]
!CHECK: %[[VAL_15:.*]] = load i32, ptr {{.*}}, align 4, !llvm.access.group [[DISTRINCT]]
!CHECK: %[[VAL_16:.*]] = add nsw i32 %[[VAL_15]], 1
!CHECK: %[[VAL_17:.*]] = sub i64 {{.*}}, 1
!CHECK: br label {{.*}}, !llvm.loop ![[ANNOTATION:.*]]
end do
end subroutine ivdep_test1
! CHECK-LABEL: ivdep_test2
subroutine ivdep_test2
integer :: a(10), b(10), c(10)
!dir$ ivdep
!dir$ unknown
! CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}
do i=1,10
a(i)=b(i)+c(i)
!CHECK: store i32 {{.*}}, ptr {{.*}}, align 4, !llvm.access.group [[DISTRINCT1:.*]]
!CHECK: %[[VAL_10:.*]] = load i32, ptr {{.*}}, align 4, !llvm.access.group [[DISTRINCT1]]
!CHECK: %[[VAL_11:.*]] = sext i32 %[[VAL_10]] to i64
!CHECK: %[[VAL_12:.*]] = sub nuw nsw i64 %[[VAL_11]], 1
!CHECK: %[[VAL_13:.*]] = mul nuw nsw i64 %[[VAL_12]], 1
!CHECK: %[[VAL_14:.*]] = mul nuw nsw i64 %[[VAL_13]], 1
!CHECK: %[[VAL_15:.*]] = add nuw nsw i64 %[[VAL_14]], 0
!CHECK: %[[VAL_16:.*]] = getelementptr nusw nuw i32, ptr {{.*}}, i64 %[[VAL_15]]
!CHECK: %[[VAL_17:.*]] = load i32, ptr {{.*}}, align 4, !llvm.access.group [[DISTRINCT1]]
!CHECK: %[[VAL_18:.*]] = sub nuw nsw i64 %[[VAL_11]], 1
!CHECK: %[[VAL_19:.*]] = mul nuw nsw i64 %[[VAL_18]], 1
!CHECK: %[[VAL_20:.*]] = mul nuw nsw i64 %[[VAL_19]], 1
!CHECK: %[[VAL_21:.*]] = add nuw nsw i64 %[[VAL_20]], 0
!CHECK: %[[VAL_22:.*]] = getelementptr nusw nuw i32, ptr {{.*}}, i64 %[[VAL_21]]
!CHECK: %[[VAL_23:.*]] = load i32, ptr {{.*}}, align 4, !llvm.access.group [[DISTRINCT1]]
!CHECK: %[[VAL_24:.*]] = add i32 %[[VAL_17]], %[[VAL_23]]
!CHECK: %[[VAL_25:.*]] = sub nuw nsw i64 %[[VAL_11]], 1
!CHECK: %[[VAL_26:.*]] = mul nuw nsw i64 %[[VAL_25]], 1
!CHECK: %[[VAL_27:.*]] = mul nuw nsw i64 %[[VAL_26]], 1
!CHECK: %[[VAL_28:.*]] = add nuw nsw i64 %[[VAL_27]], 0
!CHECK: %[[VAL_29:.*]] = getelementptr nusw nuw i32, ptr {{.*}}, i64 %[[VAL_28]]
!CHECK: store i32 %[[VAL_24]], ptr %[[VAL_29]], align 4, !llvm.access.group [[DISTRINCT1]]
!CHECK: %[[VAL_30:.*]] = load i32, ptr {{.*}}, align 4, !llvm.access.group [[DISTRINCT1]]
!CHECK: %[[VAL_31:.*]] = add nsw i32 %[[VAL_30]], 1
!CHECK: %[[VAL_32:.*]] = sub i64 {{.*}}, 1
!CHECK: br label {{.*}}, !llvm.loop ![[ANNOTATION1:.*]]
end do
end subroutine ivdep_test2
! CHECK-LABEL: ivdep_test3
subroutine ivdep_test3
integer :: a(10), b(10), c(10)
!dir$ ivdep
! CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}
do i=1,10
a(i)=b(i)+c(i)
call foo()
!CHECK: store i32 {{.*}}, ptr {{.*}}, align 4, !llvm.access.group [[DISTRINCT2:.*]]
!CHECK: %[[VAL_10:.*]] = load i32, ptr {{.*}}, align 4, !llvm.access.group [[DISTRINCT2]]
!CHECK: %[[VAL_11:.*]] = sext i32 %[[VAL_10]] to i64
!CHECK: %[[VAL_12:.*]] = sub nuw nsw i64 %[[VAL_11]], 1
!CHECK: %[[VAL_13:.*]] = mul nuw nsw i64 %[[VAL_12]], 1
!CHECK: %[[VAL_14:.*]] = mul nuw nsw i64 %[[VAL_13]], 1
!CHECK: %[[VAL_15:.*]] = add nuw nsw i64 %[[VAL_14]], 0
!CHECK: %[[VAL_16:.*]] = getelementptr nusw nuw i32, ptr {{.*}}, i64 %[[VAL_15]]
!CHECK: %[[VAL_17:.*]] = load i32, ptr {{.*}}, align 4, !llvm.access.group [[DISTRINCT2]]
!CHECK: %[[VAL_18:.*]] = sub nuw nsw i64 %[[VAL_11]], 1
!CHECK: %[[VAL_19:.*]] = mul nuw nsw i64 %[[VAL_18]], 1
!CHECK: %[[VAL_20:.*]] = mul nuw nsw i64 %[[VAL_19]], 1
!CHECK: %[[VAL_21:.*]] = add nuw nsw i64 %[[VAL_20]], 0
!CHECK: %[[VAL_22:.*]] = getelementptr nusw nuw i32, ptr {{.*}}, i64 %[[VAL_21]]
!CHECK: %[[VAL_23:.*]] = load i32, ptr {{.*}}, align 4, !llvm.access.group [[DISTRINCT2]]
!CHECK: %[[VAL_24:.*]] = add i32 %[[VAL_17]], %[[VAL_23]]
!CHECK: %[[VAL_25:.*]] = sub nuw nsw i64 %[[VAL_11]], 1
!CHECK: %[[VAL_26:.*]] = mul nuw nsw i64 %[[VAL_25]], 1
!CHECK: %[[VAL_27:.*]] = mul nuw nsw i64 %[[VAL_26]], 1
!CHECK: %[[VAL_28:.*]] = add nuw nsw i64 %[[VAL_27]], 0
!CHECK: %[[VAL_29:.*]] = getelementptr nusw nuw i32, ptr {{.*}}, i64 %[[VAL_28]]
!CHECK: store i32 %[[VAL_24]], ptr %[[VAL_29]], align 4, !llvm.access.group [[DISTRINCT2]]
!CHECK: call void @_QFivdep_test3Pfoo(), !llvm.access.group [[DISTRINCT2]]
!CHECK: %[[VAL_30:.*]] = load i32, ptr {{.*}}, align 4, !llvm.access.group [[DISTRINCT2]]
!CHECK: %[[VAL_31:.*]] = add nsw i32 %[[VAL_30]], 1
!CHECK: %[[VAL_32:.*]] = sub i64 {{.*}}, 1
!CHECK: br label {{.*}}, !llvm.loop ![[ANNOTATION2:.*]]
end do
contains
subroutine foo()
end subroutine
end subroutine ivdep_test3
! CHECK-LABEL: ivdep_test4
subroutine ivdep_test4
integer :: a(10)
!dir$ ivdep
!dir$ vector always
! CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}
do i=1,10
a(i)=i
!CHECK: br label {{.*}}, !llvm.loop ![[ANNOTATION3:.*]]
end do
end subroutine ivdep_test4
! CHECK: [[DISTRINCT]] = distinct !{}
! CHECK: ![[ANNOTATION]] = distinct !{![[ANNOTATION]], ![[PARALLEL_ACCESSES:.*]]}
! CHECK: ![[PARALLEL_ACCESSES]] = !{!"llvm.loop.parallel_accesses", [[DISTRINCT]]}
! CHECK: [[DISTRINCT1]] = distinct !{}
! CHECK: ![[ANNOTATION1]] = distinct !{![[ANNOTATION1]], ![[PARALLEL_ACCESSES1:.*]]}
! CHECK: ![[PARALLEL_ACCESSES1]] = !{!"llvm.loop.parallel_accesses", [[DISTRINCT1]]}
! CHECK: [[DISTRINCT2]] = distinct !{}
! CHECK: ![[ANNOTATION2]] = distinct !{![[ANNOTATION2]], ![[PARALLEL_ACCESSES2:.*]]}
! CHECK: ![[PARALLEL_ACCESSES2]] = !{!"llvm.loop.parallel_accesses", [[DISTRINCT2]]}
! CHECK: [[DISTRINCT3:.*]] = distinct !{}
! CHECK: ![[ANNOTATION3]] = distinct !{![[ANNOTATION3]], ![[VECTORIZE:.*]], ![[PARALLEL_ACCESSES3:.*]]}
! CHECK: ![[VECTORIZE]] = !{!"llvm.loop.vectorize.enable", i1 true}
! CHECK: ![[PARALLEL_ACCESSES3]] = !{!"llvm.loop.parallel_accesses", [[DISTRINCT3]]}