[RISCV] Rename a lambda to have plural nouns to reflect that it contains a loop. NFC
[llvm-project.git] / flang / test / Lower / OpenMP / wsloop-simd.f90
blob49a9a523e11fe74461bb7c105c5d427255923bef
1 ! This test checks lowering of OpenMP DO SIMD composite constructs.
3 ! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
4 ! RUN: %flang_fc1 -fopenmp -emit-hlfir %s -o - | FileCheck %s
6 ! CHECK-LABEL: func.func @_QPdo_simd_aligned(
7 subroutine do_simd_aligned(A)
8 use iso_c_binding
9 type(c_ptr) :: A
11 ! CHECK: omp.wsloop
12 ! CHECK-NOT: aligned({{.*}})
13 ! CHECK-SAME: {
14 ! CHECK-NEXT: omp.simd
15 ! CHECK-SAME: aligned({{.*}})
16 !$omp do simd aligned(A:256)
17 do index_ = 1, 10
18 call c_test_call(A)
19 end do
20 !$omp end do simd
21 end subroutine do_simd_aligned
23 ! CHECK-LABEL: func.func @_QPdo_simd_safelen(
24 subroutine do_simd_safelen()
25 ! CHECK: omp.wsloop
26 ! CHECK-NOT: safelen({{.*}})
27 ! CHECK-SAME: {
28 ! CHECK-NEXT: omp.simd
29 ! CHECK-SAME: safelen({{.*}})
30 !$omp do simd safelen(4)
31 do index_ = 1, 10
32 end do
33 !$omp end do simd
34 end subroutine do_simd_safelen
36 ! CHECK-LABEL: func.func @_QPdo_simd_simdlen(
37 subroutine do_simd_simdlen()
38 ! CHECK: omp.wsloop
39 ! CHECK-NOT: simdlen({{.*}})
40 ! CHECK-SAME: {
41 ! CHECK-NEXT: omp.simd
42 ! CHECK-SAME: simdlen({{.*}})
43 !$omp do simd simdlen(4)
44 do index_ = 1, 10
45 end do
46 !$omp end do simd
47 end subroutine do_simd_simdlen
49 ! CHECK-LABEL: func.func @_QPdo_simd_reduction(
50 subroutine do_simd_reduction()
51 integer :: sum
52 sum = 0
53 ! CHECK: omp.wsloop
54 ! CHECK-SAME: reduction(@[[RED_SYM:.*]] %{{.*}} -> %[[RED_OUTER:.*]] : !fir.ref<i32>)
55 ! CHECK-NEXT: omp.simd
56 ! CHECK-SAME: reduction(@[[RED_SYM]] %[[RED_OUTER]] -> %[[RED_INNER:.*]] : !fir.ref<i32>)
57 ! CHECK-NEXT: omp.loop_nest
58 ! CHECK: %[[RED_DECL:.*]]:2 = hlfir.declare %[[RED_INNER]]
59 ! CHECK: %[[RED:.*]] = fir.load %[[RED_DECL]]#0 : !fir.ref<i32>
60 ! CHECK: %[[RESULT:.*]] = arith.addi %[[RED]], %{{.*}} : i32
61 ! CHECK: hlfir.assign %[[RESULT]] to %[[RED_DECL]]#0 : i32, !fir.ref<i32>
62 ! CHECK-NEXT: omp.yield
63 !$omp do simd reduction(+:sum)
64 do index_ = 1, 10
65 sum = sum + 1
66 end do
67 !$omp end do simd
68 end subroutine do_simd_reduction