33! RUN: split-file %s %t
44
55! RUN: %flang_fc1 -emit-hlfir -fopenmp -fdo-concurrent-to-openmp=host %t/multi_range.f90 -o - \
6- ! RUN: | FileCheck %s
6+ ! RUN: | FileCheck %s --check-prefixes=HOST,COMMON
7+
8+ ! RUN: %flang_fc1 -emit-hlfir -fopenmp -fdo-concurrent-to-openmp=device %t/multi_range.f90 -o - \
9+ ! RUN: | FileCheck %s --check-prefixes=DEVICE,COMMON
710
811!- -- multi_range.f90
912program main
@@ -17,56 +20,75 @@ program main
1720 end do
1821end
1922
20- ! CHECK: func.func @_QQmain
23+ ! COMMON: func.func @_QQmain
24+
25+ ! COMMON: %[[C3:.*]] = arith.constant 3 : i32
26+ ! COMMON: %[[LB_I:.*]] = fir.convert %[[C3]] : (i32) -> index
27+ ! COMMON: %[[C20:.*]] = arith.constant 20 : i32
28+ ! COMMON: %[[UB_I:.*]] = fir.convert %[[C20]] : (i32) -> index
29+ ! COMMON: %[[STEP_I:.*]] = arith.constant 1 : index
30+
31+ ! COMMON: %[[C5:.*]] = arith.constant 5 : i32
32+ ! COMMON: %[[LB_J:.*]] = fir.convert %[[C5]] : (i32) -> index
33+ ! COMMON: %[[C40:.*]] = arith.constant 40 : i32
34+ ! COMMON: %[[UB_J:.*]] = fir.convert %[[C40]] : (i32) -> index
35+ ! COMMON: %[[STEP_J:.*]] = arith.constant 1 : index
36+
37+ ! COMMON: %[[C7:.*]] = arith.constant 7 : i32
38+ ! COMMON: %[[LB_K:.*]] = fir.convert %[[C7]] : (i32) -> index
39+ ! COMMON: %[[C60:.*]] = arith.constant 60 : i32
40+ ! COMMON: %[[UB_K:.*]] = fir.convert %[[C60]] : (i32) -> index
41+ ! COMMON: %[[STEP_K:.*]] = arith.constant 1 : index
42+
43+ ! DEVICE: omp.target host_eval(
44+ ! DEVICE-SAME: %[[LB_I]] -> %[[LB_I:[[:alnum:]]+]],
45+ ! DEVICE-SAME: %[[UB_I]] -> %[[UB_I:[[:alnum:]]+]],
46+ ! DEVICE-SAME: %[[STEP_I]] -> %[[STEP_I:[[:alnum:]]+]],
47+ ! DEVICE-SAME: %[[LB_J]] -> %[[LB_J:[[:alnum:]]+]],
48+ ! DEVICE-SAME: %[[UB_J]] -> %[[UB_J:[[:alnum:]]+]],
49+ ! DEVICE-SAME: %[[STEP_J]] -> %[[STEP_J:[[:alnum:]]+]],
50+ ! DEVICE-SAME: %[[LB_K]] -> %[[LB_K:[[:alnum:]]+]],
51+ ! DEVICE-SAME: %[[UB_K]] -> %[[UB_K:[[:alnum:]]+]],
52+ ! DEVICE-SAME: %[[STEP_K]] -> %[[STEP_K:[[:alnum:]]+]] :
53+ ! DEVICE-SAME: index, index, index, index, index, index, index, index, index)
2154
22- ! CHECK: %[[C3:.*]] = arith.constant 3 : i32
23- ! CHECK: %[[LB_I:.*]] = fir.convert %[[C3]] : (i32) -> index
24- ! CHECK: %[[C20:.*]] = arith.constant 20 : i32
25- ! CHECK: %[[UB_I:.*]] = fir.convert %[[C20]] : (i32) -> index
26- ! CHECK: %[[STEP_I:.*]] = arith.constant 1 : index
55+ ! DEVICE: omp.teams
2756
28- ! CHECK: %[[C5:.*]] = arith.constant 5 : i32
29- ! CHECK: %[[LB_J:.*]] = fir.convert %[[C5]] : (i32) -> index
30- ! CHECK: %[[C40:.*]] = arith.constant 40 : i32
31- ! CHECK: %[[UB_J:.*]] = fir.convert %[[C40]] : (i32) -> index
32- ! CHECK: %[[STEP_J:.*]] = arith.constant 1 : index
57+ ! HOST-NOT: omp.target
58+ ! HOST-NOT: omp.teams
3359
34- ! CHECK: %[[C7:.*]] = arith.constant 7 : i32
35- ! CHECK: %[[LB_K:.*]] = fir.convert %[[C7]] : (i32) -> index
36- ! CHECK: %[[C60:.*]] = arith.constant 60 : i32
37- ! CHECK: %[[UB_K:.*]] = fir.convert %[[C60]] : (i32) -> index
38- ! CHECK: %[[STEP_K:.*]] = arith.constant 1 : index
60+ ! COMMON: omp.parallel {
3961
40- ! CHECK: omp.parallel {
62+ ! COMMON-NEXT: %[[ITER_VAR_I:.*]] = fir.alloca i32 {bindc_name = "i"}
63+ ! COMMON-NEXT: %[[BINDING_I:.*]]:2 = hlfir.declare %[[ITER_VAR_I]] {uniq_name = "_QFEi"}
4164
42- ! CHECK -NEXT: %[[ITER_VAR_I :.*]] = fir.alloca i32 {bindc_name = "i "}
43- ! CHECK -NEXT: %[[BINDING_I :.*]]:2 = hlfir.declare %[[ITER_VAR_I ]] {uniq_name = "_QFEi "}
65+ ! COMMON -NEXT: %[[ITER_VAR_J :.*]] = fir.alloca i32 {bindc_name = "j "}
66+ ! COMMON -NEXT: %[[BINDING_J :.*]]:2 = hlfir.declare %[[ITER_VAR_J ]] {uniq_name = "_QFEj "}
4467
45- ! CHECK -NEXT: %[[ITER_VAR_J :.*]] = fir.alloca i32 {bindc_name = "j "}
46- ! CHECK -NEXT: %[[BINDING_J :.*]]:2 = hlfir.declare %[[ITER_VAR_J ]] {uniq_name = "_QFEj "}
68+ ! COMMON -NEXT: %[[ITER_VAR_K :.*]] = fir.alloca i32 {bindc_name = "k "}
69+ ! COMMON -NEXT: %[[BINDING_K :.*]]:2 = hlfir.declare %[[ITER_VAR_K ]] {uniq_name = "_QFEk "}
4770
48- ! CHECK-NEXT: %[[ITER_VAR_K:.*]] = fir.alloca i32 {bindc_name = "k"}
49- ! CHECK-NEXT: %[[BINDING_K:.*]]:2 = hlfir.declare %[[ITER_VAR_K]] {uniq_name = "_QFEk"}
71+ ! DEVICE: omp.distribute
5072
51- ! CHECK : omp.wsloop {
52- ! CHECK -NEXT: omp.loop_nest
53- ! CHECK -SAME: (%[[ARG0:[^[:space:]]+]], %[[ARG1:[^[:space:]]+]], %[[ARG2:[^[:space:]]+]])
54- ! CHECK -SAME: : index = (%[[LB_I]], %[[LB_J]], %[[LB_K]])
55- ! CHECK -SAME: to (%[[UB_I]], %[[UB_J]], %[[UB_K]]) inclusive
56- ! CHECK -SAME: step (%[[STEP_I]], %[[STEP_J]], %[[STEP_K]]) {
73+ ! COMMON : omp.wsloop {
74+ ! COMMON -NEXT: omp.loop_nest
75+ ! COMMON -SAME: (%[[ARG0:[^[:space:]]+]], %[[ARG1:[^[:space:]]+]], %[[ARG2:[^[:space:]]+]])
76+ ! COMMON -SAME: : index = (%[[LB_I]], %[[LB_J]], %[[LB_K]])
77+ ! COMMON -SAME: to (%[[UB_I]], %[[UB_J]], %[[UB_K]]) inclusive
78+ ! COMMON -SAME: step (%[[STEP_I]], %[[STEP_J]], %[[STEP_K]]) {
5779
58- ! CHECK -NEXT: %[[IV_IDX_I:.*]] = fir.convert %[[ARG0]]
59- ! CHECK -NEXT: fir.store %[[IV_IDX_I]] to %[[BINDING_I]]#0
80+ ! COMMON -NEXT: %[[IV_IDX_I:.*]] = fir.convert %[[ARG0]]
81+ ! COMMON -NEXT: fir.store %[[IV_IDX_I]] to %[[BINDING_I]]#0
6082
61- ! CHECK -NEXT: %[[IV_IDX_J:.*]] = fir.convert %[[ARG1]]
62- ! CHECK -NEXT: fir.store %[[IV_IDX_J]] to %[[BINDING_J]]#0
83+ ! COMMON -NEXT: %[[IV_IDX_J:.*]] = fir.convert %[[ARG1]]
84+ ! COMMON -NEXT: fir.store %[[IV_IDX_J]] to %[[BINDING_J]]#0
6385
64- ! CHECK -NEXT: %[[IV_IDX_K:.*]] = fir.convert %[[ARG2]]
65- ! CHECK -NEXT: fir.store %[[IV_IDX_K]] to %[[BINDING_K]]#0
86+ ! COMMON -NEXT: %[[IV_IDX_K:.*]] = fir.convert %[[ARG2]]
87+ ! COMMON -NEXT: fir.store %[[IV_IDX_K]] to %[[BINDING_K]]#0
6688
67- ! CHECK : omp.yield
68- ! CHECK -NEXT: }
69- ! CHECK -NEXT: }
89+ ! COMMON : omp.yield
90+ ! COMMON -NEXT: }
91+ ! COMMON -NEXT: }
7092
71- ! CHECK -NEXT: omp.terminator
72- ! CHECK -NEXT: }
93+ ! HOST -NEXT: omp.terminator
94+ ! HOST -NEXT: }
0 commit comments