diff --git a/flang/test/Lower/OpenMP/simd.f90 b/flang/test/Lower/OpenMP/simd.f90 --- a/flang/test/Lower/OpenMP/simd.f90 +++ b/flang/test/Lower/OpenMP/simd.f90 @@ -89,3 +89,28 @@ end do !$OMP END SIMD end subroutine + +!CHECK-LABEL: func @_QPsimdloop_with_collapse_clause +subroutine simdloop_with_collapse_clause(n) +integer :: i, j, n +integer :: A(n,n) +! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {adapt.valuebyref} +! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {adapt.valuebyref} +! CHECK: %[[LOWER_I:.*]] = arith.constant 1 : i32 +! CHECK: %[[UPPER_I:.*]] = fir.load %[[PARAM_ARG:.*]] : !fir.ref +! CHECK: %[[STEP_I:.*]] = arith.constant 1 : i32 +! CHECK: %[[LOWER_J:.*]] = arith.constant 1 : i32 +! CHECK: %[[UPPER_J:.*]] = fir.load %[[PARAM_ARG:.*]] : !fir.ref +! CHECK: %[[STEP_J:.*]] = arith.constant 1 : i32 +! CHECK: omp.simdloop for (%[[ARG_0:.*]], %[[ARG_1:.*]]) : i32 = ( +! CHECK: %[[LOWER_I]], %[[LOWER_J]]) to ( +! CHECK: %[[UPPER_I]], %[[UPPER_J]]) inclusive step ( +! CHECK: %[[STEP_I]], %[[STEP_J]]) { + !$OMP SIMD COLLAPSE(2) + do i = 1, n + do j = 1, n + A(i,j) = i + j + end do + end do + !$OMP END SIMD +end subroutine