1
+ ! Fails until we update the pass to use the `fir.do_concurrent` op.
2
+
1
3
! Tests mapping of a `do concurrent` loop with multiple iteration ranges.
2
4
3
5
! RUN: split-file %s %t
4
6
5
7
! RUN: %flang_fc1 -emit-hlfir -fopenmp -fdo-concurrent-to-openmp=host %t/multi_range.f90 -o - \
6
- ! RUN: | FileCheck %s
8
+ ! RUN: | FileCheck %s --check-prefixes=HOST,COMMON
9
+
10
+ ! RUN: %flang_fc1 -emit-hlfir -fopenmp -fdo-concurrent-to-openmp=device %t/multi_range.f90 -o - \
11
+ ! RUN: | FileCheck %s --check-prefixes=DEVICE,COMMON
7
12
8
13
!- -- multi_range.f90
9
14
program main
@@ -17,56 +22,75 @@ program main
17
22
end do
18
23
end
19
24
20
- ! CHECK: func.func @_QQmain
25
+ ! COMMON: func.func @_QQmain
26
+
27
+ ! COMMON: %[[C3:.*]] = arith.constant 3 : i32
28
+ ! COMMON: %[[LB_I:.*]] = fir.convert %[[C3]] : (i32) -> index
29
+ ! COMMON: %[[C20:.*]] = arith.constant 20 : i32
30
+ ! COMMON: %[[UB_I:.*]] = fir.convert %[[C20]] : (i32) -> index
31
+ ! COMMON: %[[STEP_I:.*]] = arith.constant 1 : index
32
+
33
+ ! COMMON: %[[C5:.*]] = arith.constant 5 : i32
34
+ ! COMMON: %[[LB_J:.*]] = fir.convert %[[C5]] : (i32) -> index
35
+ ! COMMON: %[[C40:.*]] = arith.constant 40 : i32
36
+ ! COMMON: %[[UB_J:.*]] = fir.convert %[[C40]] : (i32) -> index
37
+ ! COMMON: %[[STEP_J:.*]] = arith.constant 1 : index
38
+
39
+ ! COMMON: %[[C7:.*]] = arith.constant 7 : i32
40
+ ! COMMON: %[[LB_K:.*]] = fir.convert %[[C7]] : (i32) -> index
41
+ ! COMMON: %[[C60:.*]] = arith.constant 60 : i32
42
+ ! COMMON: %[[UB_K:.*]] = fir.convert %[[C60]] : (i32) -> index
43
+ ! COMMON: %[[STEP_K:.*]] = arith.constant 1 : index
44
+
45
+ ! DEVICE: omp.target host_eval(
46
+ ! DEVICE-SAME: %[[LB_I]] -> %[[LB_I:[[:alnum:]]+]],
47
+ ! DEVICE-SAME: %[[UB_I]] -> %[[UB_I:[[:alnum:]]+]],
48
+ ! DEVICE-SAME: %[[STEP_I]] -> %[[STEP_I:[[:alnum:]]+]],
49
+ ! DEVICE-SAME: %[[LB_J]] -> %[[LB_J:[[:alnum:]]+]],
50
+ ! DEVICE-SAME: %[[UB_J]] -> %[[UB_J:[[:alnum:]]+]],
51
+ ! DEVICE-SAME: %[[STEP_J]] -> %[[STEP_J:[[:alnum:]]+]],
52
+ ! DEVICE-SAME: %[[LB_K]] -> %[[LB_K:[[:alnum:]]+]],
53
+ ! DEVICE-SAME: %[[UB_K]] -> %[[UB_K:[[:alnum:]]+]],
54
+ ! DEVICE-SAME: %[[STEP_K]] -> %[[STEP_K:[[:alnum:]]+]] :
55
+ ! DEVICE-SAME: index, index, index, index, index, index, index, index, index)
21
56
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
57
+ ! DEVICE: omp.teams
27
58
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
59
+ ! HOST-NOT: omp.target
60
+ ! HOST-NOT: omp.teams
33
61
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
62
+ ! COMMON: omp.parallel {
39
63
40
- ! CHECK: omp.parallel {
64
+ ! COMMON-NEXT: %[[ITER_VAR_I:.*]] = fir.alloca i32 {bindc_name = "i"}
65
+ ! COMMON-NEXT: %[[BINDING_I:.*]]:2 = hlfir.declare %[[ITER_VAR_I]] {uniq_name = "_QFEi"}
41
66
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 "}
67
+ ! COMMON -NEXT: %[[ITER_VAR_J :.*]] = fir.alloca i32 {bindc_name = "j "}
68
+ ! COMMON -NEXT: %[[BINDING_J :.*]]:2 = hlfir.declare %[[ITER_VAR_J ]] {uniq_name = "_QFEj "}
44
69
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 "}
70
+ ! COMMON -NEXT: %[[ITER_VAR_K :.*]] = fir.alloca i32 {bindc_name = "k "}
71
+ ! COMMON -NEXT: %[[BINDING_K :.*]]:2 = hlfir.declare %[[ITER_VAR_K ]] {uniq_name = "_QFEk "}
47
72
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"}
73
+ ! DEVICE: omp.distribute
50
74
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]]) {
75
+ ! COMMON : omp.wsloop {
76
+ ! COMMON -NEXT: omp.loop_nest
77
+ ! COMMON -SAME: (%[[ARG0:[^[:space:]]+]], %[[ARG1:[^[:space:]]+]], %[[ARG2:[^[:space:]]+]])
78
+ ! COMMON -SAME: : index = (%[[LB_I]], %[[LB_J]], %[[LB_K]])
79
+ ! COMMON -SAME: to (%[[UB_I]], %[[UB_J]], %[[UB_K]]) inclusive
80
+ ! COMMON -SAME: step (%[[STEP_I]], %[[STEP_J]], %[[STEP_K]]) {
57
81
58
- ! CHECK -NEXT: %[[IV_IDX_I:.*]] = fir.convert %[[ARG0]]
59
- ! CHECK -NEXT: fir.store %[[IV_IDX_I]] to %[[BINDING_I]]#0
82
+ ! COMMON -NEXT: %[[IV_IDX_I:.*]] = fir.convert %[[ARG0]]
83
+ ! COMMON -NEXT: fir.store %[[IV_IDX_I]] to %[[BINDING_I]]#0
60
84
61
- ! CHECK -NEXT: %[[IV_IDX_J:.*]] = fir.convert %[[ARG1]]
62
- ! CHECK -NEXT: fir.store %[[IV_IDX_J]] to %[[BINDING_J]]#0
85
+ ! COMMON -NEXT: %[[IV_IDX_J:.*]] = fir.convert %[[ARG1]]
86
+ ! COMMON -NEXT: fir.store %[[IV_IDX_J]] to %[[BINDING_J]]#0
63
87
64
- ! CHECK -NEXT: %[[IV_IDX_K:.*]] = fir.convert %[[ARG2]]
65
- ! CHECK -NEXT: fir.store %[[IV_IDX_K]] to %[[BINDING_K]]#0
88
+ ! COMMON -NEXT: %[[IV_IDX_K:.*]] = fir.convert %[[ARG2]]
89
+ ! COMMON -NEXT: fir.store %[[IV_IDX_K]] to %[[BINDING_K]]#0
66
90
67
- ! CHECK : omp.yield
68
- ! CHECK -NEXT: }
69
- ! CHECK -NEXT: }
91
+ ! COMMON : omp.yield
92
+ ! COMMON -NEXT: }
93
+ ! COMMON -NEXT: }
70
94
71
- ! CHECK -NEXT: omp.terminator
72
- ! CHECK -NEXT: }
95
+ ! HOST -NEXT: omp.terminator
96
+ ! HOST -NEXT: }
0 commit comments