[Clang] Make OpenMP offloading consistently use the bound architecture (#125135)
[llvm-project.git] / flang / test / Lower / OpenACC / acc-routine.f90
blob1170af18bc33410bd712c392f19bf9d0b97427a4
1 ! This test checks lowering of OpenACC routine directive.
3 ! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s
5 ! CHECK: acc.routine @acc_routine_17 func(@_QPacc_routine19) bind("_QPacc_routine17" [#acc.device_type<host>], "_QPacc_routine17" [#acc.device_type<default>], "_QPacc_routine16" [#acc.device_type<multicore>])
6 ! CHECK: acc.routine @acc_routine_16 func(@_QPacc_routine18) bind("_QPacc_routine17" [#acc.device_type<host>], "_QPacc_routine16" [#acc.device_type<multicore>])
7 ! CHECK: acc.routine @acc_routine_15 func(@_QPacc_routine17) worker ([#acc.device_type<host>]) vector ([#acc.device_type<multicore>])
8 ! CHECK: acc.routine @acc_routine_14 func(@_QPacc_routine16) gang([#acc.device_type<nvidia>]) seq ([#acc.device_type<host>])
9 ! CHECK: acc.routine @acc_routine_10 func(@_QPacc_routine11) seq
10 ! CHECK: acc.routine @acc_routine_9 func(@_QPacc_routine10) seq
11 ! CHECK: acc.routine @acc_routine_8 func(@_QPacc_routine9) bind("_QPacc_routine9a")
12 ! CHECK: acc.routine @acc_routine_7 func(@_QPacc_routine8) bind("routine8_")
13 ! CHECK: acc.routine @acc_routine_6 func(@_QPacc_routine7) gang(dim: 1 : i64)
14 ! CHECK: acc.routine @acc_routine_5 func(@_QPacc_routine6) nohost
15 ! CHECK: acc.routine @acc_routine_4 func(@_QPacc_routine5) worker
16 ! CHECK: acc.routine @acc_routine_3 func(@_QPacc_routine4) vector
17 ! CHECK: acc.routine @acc_routine_2 func(@_QPacc_routine3) gang
18 ! CHECK: acc.routine @acc_routine_1 func(@_QPacc_routine2) seq
19 ! CHECK: acc.routine @acc_routine_0 func(@_QPacc_routine1)
21 subroutine acc_routine1()
22 !$acc routine
23 end subroutine
25 ! CHECK-LABEL: func.func @_QPacc_routine1() attributes {acc.routine_info = #acc.routine_info<[@acc_routine_0]>}
27 subroutine acc_routine2()
28 !$acc routine seq
29 end subroutine
31 ! CHECK-LABEL: func.func @_QPacc_routine2() attributes {acc.routine_info = #acc.routine_info<[@acc_routine_1]>}
33 subroutine acc_routine3()
34 !$acc routine gang
35 end subroutine
37 ! CHECK-LABEL: func.func @_QPacc_routine3() attributes {acc.routine_info = #acc.routine_info<[@acc_routine_2]>}
39 subroutine acc_routine4()
40 !$acc routine vector
41 end subroutine
43 ! CHECK-LABEL: func.func @_QPacc_routine4() attributes {acc.routine_info = #acc.routine_info<[@acc_routine_3]>}
45 subroutine acc_routine5()
46 !$acc routine worker
47 end subroutine
49 ! CHECK-LABEL: func.func @_QPacc_routine5() attributes {acc.routine_info = #acc.routine_info<[@acc_routine_4]>}
51 subroutine acc_routine6()
52 !$acc routine nohost
53 end subroutine
55 ! CHECK-LABEL: func.func @_QPacc_routine6() attributes {acc.routine_info = #acc.routine_info<[@acc_routine_5]>}
57 subroutine acc_routine7()
58 !$acc routine gang(dim:1)
59 end subroutine
61 ! CHECK-LABEL: func.func @_QPacc_routine7() attributes {acc.routine_info = #acc.routine_info<[@acc_routine_6]>}
63 subroutine acc_routine8()
64 !$acc routine bind("routine8_")
65 end subroutine
67 ! CHECK-LABEL: func.func @_QPacc_routine8() attributes {acc.routine_info = #acc.routine_info<[@acc_routine_7]>}
69 subroutine acc_routine9a()
70 end subroutine
72 subroutine acc_routine9()
73 !$acc routine bind(acc_routine9a)
74 end subroutine
76 ! CHECK-LABEL: func.func @_QPacc_routine9() attributes {acc.routine_info = #acc.routine_info<[@acc_routine_8]>}
78 function acc_routine10()
79 !$acc routine(acc_routine10) seq
80 end function
82 ! CHECK-LABEL: func.func @_QPacc_routine10() -> f32 attributes {acc.routine_info = #acc.routine_info<[@acc_routine_9]>}
84 subroutine acc_routine11(a)
85 real :: a
86 !$acc routine(acc_routine11) seq
87 end subroutine
89 ! CHECK-LABEL: func.func @_QPacc_routine11(%arg0: !fir.ref<f32> {fir.bindc_name = "a"}) attributes {acc.routine_info = #acc.routine_info<[@acc_routine_10]>}
91 subroutine acc_routine12()
93 interface
94 subroutine acc_routine11(a)
95 real :: a
96 !$acc routine(acc_routine11) seq
97 end subroutine
98 end interface
100 end subroutine
102 subroutine acc_routine13()
103 !$acc routine bind(acc_routine14)
104 end subroutine
106 subroutine acc_routine14()
107 end subroutine
109 subroutine acc_routine15()
110 !$acc routine bind(acc_routine16)
111 end subroutine
113 subroutine acc_routine16()
114 !$acc routine device_type(host) seq dtype(nvidia) gang
115 end subroutine
117 subroutine acc_routine17()
118 !$acc routine device_type(host) worker dtype(multicore) vector
119 end subroutine
121 subroutine acc_routine18()
122 !$acc routine device_type(host) bind(acc_routine17) dtype(multicore) bind(acc_routine16)
123 end subroutine
125 subroutine acc_routine19()
126 !$acc routine device_type(host,default) bind(acc_routine17) dtype(multicore) bind(acc_routine16)
127 end subroutine