xref: /llvm-project/flang/test/Lower/CUDA/cuda-module-use.cuf (revision 45daa4fdc68f5faa5bd5c33da052d2415cd88540)
1e2d80a3dSValentin Clement (バレンタイン クレメン)! RUN: bbc -emit-hlfir -fcuda %S/cuda-mod.cuf
2e2d80a3dSValentin Clement (バレンタイン クレメン)! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s
3e2d80a3dSValentin Clement (バレンタイン クレメン)
4c1c2c928SValentin Clement (バレンタイン クレメン)! Test importing module containing variable and subroutine with CUDA attributes.
5e2d80a3dSValentin Clement (バレンタイン クレメン)
6e2d80a3dSValentin Clement (バレンタイン クレメン)subroutine sub1()
7e2d80a3dSValentin Clement (バレンタイン クレメン)  use cuf_mod
88a6a0f19SValentin Clement (バレンタイン クレメン)!  md = 1.0 ! currently a TODO
9e2d80a3dSValentin Clement (バレンタイン クレメン)end
10e2d80a3dSValentin Clement (バレンタイン クレメン)
11e2d80a3dSValentin Clement (バレンタイン クレメン)! CHECK-LABEL: func.func @_QPsub1()
12e2d80a3dSValentin Clement (バレンタイン クレメン)! CHECK: %[[ADDR:.*]] = fir.address_of(@_QMcuf_modEmd) : !fir.ref<f32>
13*45daa4fdSValentin Clement (バレンタイン クレメン)! CHECK: %{{.*}}:2 = hlfir.declare %[[ADDR]] {data_attr = #cuf.cuda<device>, uniq_name = "_QMcuf_modEmd"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
14e2d80a3dSValentin Clement (バレンタイン クレメン)
15c1c2c928SValentin Clement (バレンタイン クレメン)attributes(device) subroutine sub2()
16c1c2c928SValentin Clement (バレンタイン クレメン)  use cuf_mod
17c1c2c928SValentin Clement (バレンタイン クレメン)  call devsub()
18c1c2c928SValentin Clement (バレンタイン クレメン)end
19c1c2c928SValentin Clement (バレンタイン クレメン)
20*45daa4fdSValentin Clement (バレンタイン クレメン)! CHECK-LABEL: func.func @_QPsub2() attributes {cuf.proc_attr = #cuf.cuda_proc<device>}
21c1c2c928SValentin Clement (バレンタイン クレメン)! CHECK: fir.call @_QMcuf_modPdevsub()
22c1c2c928SValentin Clement (バレンタイン クレメン)
23*45daa4fdSValentin Clement (バレンタイン クレメン)! CHECK-LABEL: fir.global @_QMcuf_modEmd {data_attr = #cuf.cuda<device>} : f32
24c1c2c928SValentin Clement (バレンタイン クレメン)
25*45daa4fdSValentin Clement (バレンタイン クレメン)! CHECK-LABEL: func.func private @_QMcuf_modPdevsub() attributes {cuf.proc_attr = #cuf.cuda_proc<device>}
26