summaryrefslogtreecommitdiff
path: root/flang/test/Transforms/DoConcurrent/host_eval.f90
blob: 4eacdd64c6e5fff4fe12f889f878add2d7e6566f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
! REQUIRES: amdgpu-registered-target

! Tests `host_eval` clause code-gen and loop nest bounds on host vs. device.

! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa   \
! RUN:   -fdo-concurrent-to-openmp=device %s -o -                           \
! RUN: | FileCheck %s --check-prefix=HOST -vv

! RUN: %flang_fc1 -triple amdgcn-amd-amdhsa -emit-hlfir -fopenmp            \
! RUN:   -fopenmp-is-target-device -fdo-concurrent-to-openmp=device %s -o - \
! RUN: | FileCheck %s --check-prefix=DEVICE

program do_concurrent_host_eval
    implicit none
    integer :: i, j

    do concurrent (i=1:10, j=1:20)
    end do
end program do_concurrent_host_eval

! HOST: omp.target host_eval(
! HOST-SAME:    %{{[^[:space:]]+}} -> %[[I_LB:[^,]+]],
! HOST-SAME:    %{{[^[:space:]]+}} -> %[[I_UB:[^,]+]],
! HOST-SAME:    %{{[^[:space:]]+}} -> %[[I_ST:[^,]+]],
! HOST-SAME:    %{{[^[:space:]]+}} -> %[[J_LB:[^,]+]],
! HOST-SAME:    %{{[^[:space:]]+}} -> %[[J_UB:[^,]+]],
! HOST-SAME:    %{{[^[:space:]]+}} -> %[[J_ST:[^,]+]] : {{.*}}) map_entries

! HOST: omp.loop_nest ({{.*}}, {{.*}}) : index = (%[[I_LB]], %[[J_LB]]) to
! HOST-SAME:    (%[[I_UB]], %[[J_UB]]) inclusive step
! HOST-SAME:    (%[[I_ST]], %[[J_ST]])

! DEVICE: omp.target map_entries(
! DEVICE-SAME:  %{{[^[:space:]]+}} -> %[[I_LB_MAP:[^,]+]],
! DEVICE-SAME:  %{{[^[:space:]]+}} -> %[[I_UB_MAP:[^,]+]],
! DEVICE-SAME:  %{{[^[:space:]]+}} -> %[[I_ST_MAP:[^,]+]],

! DEVICE-SAME:  %{{[^[:space:]]+}} -> %[[J_LB_MAP:[^,]+]],
! DEVICE-SAME:  %{{[^[:space:]]+}} -> %[[J_UB_MAP:[^,]+]],
! DEVICE-SAME:  %{{[^[:space:]]+}} -> %[[J_ST_MAP:[^,]+]],

! DEVICE-SAME:  %{{[^[:space:]]+}} -> %{{[^,]+}},
! DEVICE-SAME:  %{{[^[:space:]]+}} -> %{{[^,]+}} : {{.*}})

! DEVICE: %[[I_LB_DECL:.*]]:2 = hlfir.declare %[[I_LB_MAP]]
! DEVICE: %[[I_LB:.*]] = fir.load %[[I_LB_DECL]]#1 : !fir.ref<index>

! DEVICE: %[[I_UB_DECL:.*]]:2 = hlfir.declare %[[I_UB_MAP]]
! DEVICE: %[[I_UB:.*]] = fir.load %[[I_UB_DECL]]#1 : !fir.ref<index>

! DEVICE: %[[I_ST_DECL:.*]]:2 = hlfir.declare %[[I_ST_MAP]]
! DEVICE: %[[I_ST:.*]] = fir.load %[[I_ST_DECL]]#1 : !fir.ref<index>

! DEVICE: %[[J_LB_DECL:.*]]:2 = hlfir.declare %[[J_LB_MAP]]
! DEVICE: %[[J_LB:.*]] = fir.load %[[J_LB_DECL]]#1 : !fir.ref<index>

! DEVICE: %[[J_UB_DECL:.*]]:2 = hlfir.declare %[[J_UB_MAP]]
! DEVICE: %[[J_UB:.*]] = fir.load %[[J_UB_DECL]]#1 : !fir.ref<index>

! DEVICE: %[[J_ST_DECL:.*]]:2 = hlfir.declare %[[J_ST_MAP]]
! DEVICE: %[[J_ST:.*]] = fir.load %[[J_ST_DECL]]#1 : !fir.ref<index>

! DEVICE: omp.loop_nest ({{.*}}, {{.*}}) : index = (%[[I_LB]], %[[J_LB]]) to
! DEVICE-SAME:    (%[[I_UB]], %[[J_UB]]) inclusive step
! DEVICE-SAME:    (%[[I_ST]], %[[J_ST]])