|
6 | 6 | // RUN: -fcuda-is-device -emit-cir -o - %s \ |
7 | 7 | // RUN: | FileCheck --check-prefix=CIR %s |
8 | 8 |
|
| 9 | +// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda \ |
| 10 | +// RUN: -fcuda-is-device -emit-llvm -o - %s \ |
| 11 | +// RUN: | FileCheck --check-prefix=OGCG %s |
| 12 | + |
9 | 13 | #include "__clang_cuda_builtin_vars.h" |
10 | 14 |
|
11 | 15 | // LLVM: define{{.*}} void @_Z6kernelPi(ptr %0) |
12 | | -// CIR-LABEL: @_Z6kernelPi |
| 16 | +// OGCG: define{{.*}} void @_Z6kernelPi(ptr noundef %out) |
13 | 17 | __attribute__((global)) |
14 | 18 | void kernel(int *out) { |
15 | 19 | int i = 0; |
16 | 20 |
|
17 | | - // out[i++] = threadIdx.x; |
18 | | - // CIR-DISABLED: cir.func linkonce_odr @_ZN26__cuda_builtin_threadIdx_t17__fetch_builtin_xEv() |
19 | | - // CIR-DISABLED: cir.llvm.intrinsic "nvvm.read.ptx.sreg.tid.x" |
20 | | - // LLVM-DISABLED: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.tid.x() |
21 | | - |
22 | | - // out[i++] = threadIdx.y; |
23 | | - // CIR-DISABLED: cir.func linkonce_odr @_ZN26__cuda_builtin_threadIdx_t17__fetch_builtin_yEv() |
24 | | - // CIR-DISABLED: cir.llvm.intrinsic "nvvm.read.ptx.sreg.tid.y" |
25 | | - // LLVM-DISABLED: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.tid.y() |
26 | | - |
27 | | - // out[i++] = threadIdx.z; |
28 | | - // CIR-DISABLED: cir.func linkonce_odr @_ZN26__cuda_builtin_threadIdx_t17__fetch_builtin_zEv() |
29 | | - // CIR-DISABLED: cir.llvm.intrinsic "nvvm.read.ptx.sreg.tid.z" |
30 | | - // LLVM-DISABLED: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.tid.z() |
31 | | - |
32 | | - |
33 | | - // out[i++] = blockIdx.x; |
34 | | - // CIR-DISABLED: cir.func linkonce_odr @_ZN25__cuda_builtin_blockIdx_t17__fetch_builtin_xEv() |
35 | | - // CIR-DISABLED: cir.llvm.intrinsic "nvvm.read.ptx.sreg.ctaid.x" |
36 | | - // LLVM-DISABLED: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ctaid.x() |
37 | | - |
38 | | - // out[i++] = blockIdx.y; |
39 | | - // CIR-DISABLED: cir.func linkonce_odr @_ZN25__cuda_builtin_blockIdx_t17__fetch_builtin_yEv() |
40 | | - // CIR-DISABLED: cir.llvm.intrinsic "nvvm.read.ptx.sreg.ctaid.y" |
41 | | - // LLVM-DISABLED: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ctaid.y() |
42 | | - |
43 | | - // out[i++] = blockIdx.z; |
44 | | - // CIR-DISABLED: cir.func linkonce_odr @_ZN25__cuda_builtin_blockIdx_t17__fetch_builtin_zEv() |
45 | | - // CIR-DISABLED: cir.llvm.intrinsic "nvvm.read.ptx.sreg.ctaid.z" |
46 | | - // LLVM-DISABLED: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ctaid.z() |
47 | | - |
48 | | - |
49 | | - // out[i++] = blockDim.x; |
50 | | - // CIR-DISABLED: cir.func linkonce_odr @_ZN25__cuda_builtin_blockDim_t17__fetch_builtin_xEv() |
51 | | - // CIR-DISABLED: cir.llvm.intrinsic "nvvm.read.ptx.sreg.ntid.x" |
52 | | - // LLVM-DISABLED: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ntid.x() |
53 | | - |
54 | | - // out[i++] = blockDim.y; |
55 | | - // CIR-DISABLED: cir.func linkonce_odr @_ZN25__cuda_builtin_blockDim_t17__fetch_builtin_yEv() |
56 | | - // CIR-DISABLED: cir.llvm.intrinsic "nvvm.read.ptx.sreg.ntid.y" |
57 | | - // LLVM-DISABLED: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ntid.y() |
58 | | - |
59 | | - // out[i++] = blockDim.z; |
60 | | - // CIR-DISABLED: cir.func linkonce_odr @_ZN25__cuda_builtin_blockDim_t17__fetch_builtin_zEv() |
61 | | - // CIR-DISABLED: cir.llvm.intrinsic "nvvm.read.ptx.sreg.ntid.z" |
62 | | - // LLVM-DISABLED: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ntid.z() |
63 | | - |
64 | | - |
65 | | - // out[i++] = gridDim.x; |
66 | | - // CIR-DISABLED: cir.func linkonce_odr @_ZN24__cuda_builtin_gridDim_t17__fetch_builtin_xEv() |
67 | | - // CIR-DISABLED: cir.llvm.intrinsic "nvvm.read.ptx.sreg.nctaid.x" |
68 | | - // LLVM-DISABLED: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.nctaid.x() |
69 | | - |
70 | | - // out[i++] = gridDim.y; |
71 | | - // CIR-DISABLED: cir.func linkonce_odr @_ZN24__cuda_builtin_gridDim_t17__fetch_builtin_yEv() |
72 | | - // CIR-DISABLED: cir.llvm.intrinsic "nvvm.read.ptx.sreg.nctaid.y" |
73 | | - // LLVM-DISABLED: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.nctaid.y() |
74 | | - |
75 | | - // out[i++] = gridDim.z; |
76 | | - // CIR-DISABLED: cir.func linkonce_odr @_ZN24__cuda_builtin_gridDim_t17__fetch_builtin_zEv() |
77 | | - // CIR-DISABLED: cir.llvm.intrinsic "nvvm.read.ptx.sreg.nctaid.z" |
78 | | - // LLVM-DISABLED: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.nctaid.z() |
79 | | - |
80 | | - |
81 | | - // out[i++] = warpSize; |
82 | | - // CIR-DISABLED: [[REGISTER:%.*]] = cir.const #cir.int<32> |
83 | | - // CIR-DISABLED: cir.store{{.*}} [[REGISTER]] |
84 | | - // LLVM-DISABLED: store i32 32, |
85 | | - |
86 | | - |
87 | | - // CIR-DISABLED: cir.return loc |
88 | | - // LLVM-DISABLED: ret void |
| 21 | + out[i++] = threadIdx.x; |
| 22 | + // CIR: cir.func linkonce_odr @_ZN26__cuda_builtin_threadIdx_t17__fetch_builtin_xEv() |
| 23 | + // CIR: cir.llvm.intrinsic "nvvm.read.ptx.sreg.tid.x" |
| 24 | + // LLVM: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.tid.x() |
| 25 | + // OGCG: call noundef{{.*}} i32 @llvm.nvvm.read.ptx.sreg.tid.x() |
| 26 | + |
| 27 | + out[i++] = threadIdx.y; |
| 28 | + // CIR: cir.func linkonce_odr @_ZN26__cuda_builtin_threadIdx_t17__fetch_builtin_yEv() |
| 29 | + // CIR: cir.llvm.intrinsic "nvvm.read.ptx.sreg.tid.y" |
| 30 | + // LLVM: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.tid.y() |
| 31 | + // OGCG: call noundef{{.*}} i32 @llvm.nvvm.read.ptx.sreg.tid.y() |
| 32 | + |
| 33 | + out[i++] = threadIdx.z; |
| 34 | + // CIR: cir.func linkonce_odr @_ZN26__cuda_builtin_threadIdx_t17__fetch_builtin_zEv() |
| 35 | + // CIR: cir.llvm.intrinsic "nvvm.read.ptx.sreg.tid.z" |
| 36 | + // LLVM: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.tid.z() |
| 37 | + // OGCG: call noundef{{.*}} i32 @llvm.nvvm.read.ptx.sreg.tid.z() |
| 38 | + |
| 39 | + |
| 40 | + out[i++] = blockIdx.x; |
| 41 | + // CIR: cir.func linkonce_odr @_ZN25__cuda_builtin_blockIdx_t17__fetch_builtin_xEv() |
| 42 | + // CIR: cir.llvm.intrinsic "nvvm.read.ptx.sreg.ctaid.x" |
| 43 | + // LLVM: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ctaid.x() |
| 44 | + // OGCG: call noundef{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ctaid.x() |
| 45 | + |
| 46 | + out[i++] = blockIdx.y; |
| 47 | + // CIR: cir.func linkonce_odr @_ZN25__cuda_builtin_blockIdx_t17__fetch_builtin_yEv() |
| 48 | + // CIR: cir.llvm.intrinsic "nvvm.read.ptx.sreg.ctaid.y" |
| 49 | + // LLVM: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ctaid.y() |
| 50 | + // OGCG: call noundef{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ctaid.y() |
| 51 | + |
| 52 | + out[i++] = blockIdx.z; |
| 53 | + // CIR: cir.func linkonce_odr @_ZN25__cuda_builtin_blockIdx_t17__fetch_builtin_zEv() |
| 54 | + // CIR: cir.llvm.intrinsic "nvvm.read.ptx.sreg.ctaid.z" |
| 55 | + // LLVM: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ctaid.z() |
| 56 | + // OGCG: call noundef{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ctaid.z() |
| 57 | + |
| 58 | + |
| 59 | + out[i++] = blockDim.x; |
| 60 | + // CIR: cir.func linkonce_odr @_ZN25__cuda_builtin_blockDim_t17__fetch_builtin_xEv() |
| 61 | + // CIR: cir.llvm.intrinsic "nvvm.read.ptx.sreg.ntid.x" |
| 62 | + // LLVM: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ntid.x() |
| 63 | + // OGCG: call noundef{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ntid.x() |
| 64 | + |
| 65 | + out[i++] = blockDim.y; |
| 66 | + // CIR: cir.func linkonce_odr @_ZN25__cuda_builtin_blockDim_t17__fetch_builtin_yEv() |
| 67 | + // CIR: cir.llvm.intrinsic "nvvm.read.ptx.sreg.ntid.y" |
| 68 | + // LLVM: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ntid.y() |
| 69 | + // OGCG: call noundef{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ntid.y() |
| 70 | + |
| 71 | + out[i++] = blockDim.z; |
| 72 | + // CIR: cir.func linkonce_odr @_ZN25__cuda_builtin_blockDim_t17__fetch_builtin_zEv() |
| 73 | + // CIR: cir.llvm.intrinsic "nvvm.read.ptx.sreg.ntid.z" |
| 74 | + // LLVM: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ntid.z() |
| 75 | + // OGCG: call noundef{{.*}} i32 @llvm.nvvm.read.ptx.sreg.ntid.z() |
| 76 | + |
| 77 | + |
| 78 | + out[i++] = gridDim.x; |
| 79 | + // CIR: cir.func linkonce_odr @_ZN24__cuda_builtin_gridDim_t17__fetch_builtin_xEv() |
| 80 | + // CIR: cir.llvm.intrinsic "nvvm.read.ptx.sreg.nctaid.x" |
| 81 | + // LLVM: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.nctaid.x() |
| 82 | + // OGCG: call noundef{{.*}} i32 @llvm.nvvm.read.ptx.sreg.nctaid.x() |
| 83 | + |
| 84 | + out[i++] = gridDim.y; |
| 85 | + // CIR: cir.func linkonce_odr @_ZN24__cuda_builtin_gridDim_t17__fetch_builtin_yEv() |
| 86 | + // CIR: cir.llvm.intrinsic "nvvm.read.ptx.sreg.nctaid.y" |
| 87 | + // LLVM: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.nctaid.y() |
| 88 | + // OGCG: call noundef{{.*}} i32 @llvm.nvvm.read.ptx.sreg.nctaid.y() |
| 89 | + |
| 90 | + out[i++] = gridDim.z; |
| 91 | + // CIR: cir.func linkonce_odr @_ZN24__cuda_builtin_gridDim_t17__fetch_builtin_zEv() |
| 92 | + // CIR: cir.llvm.intrinsic "nvvm.read.ptx.sreg.nctaid.z" |
| 93 | + // LLVM: call{{.*}} i32 @llvm.nvvm.read.ptx.sreg.nctaid.z() |
| 94 | + // OGCG: call noundef{{.*}} i32 @llvm.nvvm.read.ptx.sreg.nctaid.z() |
| 95 | + |
| 96 | + |
| 97 | + out[i++] = warpSize; |
| 98 | + // CIR: [[REGISTER:%.*]] = cir.const #cir.int<32> |
| 99 | + // CIR: cir.store{{.*}} [[REGISTER]] |
| 100 | + // LLVM: store i32 32, |
| 101 | + // OGCG: store i32 32, |
| 102 | + |
| 103 | + |
| 104 | + // CIR: cir.return loc |
| 105 | + // LLVM: ret void |
| 106 | + // OGCG: ret void |
89 | 107 | } |
0 commit comments