| 1 |
// REQUIRES: nvptx-registered-target |
| 2 |
// RUN: %clang_cc1 -ffp-contract=off -triple nvptx-unknown-unknown -target-cpu sm_80 -target-feature +ptx70 \ |
| 3 |
// RUN: -fcuda-is-device -emit-llvm -o - -x cuda %s \ |
| 4 |
// RUN: | FileCheck -check-prefix=CHECK -check-prefix=CHECK_PTX70_SM80 -check-prefix=LP32 %s |
| 5 |
// RUN: %clang_cc1 -ffp-contract=off -triple nvptx64-unknown-unknown -target-cpu sm_80 -target-feature +ptx70 \ |
| 6 |
// RUN: -fcuda-is-device -emit-llvm -o - -x cuda %s \ |
| 7 |
// RUN: | FileCheck -check-prefix=CHECK -check-prefix=CHECK_PTX70_SM80 -check-prefix=LP64 %s |
| 8 |
// RUN: %clang_cc1 -ffp-contract=off -triple nvptx-unknown-unknown -target-cpu sm_60 -target-feature +ptx62 \ |
| 9 |
// RUN: -fcuda-is-device -emit-llvm -o - -x cuda %s \ |
| 10 |
// RUN: | FileCheck -check-prefix=CHECK -check-prefix=LP32 %s |
| 11 |
// RUN: %clang_cc1 -ffp-contract=off -triple nvptx64-unknown-unknown -target-cpu sm_60 -target-feature +ptx62 \ |
| 12 |
// RUN: -fcuda-is-device -emit-llvm -o - -x cuda %s \ |
| 13 |
// RUN: | FileCheck -check-prefix=CHECK -check-prefix=LP64 %s |
| 14 |
// RUN: %clang_cc1 -ffp-contract=off -triple nvptx64-unknown-unknown -target-cpu sm_61 -target-feature +ptx62 \ |
| 15 |
// RUN: -fcuda-is-device -emit-llvm -o - -x cuda %s \ |
| 16 |
// RUN: | FileCheck -check-prefix=CHECK -check-prefix=LP64 %s |
| 17 |
// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_53 -target-feature +ptx62 \ |
| 18 |
// RUN: -DERROR_CHECK -fcuda-is-device -S -o /dev/null -x cuda -verify %s |
| 19 |
// RUN: %clang_cc1 -ffp-contract=off -triple nvptx-unknown-unknown -target-cpu sm_86 -target-feature +ptx72 \ |
| 20 |
// RUN: -fcuda-is-device -emit-llvm -o - -x cuda %s \ |
| 21 |
// RUN: | FileCheck -check-prefix=CHECK -check-prefix=CHECK_PTX72_SM86 -check-prefix=LP32 %s |
| 22 |
// RUN: %clang_cc1 -ffp-contract=off -triple nvptx64-unknown-unknown -target-cpu sm_86 -target-feature +ptx72 \ |
| 23 |
// RUN: -fcuda-is-device -emit-llvm -o - -x cuda %s \ |
| 24 |
// RUN: | FileCheck -check-prefix=CHECK -check-prefix=CHECK_PTX72_SM86 -check-prefix=LP64 %s |
| 25 |
|
| 26 |
#define __device__ __attribute__((device)) |
| 27 |
#define __global__ __attribute__((global)) |
| 28 |
#define __shared__ __attribute__((shared)) |
| 29 |
#define __constant__ __attribute__((constant)) |
| 30 |
|
| 31 |
__device__ int read_tid() { |
| 32 |
|
| 33 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.tid.x() |
| 34 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.tid.y() |
| 35 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.tid.z() |
| 36 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.tid.w() |
| 37 |
|
| 38 |
int x = __nvvm_read_ptx_sreg_tid_x(); |
| 39 |
int y = __nvvm_read_ptx_sreg_tid_y(); |
| 40 |
int z = __nvvm_read_ptx_sreg_tid_z(); |
| 41 |
int w = __nvvm_read_ptx_sreg_tid_w(); |
| 42 |
|
| 43 |
return x + y + z + w; |
| 44 |
|
| 45 |
} |
| 46 |
|
| 47 |
__device__ bool reflect() { |
| 48 |
|
| 49 |
// CHECK: call i32 @llvm.nvvm.reflect(ptr {{.*}}) |
| 50 |
|
| 51 |
unsigned x = __nvvm_reflect("__CUDA_ARCH"); |
| 52 |
return x >= 700; |
| 53 |
} |
| 54 |
|
| 55 |
__device__ int read_ntid() { |
| 56 |
|
| 57 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.ntid.x() |
| 58 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.ntid.y() |
| 59 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.ntid.z() |
| 60 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.ntid.w() |
| 61 |
|
| 62 |
int x = __nvvm_read_ptx_sreg_ntid_x(); |
| 63 |
int y = __nvvm_read_ptx_sreg_ntid_y(); |
| 64 |
int z = __nvvm_read_ptx_sreg_ntid_z(); |
| 65 |
int w = __nvvm_read_ptx_sreg_ntid_w(); |
| 66 |
|
| 67 |
return x + y + z + w; |
| 68 |
|
| 69 |
} |
| 70 |
|
| 71 |
__device__ int read_ctaid() { |
| 72 |
|
| 73 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.ctaid.x() |
| 74 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.ctaid.y() |
| 75 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.ctaid.z() |
| 76 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.ctaid.w() |
| 77 |
|
| 78 |
int x = __nvvm_read_ptx_sreg_ctaid_x(); |
| 79 |
int y = __nvvm_read_ptx_sreg_ctaid_y(); |
| 80 |
int z = __nvvm_read_ptx_sreg_ctaid_z(); |
| 81 |
int w = __nvvm_read_ptx_sreg_ctaid_w(); |
| 82 |
|
| 83 |
return x + y + z + w; |
| 84 |
|
| 85 |
} |
| 86 |
|
| 87 |
__device__ int read_nctaid() { |
| 88 |
|
| 89 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.nctaid.x() |
| 90 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.nctaid.y() |
| 91 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.nctaid.z() |
| 92 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.nctaid.w() |
| 93 |
|
| 94 |
int x = __nvvm_read_ptx_sreg_nctaid_x(); |
| 95 |
int y = __nvvm_read_ptx_sreg_nctaid_y(); |
| 96 |
int z = __nvvm_read_ptx_sreg_nctaid_z(); |
| 97 |
int w = __nvvm_read_ptx_sreg_nctaid_w(); |
| 98 |
|
| 99 |
return x + y + z + w; |
| 100 |
|
| 101 |
} |
| 102 |
|
| 103 |
__device__ int read_ids() { |
| 104 |
|
| 105 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.laneid() |
| 106 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.warpid() |
| 107 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.nwarpid() |
| 108 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.smid() |
| 109 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.nsmid() |
| 110 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.gridid() |
| 111 |
|
| 112 |
int a = __nvvm_read_ptx_sreg_laneid(); |
| 113 |
int b = __nvvm_read_ptx_sreg_warpid(); |
| 114 |
int c = __nvvm_read_ptx_sreg_nwarpid(); |
| 115 |
int d = __nvvm_read_ptx_sreg_smid(); |
| 116 |
int e = __nvvm_read_ptx_sreg_nsmid(); |
| 117 |
int f = __nvvm_read_ptx_sreg_gridid(); |
| 118 |
|
| 119 |
return a + b + c + d + e + f; |
| 120 |
|
| 121 |
} |
| 122 |
|
| 123 |
__device__ int read_lanemasks() { |
| 124 |
|
| 125 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.lanemask.eq() |
| 126 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.lanemask.le() |
| 127 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.lanemask.lt() |
| 128 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.lanemask.ge() |
| 129 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.lanemask.gt() |
| 130 |
|
| 131 |
int a = __nvvm_read_ptx_sreg_lanemask_eq(); |
| 132 |
int b = __nvvm_read_ptx_sreg_lanemask_le(); |
| 133 |
int c = __nvvm_read_ptx_sreg_lanemask_lt(); |
| 134 |
int d = __nvvm_read_ptx_sreg_lanemask_ge(); |
| 135 |
int e = __nvvm_read_ptx_sreg_lanemask_gt(); |
| 136 |
|
| 137 |
return a + b + c + d + e; |
| 138 |
|
| 139 |
} |
| 140 |
|
| 141 |
__device__ long long read_clocks() { |
| 142 |
|
| 143 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.clock() |
| 144 |
// CHECK: call i64 @llvm.nvvm.read.ptx.sreg.clock64() |
| 145 |
// CHECK: call i64 @llvm.nvvm.read.ptx.sreg.globaltimer() |
| 146 |
|
| 147 |
int a = __nvvm_read_ptx_sreg_clock(); |
| 148 |
long long b = __nvvm_read_ptx_sreg_clock64(); |
| 149 |
long long c = __nvvm_read_ptx_sreg_globaltimer(); |
| 150 |
|
| 151 |
return a + b + c; |
| 152 |
} |
| 153 |
|
| 154 |
__device__ int read_pms() { |
| 155 |
|
| 156 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.pm0() |
| 157 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.pm1() |
| 158 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.pm2() |
| 159 |
// CHECK: call i32 @llvm.nvvm.read.ptx.sreg.pm3() |
| 160 |
|
| 161 |
int a = __nvvm_read_ptx_sreg_pm0(); |
| 162 |
int b = __nvvm_read_ptx_sreg_pm1(); |
| 163 |
int c = __nvvm_read_ptx_sreg_pm2(); |
| 164 |
int d = __nvvm_read_ptx_sreg_pm3(); |
| 165 |
|
| 166 |
return a + b + c + d; |
| 167 |
|
| 168 |
} |
| 169 |
|
| 170 |
__device__ void sync() { |
| 171 |
|
| 172 |
// CHECK: call void @llvm.nvvm.bar.sync(i32 0) |
| 173 |
|
| 174 |
__nvvm_bar_sync(0); |
| 175 |
|
| 176 |
} |
| 177 |
|
| 178 |
__device__ void activemask() { |
| 179 |
|
| 180 |
// CHECK: call i32 @llvm.nvvm.activemask() |
| 181 |
|
| 182 |
__nvvm_activemask(); |
| 183 |
|
| 184 |
} |
| 185 |
|
| 186 |
__device__ void exit() { |
| 187 |
|
| 188 |
// CHECK: call void @llvm.nvvm.exit() |
| 189 |
|
| 190 |
__nvvm_exit(); |
| 191 |
|
| 192 |
} |
| 193 |
|
| 194 |
// NVVM intrinsics |
| 195 |
|
| 196 |
// The idea is not to test all intrinsics, just that Clang is recognizing the |
| 197 |
// builtins defined in BuiltinsNVPTX.def |
| 198 |
__device__ void nvvm_math(float f1, float f2, double d1, double d2) { |
| 199 |
// CHECK: call float @llvm.nvvm.fmax.f |
| 200 |
float t1 = __nvvm_fmax_f(f1, f2); |
| 201 |
// CHECK: call float @llvm.nvvm.fmin.f |
| 202 |
float t2 = __nvvm_fmin_f(f1, f2); |
| 203 |
// CHECK: call float @llvm.nvvm.sqrt.rn.f |
| 204 |
float t3 = __nvvm_sqrt_rn_f(f1); |
| 205 |
// CHECK: call float @llvm.nvvm.rcp.rn.f |
| 206 |
float t4 = __nvvm_rcp_rn_f(f2); |
| 207 |
// CHECK: call float @llvm.nvvm.add.rn.f |
| 208 |
float t5 = __nvvm_add_rn_f(f1, f2); |
| 209 |
|
| 210 |
// CHECK: call double @llvm.nvvm.fmax.d |
| 211 |
double td1 = __nvvm_fmax_d(d1, d2); |
| 212 |
// CHECK: call double @llvm.nvvm.fmin.d |
| 213 |
double td2 = __nvvm_fmin_d(d1, d2); |
| 214 |
// CHECK: call double @llvm.nvvm.sqrt.rn.d |
| 215 |
double td3 = __nvvm_sqrt_rn_d(d1); |
| 216 |
// CHECK: call double @llvm.nvvm.rcp.rn.d |
| 217 |
double td4 = __nvvm_rcp_rn_d(d2); |
| 218 |
|
| 219 |
// CHECK: call void @llvm.nvvm.membar.cta() |
| 220 |
__nvvm_membar_cta(); |
| 221 |
// CHECK: call void @llvm.nvvm.membar.gl() |
| 222 |
__nvvm_membar_gl(); |
| 223 |
// CHECK: call void @llvm.nvvm.membar.sys() |
| 224 |
__nvvm_membar_sys(); |
| 225 |
// CHECK: call void @llvm.nvvm.barrier0() |
| 226 |
__syncthreads(); |
| 227 |
} |
| 228 |
|
| 229 |
__device__ int di; |
| 230 |
__shared__ int si; |
| 231 |
__device__ long dl; |
| 232 |
__shared__ long sl; |
| 233 |
__device__ long long dll; |
| 234 |
__shared__ long long sll; |
| 235 |
|
| 236 |
// Check for atomic intrinsics |
| 237 |
// CHECK-LABEL: nvvm_atom |
| 238 |
__device__ void nvvm_atom(float *fp, float f, double *dfp, double df, int *ip, |
| 239 |
int i, unsigned int *uip, unsigned ui, long *lp, |
| 240 |
long l, long long *llp, long long ll) { |
| 241 |
// CHECK: atomicrmw add ptr {{.*}} seq_cst, align 4 |
| 242 |
__nvvm_atom_add_gen_i(ip, i); |
| 243 |
// CHECK: atomicrmw add ptr {{.*}} seq_cst, align {{4|8}} |
| 244 |
__nvvm_atom_add_gen_l(&dl, l); |
| 245 |
// CHECK: atomicrmw add ptr {{.*}} seq_cst, align 8 |
| 246 |
__nvvm_atom_add_gen_ll(&sll, ll); |
| 247 |
|
| 248 |
// CHECK: atomicrmw sub ptr {{.*}} seq_cst, align 4 |
| 249 |
__nvvm_atom_sub_gen_i(ip, i); |
| 250 |
// CHECK: atomicrmw sub ptr {{.*}} seq_cst, align {{4|8}} |
| 251 |
__nvvm_atom_sub_gen_l(&dl, l); |
| 252 |
// CHECK: atomicrmw sub ptr {{.*}} seq_cst, align 8 |
| 253 |
__nvvm_atom_sub_gen_ll(&sll, ll); |
| 254 |
|
| 255 |
// CHECK: atomicrmw and ptr {{.*}} seq_cst, align 4 |
| 256 |
__nvvm_atom_and_gen_i(ip, i); |
| 257 |
// CHECK: atomicrmw and ptr {{.*}} seq_cst, align {{4|8}} |
| 258 |
__nvvm_atom_and_gen_l(&dl, l); |
| 259 |
// CHECK: atomicrmw and ptr {{.*}} seq_cst, align 8 |
| 260 |
__nvvm_atom_and_gen_ll(&sll, ll); |
| 261 |
|
| 262 |
// CHECK: atomicrmw or ptr {{.*}} seq_cst, align 4 |
| 263 |
__nvvm_atom_or_gen_i(ip, i); |
| 264 |
// CHECK: atomicrmw or ptr {{.*}} seq_cst, align {{4|8}} |
| 265 |
__nvvm_atom_or_gen_l(&dl, l); |
| 266 |
// CHECK: atomicrmw or ptr {{.*}} seq_cst, align 8 |
| 267 |
__nvvm_atom_or_gen_ll(&sll, ll); |
| 268 |
|
| 269 |
// CHECK: atomicrmw xor ptr {{.*}} seq_cst, align 4 |
| 270 |
__nvvm_atom_xor_gen_i(ip, i); |
| 271 |
// CHECK: atomicrmw xor ptr {{.*}} seq_cst, align {{4|8}} |
| 272 |
__nvvm_atom_xor_gen_l(&dl, l); |
| 273 |
// CHECK: atomicrmw xor ptr {{.*}} seq_cst, align 8 |
| 274 |
__nvvm_atom_xor_gen_ll(&sll, ll); |
| 275 |
|
| 276 |
// CHECK: atomicrmw xchg ptr {{.*}} seq_cst, align 4 |
| 277 |
__nvvm_atom_xchg_gen_i(ip, i); |
| 278 |
// CHECK: atomicrmw xchg ptr {{.*}} seq_cst, align {{4|8}} |
| 279 |
__nvvm_atom_xchg_gen_l(&dl, l); |
| 280 |
// CHECK: atomicrmw xchg ptr {{.*}} seq_cst, align 8 |
| 281 |
__nvvm_atom_xchg_gen_ll(&sll, ll); |
| 282 |
|
| 283 |
// CHECK: atomicrmw max ptr {{.*}} seq_cst, align 4 |
| 284 |
__nvvm_atom_max_gen_i(ip, i); |
| 285 |
// CHECK: atomicrmw umax ptr {{.*}} seq_cst, align 4 |
| 286 |
__nvvm_atom_max_gen_ui((unsigned int *)ip, i); |
| 287 |
// CHECK: atomicrmw max ptr {{.*}} seq_cst, align {{4|8}} |
| 288 |
__nvvm_atom_max_gen_l(&dl, l); |
| 289 |
// CHECK: atomicrmw umax ptr {{.*}} seq_cst, align {{4|8}} |
| 290 |
__nvvm_atom_max_gen_ul((unsigned long *)&dl, l); |
| 291 |
// CHECK: atomicrmw max ptr {{.*}} seq_cst, align 8 |
| 292 |
__nvvm_atom_max_gen_ll(&sll, ll); |
| 293 |
// CHECK: atomicrmw umax ptr {{.*}} seq_cst, align 8 |
| 294 |
__nvvm_atom_max_gen_ull((unsigned long long *)&sll, ll); |
| 295 |
|
| 296 |
// CHECK: atomicrmw min ptr {{.*}} seq_cst, align 4 |
| 297 |
__nvvm_atom_min_gen_i(ip, i); |
| 298 |
// CHECK: atomicrmw umin ptr {{.*}} seq_cst, align 4 |
| 299 |
__nvvm_atom_min_gen_ui((unsigned int *)ip, i); |
| 300 |
// CHECK: atomicrmw min ptr {{.*}} seq_cst, align {{4|8}} |
| 301 |
__nvvm_atom_min_gen_l(&dl, l); |
| 302 |
// CHECK: atomicrmw umin ptr {{.*}} seq_cst, align {{4|8}} |
| 303 |
__nvvm_atom_min_gen_ul((unsigned long *)&dl, l); |
| 304 |
// CHECK: atomicrmw min ptr {{.*}} seq_cst, align 8 |
| 305 |
__nvvm_atom_min_gen_ll(&sll, ll); |
| 306 |
// CHECK: atomicrmw umin ptr {{.*}} seq_cst, align 8 |
| 307 |
__nvvm_atom_min_gen_ull((unsigned long long *)&sll, ll); |
| 308 |
|
| 309 |
// CHECK: cmpxchg ptr {{.*}} seq_cst seq_cst, align 4 |
| 310 |
// CHECK-NEXT: extractvalue { i32, i1 } {{%[0-9]+}}, 0 |
| 311 |
__nvvm_atom_cas_gen_i(ip, 0, i); |
| 312 |
// CHECK: cmpxchg ptr {{.*}} seq_cst seq_cst, align {{4|8}} |
| 313 |
// CHECK-NEXT: extractvalue { {{i32|i64}}, i1 } {{%[0-9]+}}, 0 |
| 314 |
__nvvm_atom_cas_gen_l(&dl, 0, l); |
| 315 |
// CHECK: cmpxchg ptr {{.*}} seq_cst seq_cst, align 8 |
| 316 |
// CHECK-NEXT: extractvalue { i64, i1 } {{%[0-9]+}}, 0 |
| 317 |
__nvvm_atom_cas_gen_ll(&sll, 0, ll); |
| 318 |
|
| 319 |
// CHECK: atomicrmw fadd ptr {{.*}} seq_cst, align 4 |
| 320 |
__nvvm_atom_add_gen_f(fp, f); |
| 321 |
|
| 322 |
// CHECK: call i32 @llvm.nvvm.atomic.load.inc.32.p0 |
| 323 |
__nvvm_atom_inc_gen_ui(uip, ui); |
| 324 |
|
| 325 |
// CHECK: call i32 @llvm.nvvm.atomic.load.dec.32.p0 |
| 326 |
__nvvm_atom_dec_gen_ui(uip, ui); |
| 327 |
|
| 328 |
|
| 329 |
////////////////////////////////////////////////////////////////// |
| 330 |
// Atomics with scope (only supported on sm_60+). |
| 331 |
|
| 332 |
#if ERROR_CHECK || __CUDA_ARCH__ >= 600 |
| 333 |
|
| 334 |
// CHECK: call i32 @llvm.nvvm.atomic.add.gen.i.cta.i32.p0 |
| 335 |
// expected-error@+1 {{'__nvvm_atom_cta_add_gen_i' needs target feature sm_60}} |
| 336 |
__nvvm_atom_cta_add_gen_i(ip, i); |
| 337 |
// LP32: call i32 @llvm.nvvm.atomic.add.gen.i.cta.i32.p0 |
| 338 |
// LP64: call i64 @llvm.nvvm.atomic.add.gen.i.cta.i64.p0 |
| 339 |
// expected-error@+1 {{'__nvvm_atom_cta_add_gen_l' needs target feature sm_60}} |
| 340 |
__nvvm_atom_cta_add_gen_l(&dl, l); |
| 341 |
// CHECK: call i64 @llvm.nvvm.atomic.add.gen.i.cta.i64.p0 |
| 342 |
// expected-error@+1 {{'__nvvm_atom_cta_add_gen_ll' needs target feature sm_60}} |
| 343 |
__nvvm_atom_cta_add_gen_ll(&sll, ll); |
| 344 |
// CHECK: call i32 @llvm.nvvm.atomic.add.gen.i.sys.i32.p0 |
| 345 |
// expected-error@+1 {{'__nvvm_atom_sys_add_gen_i' needs target feature sm_60}} |
| 346 |
__nvvm_atom_sys_add_gen_i(ip, i); |
| 347 |
// LP32: call i32 @llvm.nvvm.atomic.add.gen.i.sys.i32.p0 |
| 348 |
// LP64: call i64 @llvm.nvvm.atomic.add.gen.i.sys.i64.p0 |
| 349 |
// expected-error@+1 {{'__nvvm_atom_sys_add_gen_l' needs target feature sm_60}} |
| 350 |
__nvvm_atom_sys_add_gen_l(&dl, l); |
| 351 |
// CHECK: call i64 @llvm.nvvm.atomic.add.gen.i.sys.i64.p0 |
| 352 |
// expected-error@+1 {{'__nvvm_atom_sys_add_gen_ll' needs target feature sm_60}} |
| 353 |
__nvvm_atom_sys_add_gen_ll(&sll, ll); |
| 354 |
|
| 355 |
// CHECK: call float @llvm.nvvm.atomic.add.gen.f.cta.f32.p0 |
| 356 |
// expected-error@+1 {{'__nvvm_atom_cta_add_gen_f' needs target feature sm_60}} |
| 357 |
__nvvm_atom_cta_add_gen_f(fp, f); |
| 358 |
// CHECK: call double @llvm.nvvm.atomic.add.gen.f.cta.f64.p0 |
| 359 |
// expected-error@+1 {{'__nvvm_atom_cta_add_gen_d' needs target feature sm_60}} |
| 360 |
__nvvm_atom_cta_add_gen_d(dfp, df); |
| 361 |
// CHECK: call float @llvm.nvvm.atomic.add.gen.f.sys.f32.p0 |
| 362 |
// expected-error@+1 {{'__nvvm_atom_sys_add_gen_f' needs target feature sm_60}} |
| 363 |
__nvvm_atom_sys_add_gen_f(fp, f); |
| 364 |
// CHECK: call double @llvm.nvvm.atomic.add.gen.f.sys.f64.p0 |
| 365 |
// expected-error@+1 {{'__nvvm_atom_sys_add_gen_d' needs target feature sm_60}} |
| 366 |
__nvvm_atom_sys_add_gen_d(dfp, df); |
| 367 |
|
| 368 |
// CHECK: call i32 @llvm.nvvm.atomic.exch.gen.i.cta.i32.p0 |
| 369 |
// expected-error@+1 {{'__nvvm_atom_cta_xchg_gen_i' needs target feature sm_60}} |
| 370 |
__nvvm_atom_cta_xchg_gen_i(ip, i); |
| 371 |
// LP32: call i32 @llvm.nvvm.atomic.exch.gen.i.cta.i32.p0 |
| 372 |
// LP64: call i64 @llvm.nvvm.atomic.exch.gen.i.cta.i64.p0 |
| 373 |
// expected-error@+1 {{'__nvvm_atom_cta_xchg_gen_l' needs target feature sm_60}} |
| 374 |
__nvvm_atom_cta_xchg_gen_l(&dl, l); |
| 375 |
// CHECK: call i64 @llvm.nvvm.atomic.exch.gen.i.cta.i64.p0 |
| 376 |
// expected-error@+1 {{'__nvvm_atom_cta_xchg_gen_ll' needs target feature sm_60}} |
| 377 |
__nvvm_atom_cta_xchg_gen_ll(&sll, ll); |
| 378 |
|
| 379 |
// CHECK: call i32 @llvm.nvvm.atomic.exch.gen.i.sys.i32.p0 |
| 380 |
// expected-error@+1 {{'__nvvm_atom_sys_xchg_gen_i' needs target feature sm_60}} |
| 381 |
__nvvm_atom_sys_xchg_gen_i(ip, i); |
| 382 |
// LP32: call i32 @llvm.nvvm.atomic.exch.gen.i.sys.i32.p0 |
| 383 |
// LP64: call i64 @llvm.nvvm.atomic.exch.gen.i.sys.i64.p0 |
| 384 |
// expected-error@+1 {{'__nvvm_atom_sys_xchg_gen_l' needs target feature sm_60}} |
| 385 |
__nvvm_atom_sys_xchg_gen_l(&dl, l); |
| 386 |
// CHECK: call i64 @llvm.nvvm.atomic.exch.gen.i.sys.i64.p0 |
| 387 |
// expected-error@+1 {{'__nvvm_atom_sys_xchg_gen_ll' needs target feature sm_60}} |
| 388 |
__nvvm_atom_sys_xchg_gen_ll(&sll, ll); |
| 389 |
|
| 390 |
// CHECK: call i32 @llvm.nvvm.atomic.max.gen.i.cta.i32.p0 |
| 391 |
// expected-error@+1 {{'__nvvm_atom_cta_max_gen_i' needs target feature sm_60}} |
| 392 |
__nvvm_atom_cta_max_gen_i(ip, i); |
| 393 |
// CHECK: call i32 @llvm.nvvm.atomic.max.gen.i.cta.i32.p0 |
| 394 |
// expected-error@+1 {{'__nvvm_atom_cta_max_gen_ui' needs target feature sm_60}} |
| 395 |
__nvvm_atom_cta_max_gen_ui((unsigned int *)ip, i); |
| 396 |
// LP32: call i32 @llvm.nvvm.atomic.max.gen.i.cta.i32.p0 |
| 397 |
// LP64: call i64 @llvm.nvvm.atomic.max.gen.i.cta.i64.p0 |
| 398 |
// expected-error@+1 {{'__nvvm_atom_cta_max_gen_l' needs target feature sm_60}} |
| 399 |
__nvvm_atom_cta_max_gen_l(&dl, l); |
| 400 |
// LP32: call i32 @llvm.nvvm.atomic.max.gen.i.cta.i32.p0 |
| 401 |
// LP64: call i64 @llvm.nvvm.atomic.max.gen.i.cta.i64.p0 |
| 402 |
// expected-error@+1 {{'__nvvm_atom_cta_max_gen_ul' needs target feature sm_60}} |
| 403 |
__nvvm_atom_cta_max_gen_ul((unsigned long *)lp, l); |
| 404 |
// CHECK: call i64 @llvm.nvvm.atomic.max.gen.i.cta.i64.p0 |
| 405 |
// expected-error@+1 {{'__nvvm_atom_cta_max_gen_ll' needs target feature sm_60}} |
| 406 |
__nvvm_atom_cta_max_gen_ll(&sll, ll); |
| 407 |
// CHECK: call i64 @llvm.nvvm.atomic.max.gen.i.cta.i64.p0 |
| 408 |
// expected-error@+1 {{'__nvvm_atom_cta_max_gen_ull' needs target feature sm_60}} |
| 409 |
__nvvm_atom_cta_max_gen_ull((unsigned long long *)llp, ll); |
| 410 |
|
| 411 |
// CHECK: call i32 @llvm.nvvm.atomic.max.gen.i.sys.i32.p0 |
| 412 |
// expected-error@+1 {{'__nvvm_atom_sys_max_gen_i' needs target feature sm_60}} |
| 413 |
__nvvm_atom_sys_max_gen_i(ip, i); |
| 414 |
// CHECK: call i32 @llvm.nvvm.atomic.max.gen.i.sys.i32.p0 |
| 415 |
// expected-error@+1 {{'__nvvm_atom_sys_max_gen_ui' needs target feature sm_60}} |
| 416 |
__nvvm_atom_sys_max_gen_ui((unsigned int *)ip, i); |
| 417 |
// LP32: call i32 @llvm.nvvm.atomic.max.gen.i.sys.i32.p0 |
| 418 |
// LP64: call i64 @llvm.nvvm.atomic.max.gen.i.sys.i64.p0 |
| 419 |
// expected-error@+1 {{'__nvvm_atom_sys_max_gen_l' needs target feature sm_60}} |
| 420 |
__nvvm_atom_sys_max_gen_l(&dl, l); |
| 421 |
// LP32: call i32 @llvm.nvvm.atomic.max.gen.i.sys.i32.p0 |
| 422 |
// LP64: call i64 @llvm.nvvm.atomic.max.gen.i.sys.i64.p0 |
| 423 |
// expected-error@+1 {{'__nvvm_atom_sys_max_gen_ul' needs target feature sm_60}} |
| 424 |
__nvvm_atom_sys_max_gen_ul((unsigned long *)lp, l); |
| 425 |
// CHECK: call i64 @llvm.nvvm.atomic.max.gen.i.sys.i64.p0 |
| 426 |
// expected-error@+1 {{'__nvvm_atom_sys_max_gen_ll' needs target feature sm_60}} |
| 427 |
__nvvm_atom_sys_max_gen_ll(&sll, ll); |
| 428 |
// CHECK: call i64 @llvm.nvvm.atomic.max.gen.i.sys.i64.p0 |
| 429 |
// expected-error@+1 {{'__nvvm_atom_sys_max_gen_ull' needs target feature sm_60}} |
| 430 |
__nvvm_atom_sys_max_gen_ull((unsigned long long *)llp, ll); |
| 431 |
|
| 432 |
// CHECK: call i32 @llvm.nvvm.atomic.min.gen.i.cta.i32.p0 |
| 433 |
// expected-error@+1 {{'__nvvm_atom_cta_min_gen_i' needs target feature sm_60}} |
| 434 |
__nvvm_atom_cta_min_gen_i(ip, i); |
| 435 |
// CHECK: call i32 @llvm.nvvm.atomic.min.gen.i.cta.i32.p0 |
| 436 |
// expected-error@+1 {{'__nvvm_atom_cta_min_gen_ui' needs target feature sm_60}} |
| 437 |
__nvvm_atom_cta_min_gen_ui((unsigned int *)ip, i); |
| 438 |
// LP32: call i32 @llvm.nvvm.atomic.min.gen.i.cta.i32.p0 |
| 439 |
// LP64: call i64 @llvm.nvvm.atomic.min.gen.i.cta.i64.p0 |
| 440 |
// expected-error@+1 {{'__nvvm_atom_cta_min_gen_l' needs target feature sm_60}} |
| 441 |
__nvvm_atom_cta_min_gen_l(&dl, l); |
| 442 |
// LP32: call i32 @llvm.nvvm.atomic.min.gen.i.cta.i32.p0 |
| 443 |
// LP64: call i64 @llvm.nvvm.atomic.min.gen.i.cta.i64.p0 |
| 444 |
// expected-error@+1 {{'__nvvm_atom_cta_min_gen_ul' needs target feature sm_60}} |
| 445 |
__nvvm_atom_cta_min_gen_ul((unsigned long *)lp, l); |
| 446 |
// CHECK: call i64 @llvm.nvvm.atomic.min.gen.i.cta.i64.p0 |
| 447 |
// expected-error@+1 {{'__nvvm_atom_cta_min_gen_ll' needs target feature sm_60}} |
| 448 |
__nvvm_atom_cta_min_gen_ll(&sll, ll); |
| 449 |
// CHECK: call i64 @llvm.nvvm.atomic.min.gen.i.cta.i64.p0 |
| 450 |
// expected-error@+1 {{'__nvvm_atom_cta_min_gen_ull' needs target feature sm_60}} |
| 451 |
__nvvm_atom_cta_min_gen_ull((unsigned long long *)llp, ll); |
| 452 |
|
| 453 |
// CHECK: call i32 @llvm.nvvm.atomic.min.gen.i.sys.i32.p0 |
| 454 |
// expected-error@+1 {{'__nvvm_atom_sys_min_gen_i' needs target feature sm_60}} |
| 455 |
__nvvm_atom_sys_min_gen_i(ip, i); |
| 456 |
// CHECK: call i32 @llvm.nvvm.atomic.min.gen.i.sys.i32.p0 |
| 457 |
// expected-error@+1 {{'__nvvm_atom_sys_min_gen_ui' needs target feature sm_60}} |
| 458 |
__nvvm_atom_sys_min_gen_ui((unsigned int *)ip, i); |
| 459 |
// LP32: call i32 @llvm.nvvm.atomic.min.gen.i.sys.i32.p0 |
| 460 |
// LP64: call i64 @llvm.nvvm.atomic.min.gen.i.sys.i64.p0 |
| 461 |
// expected-error@+1 {{'__nvvm_atom_sys_min_gen_l' needs target feature sm_60}} |
| 462 |
__nvvm_atom_sys_min_gen_l(&dl, l); |
| 463 |
// LP32: call i32 @llvm.nvvm.atomic.min.gen.i.sys.i32.p0 |
| 464 |
// LP64: call i64 @llvm.nvvm.atomic.min.gen.i.sys.i64.p0 |
| 465 |
// expected-error@+1 {{'__nvvm_atom_sys_min_gen_ul' needs target feature sm_60}} |
| 466 |
__nvvm_atom_sys_min_gen_ul((unsigned long *)lp, l); |
| 467 |
// CHECK: call i64 @llvm.nvvm.atomic.min.gen.i.sys.i64.p0 |
| 468 |
// expected-error@+1 {{'__nvvm_atom_sys_min_gen_ll' needs target feature sm_60}} |
| 469 |
__nvvm_atom_sys_min_gen_ll(&sll, ll); |
| 470 |
// CHECK: call i64 @llvm.nvvm.atomic.min.gen.i.sys.i64.p0 |
| 471 |
// expected-error@+1 {{'__nvvm_atom_sys_min_gen_ull' needs target feature sm_60}} |
| 472 |
__nvvm_atom_sys_min_gen_ull((unsigned long long *)llp, ll); |
| 473 |
|
| 474 |
// CHECK: call i32 @llvm.nvvm.atomic.inc.gen.i.cta.i32.p0 |
| 475 |
// expected-error@+1 {{'__nvvm_atom_cta_inc_gen_ui' needs target feature sm_60}} |
| 476 |
__nvvm_atom_cta_inc_gen_ui((unsigned int *)ip, i); |
| 477 |
// CHECK: call i32 @llvm.nvvm.atomic.inc.gen.i.sys.i32.p0 |
| 478 |
// expected-error@+1 {{'__nvvm_atom_sys_inc_gen_ui' needs target feature sm_60}} |
| 479 |
__nvvm_atom_sys_inc_gen_ui((unsigned int *)ip, i); |
| 480 |
|
| 481 |
// CHECK: call i32 @llvm.nvvm.atomic.dec.gen.i.cta.i32.p0 |
| 482 |
// expected-error@+1 {{'__nvvm_atom_cta_dec_gen_ui' needs target feature sm_60}} |
| 483 |
__nvvm_atom_cta_dec_gen_ui((unsigned int *)ip, i); |
| 484 |
// CHECK: call i32 @llvm.nvvm.atomic.dec.gen.i.sys.i32.p0 |
| 485 |
// expected-error@+1 {{'__nvvm_atom_sys_dec_gen_ui' needs target feature sm_60}} |
| 486 |
__nvvm_atom_sys_dec_gen_ui((unsigned int *)ip, i); |
| 487 |
|
| 488 |
// CHECK: call i32 @llvm.nvvm.atomic.and.gen.i.cta.i32.p0 |
| 489 |
// expected-error@+1 {{'__nvvm_atom_cta_and_gen_i' needs target feature sm_60}} |
| 490 |
__nvvm_atom_cta_and_gen_i(ip, i); |
| 491 |
// LP32: call i32 @llvm.nvvm.atomic.and.gen.i.cta.i32.p0 |
| 492 |
// LP64: call i64 @llvm.nvvm.atomic.and.gen.i.cta.i64.p0 |
| 493 |
// expected-error@+1 {{'__nvvm_atom_cta_and_gen_l' needs target feature sm_60}} |
| 494 |
__nvvm_atom_cta_and_gen_l(&dl, l); |
| 495 |
// CHECK: call i64 @llvm.nvvm.atomic.and.gen.i.cta.i64.p0 |
| 496 |
// expected-error@+1 {{'__nvvm_atom_cta_and_gen_ll' needs target feature sm_60}} |
| 497 |
__nvvm_atom_cta_and_gen_ll(&sll, ll); |
| 498 |
|
| 499 |
// CHECK: call i32 @llvm.nvvm.atomic.and.gen.i.sys.i32.p0 |
| 500 |
// expected-error@+1 {{'__nvvm_atom_sys_and_gen_i' needs target feature sm_60}} |
| 501 |
__nvvm_atom_sys_and_gen_i(ip, i); |
| 502 |
// LP32: call i32 @llvm.nvvm.atomic.and.gen.i.sys.i32.p0 |
| 503 |
// LP64: call i64 @llvm.nvvm.atomic.and.gen.i.sys.i64.p0 |
| 504 |
// expected-error@+1 {{'__nvvm_atom_sys_and_gen_l' needs target feature sm_60}} |
| 505 |
__nvvm_atom_sys_and_gen_l(&dl, l); |
| 506 |
// CHECK: call i64 @llvm.nvvm.atomic.and.gen.i.sys.i64.p0 |
| 507 |
// expected-error@+1 {{'__nvvm_atom_sys_and_gen_ll' needs target feature sm_60}} |
| 508 |
__nvvm_atom_sys_and_gen_ll(&sll, ll); |
| 509 |
|
| 510 |
// CHECK: call i32 @llvm.nvvm.atomic.or.gen.i.cta.i32.p0 |
| 511 |
// expected-error@+1 {{'__nvvm_atom_cta_or_gen_i' needs target feature sm_60}} |
| 512 |
__nvvm_atom_cta_or_gen_i(ip, i); |
| 513 |
// LP32: call i32 @llvm.nvvm.atomic.or.gen.i.cta.i32.p0 |
| 514 |
// LP64: call i64 @llvm.nvvm.atomic.or.gen.i.cta.i64.p0 |
| 515 |
// expected-error@+1 {{'__nvvm_atom_cta_or_gen_l' needs target feature sm_60}} |
| 516 |
__nvvm_atom_cta_or_gen_l(&dl, l); |
| 517 |
// CHECK: call i64 @llvm.nvvm.atomic.or.gen.i.cta.i64.p0 |
| 518 |
// expected-error@+1 {{'__nvvm_atom_cta_or_gen_ll' needs target feature sm_60}} |
| 519 |
__nvvm_atom_cta_or_gen_ll(&sll, ll); |
| 520 |
|
| 521 |
// CHECK: call i32 @llvm.nvvm.atomic.or.gen.i.sys.i32.p0 |
| 522 |
// expected-error@+1 {{'__nvvm_atom_sys_or_gen_i' needs target feature sm_60}} |
| 523 |
__nvvm_atom_sys_or_gen_i(ip, i); |
| 524 |
// LP32: call i32 @llvm.nvvm.atomic.or.gen.i.sys.i32.p0 |
| 525 |
// LP64: call i64 @llvm.nvvm.atomic.or.gen.i.sys.i64.p0 |
| 526 |
// expected-error@+1 {{'__nvvm_atom_sys_or_gen_l' needs target feature sm_60}} |
| 527 |
__nvvm_atom_sys_or_gen_l(&dl, l); |
| 528 |
// CHECK: call i64 @llvm.nvvm.atomic.or.gen.i.sys.i64.p0 |
| 529 |
// expected-error@+1 {{'__nvvm_atom_sys_or_gen_ll' needs target feature sm_60}} |
| 530 |
__nvvm_atom_sys_or_gen_ll(&sll, ll); |
| 531 |
|
| 532 |
// CHECK: call i32 @llvm.nvvm.atomic.xor.gen.i.cta.i32.p0 |
| 533 |
// expected-error@+1 {{'__nvvm_atom_cta_xor_gen_i' needs target feature sm_60}} |
| 534 |
__nvvm_atom_cta_xor_gen_i(ip, i); |
| 535 |
// LP32: call i32 @llvm.nvvm.atomic.xor.gen.i.cta.i32.p0 |
| 536 |
// LP64: call i64 @llvm.nvvm.atomic.xor.gen.i.cta.i64.p0 |
| 537 |
// expected-error@+1 {{'__nvvm_atom_cta_xor_gen_l' needs target feature sm_60}} |
| 538 |
__nvvm_atom_cta_xor_gen_l(&dl, l); |
| 539 |
// CHECK: call i64 @llvm.nvvm.atomic.xor.gen.i.cta.i64.p0 |
| 540 |
// expected-error@+1 {{'__nvvm_atom_cta_xor_gen_ll' needs target feature sm_60}} |
| 541 |
__nvvm_atom_cta_xor_gen_ll(&sll, ll); |
| 542 |
|
| 543 |
// CHECK: call i32 @llvm.nvvm.atomic.xor.gen.i.sys.i32.p0 |
| 544 |
// expected-error@+1 {{'__nvvm_atom_sys_xor_gen_i' needs target feature sm_60}} |
| 545 |
__nvvm_atom_sys_xor_gen_i(ip, i); |
| 546 |
// LP32: call i32 @llvm.nvvm.atomic.xor.gen.i.sys.i32.p0 |
| 547 |
// LP64: call i64 @llvm.nvvm.atomic.xor.gen.i.sys.i64.p0 |
| 548 |
// expected-error@+1 {{'__nvvm_atom_sys_xor_gen_l' needs target feature sm_60}} |
| 549 |
__nvvm_atom_sys_xor_gen_l(&dl, l); |
| 550 |
// CHECK: call i64 @llvm.nvvm.atomic.xor.gen.i.sys.i64.p0 |
| 551 |
// expected-error@+1 {{'__nvvm_atom_sys_xor_gen_ll' needs target feature sm_60}} |
| 552 |
__nvvm_atom_sys_xor_gen_ll(&sll, ll); |
| 553 |
|
| 554 |
// CHECK: call i32 @llvm.nvvm.atomic.cas.gen.i.cta.i32.p0 |
| 555 |
// expected-error@+1 {{'__nvvm_atom_cta_cas_gen_i' needs target feature sm_60}} |
| 556 |
__nvvm_atom_cta_cas_gen_i(ip, i, 0); |
| 557 |
// LP32: call i32 @llvm.nvvm.atomic.cas.gen.i.cta.i32.p0 |
| 558 |
// LP64: call i64 @llvm.nvvm.atomic.cas.gen.i.cta.i64.p0 |
| 559 |
// expected-error@+1 {{'__nvvm_atom_cta_cas_gen_l' needs target feature sm_60}} |
| 560 |
__nvvm_atom_cta_cas_gen_l(&dl, l, 0); |
| 561 |
// CHECK: call i64 @llvm.nvvm.atomic.cas.gen.i.cta.i64.p0 |
| 562 |
// expected-error@+1 {{'__nvvm_atom_cta_cas_gen_ll' needs target feature sm_60}} |
| 563 |
__nvvm_atom_cta_cas_gen_ll(&sll, ll, 0); |
| 564 |
|
| 565 |
// CHECK: call i32 @llvm.nvvm.atomic.cas.gen.i.sys.i32.p0 |
| 566 |
// expected-error@+1 {{'__nvvm_atom_sys_cas_gen_i' needs target feature sm_60}} |
| 567 |
__nvvm_atom_sys_cas_gen_i(ip, i, 0); |
| 568 |
// LP32: call i32 @llvm.nvvm.atomic.cas.gen.i.sys.i32.p0 |
| 569 |
// LP64: call i64 @llvm.nvvm.atomic.cas.gen.i.sys.i64.p0 |
| 570 |
// expected-error@+1 {{'__nvvm_atom_sys_cas_gen_l' needs target feature sm_60}} |
| 571 |
__nvvm_atom_sys_cas_gen_l(&dl, l, 0); |
| 572 |
// CHECK: call i64 @llvm.nvvm.atomic.cas.gen.i.sys.i64.p0 |
| 573 |
// expected-error@+1 {{'__nvvm_atom_sys_cas_gen_ll' needs target feature sm_60}} |
| 574 |
__nvvm_atom_sys_cas_gen_ll(&sll, ll, 0); |
| 575 |
#endif |
| 576 |
|
| 577 |
// CHECK: ret |
| 578 |
} |
| 579 |
|
| 580 |
// CHECK-LABEL: nvvm_ldg |
| 581 |
__device__ void nvvm_ldg(const void *p) { |
| 582 |
// CHECK: call i8 @llvm.nvvm.ldg.global.i.i8.p0(ptr {{%[0-9]+}}, i32 1) |
| 583 |
// CHECK: call i8 @llvm.nvvm.ldg.global.i.i8.p0(ptr {{%[0-9]+}}, i32 1) |
| 584 |
// CHECK: call i8 @llvm.nvvm.ldg.global.i.i8.p0(ptr {{%[0-9]+}}, i32 1) |
| 585 |
__nvvm_ldg_c((const char *)p); |
| 586 |
__nvvm_ldg_uc((const unsigned char *)p); |
| 587 |
__nvvm_ldg_sc((const signed char *)p); |
| 588 |
|
| 589 |
// CHECK: call i16 @llvm.nvvm.ldg.global.i.i16.p0(ptr {{%[0-9]+}}, i32 2) |
| 590 |
// CHECK: call i16 @llvm.nvvm.ldg.global.i.i16.p0(ptr {{%[0-9]+}}, i32 2) |
| 591 |
__nvvm_ldg_s((const short *)p); |
| 592 |
__nvvm_ldg_us((const unsigned short *)p); |
| 593 |
|
| 594 |
// CHECK: call i32 @llvm.nvvm.ldg.global.i.i32.p0(ptr {{%[0-9]+}}, i32 4) |
| 595 |
// CHECK: call i32 @llvm.nvvm.ldg.global.i.i32.p0(ptr {{%[0-9]+}}, i32 4) |
| 596 |
__nvvm_ldg_i((const int *)p); |
| 597 |
__nvvm_ldg_ui((const unsigned int *)p); |
| 598 |
|
| 599 |
// LP32: call i32 @llvm.nvvm.ldg.global.i.i32.p0(ptr {{%[0-9]+}}, i32 4) |
| 600 |
// LP32: call i32 @llvm.nvvm.ldg.global.i.i32.p0(ptr {{%[0-9]+}}, i32 4) |
| 601 |
// LP64: call i64 @llvm.nvvm.ldg.global.i.i64.p0(ptr {{%[0-9]+}}, i32 8) |
| 602 |
// LP64: call i64 @llvm.nvvm.ldg.global.i.i64.p0(ptr {{%[0-9]+}}, i32 8) |
| 603 |
__nvvm_ldg_l((const long *)p); |
| 604 |
__nvvm_ldg_ul((const unsigned long *)p); |
| 605 |
|
| 606 |
// CHECK: call float @llvm.nvvm.ldg.global.f.f32.p0(ptr {{%[0-9]+}}, i32 4) |
| 607 |
__nvvm_ldg_f((const float *)p); |
| 608 |
// CHECK: call double @llvm.nvvm.ldg.global.f.f64.p0(ptr {{%[0-9]+}}, i32 8) |
| 609 |
__nvvm_ldg_d((const double *)p); |
| 610 |
|
| 611 |
// In practice, the pointers we pass to __ldg will be aligned as appropriate |
| 612 |
// for the CUDA <type>N vector types (e.g. short4), which are not the same as |
| 613 |
// the LLVM vector types. However, each LLVM vector type has an alignment |
| 614 |
// less than or equal to its corresponding CUDA type, so we're OK. |
| 615 |
// |
| 616 |
// PTX Interoperability section 2.2: "For a vector with an even number of |
| 617 |
// elements, its alignment is set to number of elements times the alignment of |
| 618 |
// its member: n*alignof(t)." |
| 619 |
|
| 620 |
// CHECK: call <2 x i8> @llvm.nvvm.ldg.global.i.v2i8.p0(ptr {{%[0-9]+}}, i32 2) |
| 621 |
// CHECK: call <2 x i8> @llvm.nvvm.ldg.global.i.v2i8.p0(ptr {{%[0-9]+}}, i32 2) |
| 622 |
// CHECK: call <2 x i8> @llvm.nvvm.ldg.global.i.v2i8.p0(ptr {{%[0-9]+}}, i32 2) |
| 623 |
typedef char char2 __attribute__((ext_vector_type(2))); |
| 624 |
typedef unsigned char uchar2 __attribute__((ext_vector_type(2))); |
| 625 |
typedef signed char schar2 __attribute__((ext_vector_type(2))); |
| 626 |
__nvvm_ldg_c2((const char2 *)p); |
| 627 |
__nvvm_ldg_uc2((const uchar2 *)p); |
| 628 |
__nvvm_ldg_sc2((const schar2 *)p); |
| 629 |
|
| 630 |
// CHECK: call <4 x i8> @llvm.nvvm.ldg.global.i.v4i8.p0(ptr {{%[0-9]+}}, i32 4) |
| 631 |
// CHECK: call <4 x i8> @llvm.nvvm.ldg.global.i.v4i8.p0(ptr {{%[0-9]+}}, i32 4) |
| 632 |
// CHECK: call <4 x i8> @llvm.nvvm.ldg.global.i.v4i8.p0(ptr {{%[0-9]+}}, i32 4) |
| 633 |
typedef char char4 __attribute__((ext_vector_type(4))); |
| 634 |
typedef unsigned char uchar4 __attribute__((ext_vector_type(4))); |
| 635 |
typedef signed char schar4 __attribute__((ext_vector_type(4))); |
| 636 |
__nvvm_ldg_c4((const char4 *)p); |
| 637 |
__nvvm_ldg_uc4((const uchar4 *)p); |
| 638 |
__nvvm_ldg_sc4((const schar4 *)p); |
| 639 |
|
| 640 |
// CHECK: call <2 x i16> @llvm.nvvm.ldg.global.i.v2i16.p0(ptr {{%[0-9]+}}, i32 4) |
| 641 |
// CHECK: call <2 x i16> @llvm.nvvm.ldg.global.i.v2i16.p0(ptr {{%[0-9]+}}, i32 4) |
| 642 |
typedef short short2 __attribute__((ext_vector_type(2))); |
| 643 |
typedef unsigned short ushort2 __attribute__((ext_vector_type(2))); |
| 644 |
__nvvm_ldg_s2((const short2 *)p); |
| 645 |
__nvvm_ldg_us2((const ushort2 *)p); |
| 646 |
|
| 647 |
// CHECK: call <4 x i16> @llvm.nvvm.ldg.global.i.v4i16.p0(ptr {{%[0-9]+}}, i32 8) |
| 648 |
// CHECK: call <4 x i16> @llvm.nvvm.ldg.global.i.v4i16.p0(ptr {{%[0-9]+}}, i32 8) |
| 649 |
typedef short short4 __attribute__((ext_vector_type(4))); |
| 650 |
typedef unsigned short ushort4 __attribute__((ext_vector_type(4))); |
| 651 |
__nvvm_ldg_s4((const short4 *)p); |
| 652 |
__nvvm_ldg_us4((const ushort4 *)p); |
| 653 |
|
| 654 |
// CHECK: call <2 x i32> @llvm.nvvm.ldg.global.i.v2i32.p0(ptr {{%[0-9]+}}, i32 8) |
| 655 |
// CHECK: call <2 x i32> @llvm.nvvm.ldg.global.i.v2i32.p0(ptr {{%[0-9]+}}, i32 8) |
| 656 |
typedef int int2 __attribute__((ext_vector_type(2))); |
| 657 |
typedef unsigned int uint2 __attribute__((ext_vector_type(2))); |
| 658 |
__nvvm_ldg_i2((const int2 *)p); |
| 659 |
__nvvm_ldg_ui2((const uint2 *)p); |
| 660 |
|
| 661 |
// CHECK: call <4 x i32> @llvm.nvvm.ldg.global.i.v4i32.p0(ptr {{%[0-9]+}}, i32 16) |
| 662 |
// CHECK: call <4 x i32> @llvm.nvvm.ldg.global.i.v4i32.p0(ptr {{%[0-9]+}}, i32 16) |
| 663 |
typedef int int4 __attribute__((ext_vector_type(4))); |
| 664 |
typedef unsigned int uint4 __attribute__((ext_vector_type(4))); |
| 665 |
__nvvm_ldg_i4((const int4 *)p); |
| 666 |
__nvvm_ldg_ui4((const uint4 *)p); |
| 667 |
|
| 668 |
// LP32: call <2 x i32> @llvm.nvvm.ldg.global.i.v2i32.p0(ptr {{%[0-9]+}}, i32 8) |
| 669 |
// LP32: call <2 x i32> @llvm.nvvm.ldg.global.i.v2i32.p0(ptr {{%[0-9]+}}, i32 8) |
| 670 |
// LP64: call <2 x i64> @llvm.nvvm.ldg.global.i.v2i64.p0(ptr {{%[0-9]+}}, i32 16) |
| 671 |
// LP64: call <2 x i64> @llvm.nvvm.ldg.global.i.v2i64.p0(ptr {{%[0-9]+}}, i32 16) |
| 672 |
typedef long long2 __attribute__((ext_vector_type(2))); |
| 673 |
typedef unsigned long ulong2 __attribute__((ext_vector_type(2))); |
| 674 |
__nvvm_ldg_l2((const long2 *)p); |
| 675 |
__nvvm_ldg_ul2((const ulong2 *)p); |
| 676 |
|
| 677 |
// CHECK: call <2 x i64> @llvm.nvvm.ldg.global.i.v2i64.p0(ptr {{%[0-9]+}}, i32 16) |
| 678 |
// CHECK: call <2 x i64> @llvm.nvvm.ldg.global.i.v2i64.p0(ptr {{%[0-9]+}}, i32 16) |
| 679 |
typedef long long longlong2 __attribute__((ext_vector_type(2))); |
| 680 |
typedef unsigned long long ulonglong2 __attribute__((ext_vector_type(2))); |
| 681 |
__nvvm_ldg_ll2((const longlong2 *)p); |
| 682 |
__nvvm_ldg_ull2((const ulonglong2 *)p); |
| 683 |
|
| 684 |
// CHECK: call <2 x float> @llvm.nvvm.ldg.global.f.v2f32.p0(ptr {{%[0-9]+}}, i32 8) |
| 685 |
typedef float float2 __attribute__((ext_vector_type(2))); |
| 686 |
__nvvm_ldg_f2((const float2 *)p); |
| 687 |
|
| 688 |
// CHECK: call <4 x float> @llvm.nvvm.ldg.global.f.v4f32.p0(ptr {{%[0-9]+}}, i32 16) |
| 689 |
typedef float float4 __attribute__((ext_vector_type(4))); |
| 690 |
__nvvm_ldg_f4((const float4 *)p); |
| 691 |
|
| 692 |
// CHECK: call <2 x double> @llvm.nvvm.ldg.global.f.v2f64.p0(ptr {{%[0-9]+}}, i32 16) |
| 693 |
typedef double double2 __attribute__((ext_vector_type(2))); |
| 694 |
__nvvm_ldg_d2((const double2 *)p); |
| 695 |
} |
| 696 |
|
| 697 |
// CHECK-LABEL: nvvm_ldu |
| 698 |
__device__ void nvvm_ldu(const void *p) { |
| 699 |
// CHECK: call i8 @llvm.nvvm.ldu.global.i.i8.p0(ptr {{%[0-9]+}}, i32 1) |
| 700 |
// CHECK: call i8 @llvm.nvvm.ldu.global.i.i8.p0(ptr {{%[0-9]+}}, i32 1) |
| 701 |
// CHECK: call i8 @llvm.nvvm.ldu.global.i.i8.p0(ptr {{%[0-9]+}}, i32 1) |
| 702 |
__nvvm_ldu_c((const char *)p); |
| 703 |
__nvvm_ldu_uc((const unsigned char *)p); |
| 704 |
__nvvm_ldu_sc((const signed char *)p); |
| 705 |
|
| 706 |
// CHECK: call i16 @llvm.nvvm.ldu.global.i.i16.p0(ptr {{%[0-9]+}}, i32 2) |
| 707 |
// CHECK: call i16 @llvm.nvvm.ldu.global.i.i16.p0(ptr {{%[0-9]+}}, i32 2) |
| 708 |
__nvvm_ldu_s((const short *)p); |
| 709 |
__nvvm_ldu_us((const unsigned short *)p); |
| 710 |
|
| 711 |
// CHECK: call i32 @llvm.nvvm.ldu.global.i.i32.p0(ptr {{%[0-9]+}}, i32 4) |
| 712 |
// CHECK: call i32 @llvm.nvvm.ldu.global.i.i32.p0(ptr {{%[0-9]+}}, i32 4) |
| 713 |
__nvvm_ldu_i((const int *)p); |
| 714 |
__nvvm_ldu_ui((const unsigned int *)p); |
| 715 |
|
| 716 |
// LP32: call i32 @llvm.nvvm.ldu.global.i.i32.p0(ptr {{%[0-9]+}}, i32 4) |
| 717 |
// LP32: call i32 @llvm.nvvm.ldu.global.i.i32.p0(ptr {{%[0-9]+}}, i32 4) |
| 718 |
// LP64: call i64 @llvm.nvvm.ldu.global.i.i64.p0(ptr {{%[0-9]+}}, i32 8) |
| 719 |
// LP64: call i64 @llvm.nvvm.ldu.global.i.i64.p0(ptr {{%[0-9]+}}, i32 8) |
| 720 |
__nvvm_ldu_l((const long *)p); |
| 721 |
__nvvm_ldu_ul((const unsigned long *)p); |
| 722 |
|
| 723 |
// CHECK: call float @llvm.nvvm.ldu.global.f.f32.p0(ptr {{%[0-9]+}}, i32 4) |
| 724 |
__nvvm_ldu_f((const float *)p); |
| 725 |
// CHECK: call double @llvm.nvvm.ldu.global.f.f64.p0(ptr {{%[0-9]+}}, i32 8) |
| 726 |
__nvvm_ldu_d((const double *)p); |
| 727 |
|
| 728 |
// CHECK: call <2 x i8> @llvm.nvvm.ldu.global.i.v2i8.p0(ptr {{%[0-9]+}}, i32 2) |
| 729 |
// CHECK: call <2 x i8> @llvm.nvvm.ldu.global.i.v2i8.p0(ptr {{%[0-9]+}}, i32 2) |
| 730 |
// CHECK: call <2 x i8> @llvm.nvvm.ldu.global.i.v2i8.p0(ptr {{%[0-9]+}}, i32 2) |
| 731 |
typedef char char2 __attribute__((ext_vector_type(2))); |
| 732 |
typedef unsigned char uchar2 __attribute__((ext_vector_type(2))); |
| 733 |
typedef signed char schar2 __attribute__((ext_vector_type(2))); |
| 734 |
__nvvm_ldu_c2((const char2 *)p); |
| 735 |
__nvvm_ldu_uc2((const uchar2 *)p); |
| 736 |
__nvvm_ldu_sc2((const schar2 *)p); |
| 737 |
|
| 738 |
// CHECK: call <4 x i8> @llvm.nvvm.ldu.global.i.v4i8.p0(ptr {{%[0-9]+}}, i32 4) |
| 739 |
// CHECK: call <4 x i8> @llvm.nvvm.ldu.global.i.v4i8.p0(ptr {{%[0-9]+}}, i32 4) |
| 740 |
// CHECK: call <4 x i8> @llvm.nvvm.ldu.global.i.v4i8.p0(ptr {{%[0-9]+}}, i32 4) |
| 741 |
typedef char char4 __attribute__((ext_vector_type(4))); |
| 742 |
typedef unsigned char uchar4 __attribute__((ext_vector_type(4))); |
| 743 |
typedef signed char schar4 __attribute__((ext_vector_type(4))); |
| 744 |
__nvvm_ldu_c4((const char4 *)p); |
| 745 |
__nvvm_ldu_uc4((const uchar4 *)p); |
| 746 |
__nvvm_ldu_sc4((const schar4 *)p); |
| 747 |
|
| 748 |
// CHECK: call <2 x i16> @llvm.nvvm.ldu.global.i.v2i16.p0(ptr {{%[0-9]+}}, i32 4) |
| 749 |
// CHECK: call <2 x i16> @llvm.nvvm.ldu.global.i.v2i16.p0(ptr {{%[0-9]+}}, i32 4) |
| 750 |
typedef short short2 __attribute__((ext_vector_type(2))); |
| 751 |
typedef unsigned short ushort2 __attribute__((ext_vector_type(2))); |
| 752 |
__nvvm_ldu_s2((const short2 *)p); |
| 753 |
__nvvm_ldu_us2((const ushort2 *)p); |
| 754 |
|
| 755 |
// CHECK: call <4 x i16> @llvm.nvvm.ldu.global.i.v4i16.p0(ptr {{%[0-9]+}}, i32 8) |
| 756 |
// CHECK: call <4 x i16> @llvm.nvvm.ldu.global.i.v4i16.p0(ptr {{%[0-9]+}}, i32 8) |
| 757 |
typedef short short4 __attribute__((ext_vector_type(4))); |
| 758 |
typedef unsigned short ushort4 __attribute__((ext_vector_type(4))); |
| 759 |
__nvvm_ldu_s4((const short4 *)p); |
| 760 |
__nvvm_ldu_us4((const ushort4 *)p); |
| 761 |
|
| 762 |
// CHECK: call <2 x i32> @llvm.nvvm.ldu.global.i.v2i32.p0(ptr {{%[0-9]+}}, i32 8) |
| 763 |
// CHECK: call <2 x i32> @llvm.nvvm.ldu.global.i.v2i32.p0(ptr {{%[0-9]+}}, i32 8) |
| 764 |
typedef int int2 __attribute__((ext_vector_type(2))); |
| 765 |
typedef unsigned int uint2 __attribute__((ext_vector_type(2))); |
| 766 |
__nvvm_ldu_i2((const int2 *)p); |
| 767 |
__nvvm_ldu_ui2((const uint2 *)p); |
| 768 |
|
| 769 |
// CHECK: call <4 x i32> @llvm.nvvm.ldu.global.i.v4i32.p0(ptr {{%[0-9]+}}, i32 16) |
| 770 |
// CHECK: call <4 x i32> @llvm.nvvm.ldu.global.i.v4i32.p0(ptr {{%[0-9]+}}, i32 16) |
| 771 |
typedef int int4 __attribute__((ext_vector_type(4))); |
| 772 |
typedef unsigned int uint4 __attribute__((ext_vector_type(4))); |
| 773 |
__nvvm_ldu_i4((const int4 *)p); |
| 774 |
__nvvm_ldu_ui4((const uint4 *)p); |
| 775 |
|
| 776 |
// LP32: call <2 x i32> @llvm.nvvm.ldu.global.i.v2i32.p0(ptr {{%[0-9]+}}, i32 8) |
| 777 |
// LP32: call <2 x i32> @llvm.nvvm.ldu.global.i.v2i32.p0(ptr {{%[0-9]+}}, i32 8) |
| 778 |
// LP64: call <2 x i64> @llvm.nvvm.ldu.global.i.v2i64.p0(ptr {{%[0-9]+}}, i32 16) |
| 779 |
// LP64: call <2 x i64> @llvm.nvvm.ldu.global.i.v2i64.p0(ptr {{%[0-9]+}}, i32 16) |
| 780 |
typedef long long2 __attribute__((ext_vector_type(2))); |
| 781 |
typedef unsigned long ulong2 __attribute__((ext_vector_type(2))); |
| 782 |
__nvvm_ldu_l2((const long2 *)p); |
| 783 |
__nvvm_ldu_ul2((const ulong2 *)p); |
| 784 |
|
| 785 |
// CHECK: call <2 x i64> @llvm.nvvm.ldu.global.i.v2i64.p0(ptr {{%[0-9]+}}, i32 16) |
| 786 |
// CHECK: call <2 x i64> @llvm.nvvm.ldu.global.i.v2i64.p0(ptr {{%[0-9]+}}, i32 16) |
| 787 |
typedef long long longlong2 __attribute__((ext_vector_type(2))); |
| 788 |
typedef unsigned long long ulonglong2 __attribute__((ext_vector_type(2))); |
| 789 |
__nvvm_ldu_ll2((const longlong2 *)p); |
| 790 |
__nvvm_ldu_ull2((const ulonglong2 *)p); |
| 791 |
|
| 792 |
// CHECK: call <2 x float> @llvm.nvvm.ldu.global.f.v2f32.p0(ptr {{%[0-9]+}}, i32 8) |
| 793 |
typedef float float2 __attribute__((ext_vector_type(2))); |
| 794 |
__nvvm_ldu_f2((const float2 *)p); |
| 795 |
|
| 796 |
// CHECK: call <4 x float> @llvm.nvvm.ldu.global.f.v4f32.p0(ptr {{%[0-9]+}}, i32 16) |
| 797 |
typedef float float4 __attribute__((ext_vector_type(4))); |
| 798 |
__nvvm_ldu_f4((const float4 *)p); |
| 799 |
|
| 800 |
// CHECK: call <2 x double> @llvm.nvvm.ldu.global.f.v2f64.p0(ptr {{%[0-9]+}}, i32 16) |
| 801 |
typedef double double2 __attribute__((ext_vector_type(2))); |
| 802 |
__nvvm_ldu_d2((const double2 *)p); |
| 803 |
} |
| 804 |
|
| 805 |
// CHECK-LABEL: nvvm_shfl |
| 806 |
__device__ void nvvm_shfl(int i, float f, int a, int b) { |
| 807 |
// CHECK: call i32 @llvm.nvvm.shfl.down.i32(i32 |
| 808 |
__nvvm_shfl_down_i32(i, a, b); |
| 809 |
// CHECK: call float @llvm.nvvm.shfl.down.f32(float |
| 810 |
__nvvm_shfl_down_f32(f, a, b); |
| 811 |
// CHECK: call i32 @llvm.nvvm.shfl.up.i32(i32 |
| 812 |
__nvvm_shfl_up_i32(i, a, b); |
| 813 |
// CHECK: call float @llvm.nvvm.shfl.up.f32(float |
| 814 |
__nvvm_shfl_up_f32(f, a, b); |
| 815 |
// CHECK: call i32 @llvm.nvvm.shfl.bfly.i32(i32 |
| 816 |
__nvvm_shfl_bfly_i32(i, a, b); |
| 817 |
// CHECK: call float @llvm.nvvm.shfl.bfly.f32(float |
| 818 |
__nvvm_shfl_bfly_f32(f, a, b); |
| 819 |
// CHECK: call i32 @llvm.nvvm.shfl.idx.i32(i32 |
| 820 |
__nvvm_shfl_idx_i32(i, a, b); |
| 821 |
// CHECK: call float @llvm.nvvm.shfl.idx.f32(float |
| 822 |
__nvvm_shfl_idx_f32(f, a, b); |
| 823 |
// CHECK: ret void |
| 824 |
} |
| 825 |
|
| 826 |
__device__ void nvvm_vote(int pred) { |
| 827 |
// CHECK: call i1 @llvm.nvvm.vote.all(i1 |
| 828 |
__nvvm_vote_all(pred); |
| 829 |
// CHECK: call i1 @llvm.nvvm.vote.any(i1 |
| 830 |
__nvvm_vote_any(pred); |
| 831 |
// CHECK: call i1 @llvm.nvvm.vote.uni(i1 |
| 832 |
__nvvm_vote_uni(pred); |
| 833 |
// CHECK: call i32 @llvm.nvvm.vote.ballot(i1 |
| 834 |
__nvvm_vote_ballot(pred); |
| 835 |
// CHECK: ret void |
| 836 |
} |
| 837 |
|
| 838 |
// CHECK-LABEL: nvvm_nanosleep |
| 839 |
__device__ void nvvm_nanosleep(int d) { |
| 840 |
#if __CUDA_ARCH__ >= 700 |
| 841 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.nanosleep |
| 842 |
__nvvm_nanosleep(d); |
| 843 |
|
| 844 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.nanosleep |
| 845 |
__nvvm_nanosleep(1); |
| 846 |
#endif |
| 847 |
} |
| 848 |
|
| 849 |
// CHECK-LABEL: nvvm_mbarrier |
| 850 |
__device__ void nvvm_mbarrier(long long* addr, __attribute__((address_space(3))) long long* sharedAddr, int count, long long state) { |
| 851 |
#if __CUDA_ARCH__ >= 800 |
| 852 |
__nvvm_mbarrier_init(addr, count); |
| 853 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.mbarrier.init |
| 854 |
__nvvm_mbarrier_init_shared(sharedAddr, count); |
| 855 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.mbarrier.init.shared |
| 856 |
|
| 857 |
__nvvm_mbarrier_inval(addr); |
| 858 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.mbarrier.inval |
| 859 |
__nvvm_mbarrier_inval_shared(sharedAddr); |
| 860 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.mbarrier.inval.shared |
| 861 |
|
| 862 |
__nvvm_mbarrier_arrive(addr); |
| 863 |
// CHECK_PTX70_SM80: call i64 @llvm.nvvm.mbarrier.arrive |
| 864 |
__nvvm_mbarrier_arrive_shared(sharedAddr); |
| 865 |
// CHECK_PTX70_SM80: call i64 @llvm.nvvm.mbarrier.arrive.shared |
| 866 |
__nvvm_mbarrier_arrive_noComplete(addr, count); |
| 867 |
// CHECK_PTX70_SM80: call i64 @llvm.nvvm.mbarrier.arrive.noComplete |
| 868 |
__nvvm_mbarrier_arrive_noComplete_shared(sharedAddr, count); |
| 869 |
// CHECK_PTX70_SM80: call i64 @llvm.nvvm.mbarrier.arrive.noComplete.shared |
| 870 |
|
| 871 |
__nvvm_mbarrier_arrive_drop(addr); |
| 872 |
// CHECK_PTX70_SM80: call i64 @llvm.nvvm.mbarrier.arrive.drop |
| 873 |
__nvvm_mbarrier_arrive_drop_shared(sharedAddr); |
| 874 |
// CHECK_PTX70_SM80: call i64 @llvm.nvvm.mbarrier.arrive.drop.shared |
| 875 |
__nvvm_mbarrier_arrive_drop_noComplete(addr, count); |
| 876 |
// CHECK_PTX70_SM80: call i64 @llvm.nvvm.mbarrier.arrive.drop.noComplete |
| 877 |
__nvvm_mbarrier_arrive_drop_noComplete_shared(sharedAddr, count); |
| 878 |
// CHECK_PTX70_SM80: call i64 @llvm.nvvm.mbarrier.arrive.drop.noComplete.shared |
| 879 |
|
| 880 |
__nvvm_mbarrier_test_wait(addr, state); |
| 881 |
// CHECK_PTX70_SM80: call i1 @llvm.nvvm.mbarrier.test.wait |
| 882 |
__nvvm_mbarrier_test_wait_shared(sharedAddr, state); |
| 883 |
// CHECK_PTX70_SM80: call i1 @llvm.nvvm.mbarrier.test.wait.shared |
| 884 |
|
| 885 |
__nvvm_mbarrier_pending_count(state); |
| 886 |
// CHECK_PTX70_SM80: call i32 @llvm.nvvm.mbarrier.pending.count |
| 887 |
#endif |
| 888 |
// CHECK: ret void |
| 889 |
} |
| 890 |
|
| 891 |
// CHECK-LABEL: nvvm_async_copy |
| 892 |
__device__ void nvvm_async_copy(__attribute__((address_space(3))) void* dst, __attribute__((address_space(1))) const void* src, long long* addr, __attribute__((address_space(3))) long long* sharedAddr) { |
| 893 |
#if __CUDA_ARCH__ >= 800 |
| 894 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.mbarrier.arrive |
| 895 |
__nvvm_cp_async_mbarrier_arrive(addr); |
| 896 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.mbarrier.arrive.shared |
| 897 |
__nvvm_cp_async_mbarrier_arrive_shared(sharedAddr); |
| 898 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.mbarrier.arrive.noinc |
| 899 |
__nvvm_cp_async_mbarrier_arrive_noinc(addr); |
| 900 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.mbarrier.arrive.noinc.shared |
| 901 |
__nvvm_cp_async_mbarrier_arrive_noinc_shared(sharedAddr); |
| 902 |
|
| 903 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.ca.shared.global.4( |
| 904 |
__nvvm_cp_async_ca_shared_global_4(dst, src); |
| 905 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.ca.shared.global.8( |
| 906 |
__nvvm_cp_async_ca_shared_global_8(dst, src); |
| 907 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.ca.shared.global.16( |
| 908 |
__nvvm_cp_async_ca_shared_global_16(dst, src); |
| 909 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.cg.shared.global.16( |
| 910 |
__nvvm_cp_async_cg_shared_global_16(dst, src); |
| 911 |
|
| 912 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.ca.shared.global.4.s({{.*}}, i32 2) |
| 913 |
__nvvm_cp_async_ca_shared_global_4(dst, src, 2); |
| 914 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.ca.shared.global.8.s({{.*}}, i32 2) |
| 915 |
__nvvm_cp_async_ca_shared_global_8(dst, src, 2); |
| 916 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.ca.shared.global.16.s({{.*}}, i32 2) |
| 917 |
__nvvm_cp_async_ca_shared_global_16(dst, src, 2); |
| 918 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.cg.shared.global.16.s({{.*}}, i32 2) |
| 919 |
__nvvm_cp_async_cg_shared_global_16(dst, src, 2); |
| 920 |
|
| 921 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.commit.group |
| 922 |
__nvvm_cp_async_commit_group(); |
| 923 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.wait.group(i32 0) |
| 924 |
__nvvm_cp_async_wait_group(0); |
| 925 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.wait.group(i32 8) |
| 926 |
__nvvm_cp_async_wait_group(8); |
| 927 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.wait.group(i32 16) |
| 928 |
__nvvm_cp_async_wait_group(16); |
| 929 |
// CHECK_PTX70_SM80: call void @llvm.nvvm.cp.async.wait.all |
| 930 |
__nvvm_cp_async_wait_all(); |
| 931 |
#endif |
| 932 |
// CHECK: ret void |
| 933 |
} |
| 934 |
|
| 935 |
// CHECK-LABEL: nvvm_cvt_sm80 |
| 936 |
__device__ void nvvm_cvt_sm80() { |
| 937 |
#if __CUDA_ARCH__ >= 800 |
| 938 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.ff2bf16x2.rn(float 1.000000e+00, float 1.000000e+00) |
| 939 |
__nvvm_ff2bf16x2_rn(1, 1); |
| 940 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.ff2bf16x2.rn.relu(float 1.000000e+00, float 1.000000e+00) |
| 941 |
__nvvm_ff2bf16x2_rn_relu(1, 1); |
| 942 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.ff2bf16x2.rz(float 1.000000e+00, float 1.000000e+00) |
| 943 |
__nvvm_ff2bf16x2_rz(1, 1); |
| 944 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.ff2bf16x2.rz.relu(float 1.000000e+00, float 1.000000e+00) |
| 945 |
__nvvm_ff2bf16x2_rz_relu(1, 1); |
| 946 |
|
| 947 |
// CHECK_PTX70_SM80: call <2 x half> @llvm.nvvm.ff2f16x2.rn(float 1.000000e+00, float 1.000000e+00) |
| 948 |
__nvvm_ff2f16x2_rn(1, 1); |
| 949 |
// CHECK_PTX70_SM80: call <2 x half> @llvm.nvvm.ff2f16x2.rn.relu(float 1.000000e+00, float 1.000000e+00) |
| 950 |
__nvvm_ff2f16x2_rn_relu(1, 1); |
| 951 |
// CHECK_PTX70_SM80: call <2 x half> @llvm.nvvm.ff2f16x2.rz(float 1.000000e+00, float 1.000000e+00) |
| 952 |
__nvvm_ff2f16x2_rz(1, 1); |
| 953 |
// CHECK_PTX70_SM80: call <2 x half> @llvm.nvvm.ff2f16x2.rz.relu(float 1.000000e+00, float 1.000000e+00) |
| 954 |
__nvvm_ff2f16x2_rz_relu(1, 1); |
| 955 |
|
| 956 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.f2bf16.rn(float 1.000000e+00) |
| 957 |
__nvvm_f2bf16_rn(1); |
| 958 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.f2bf16.rn.relu(float 1.000000e+00) |
| 959 |
__nvvm_f2bf16_rn_relu(1); |
| 960 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.f2bf16.rz(float 1.000000e+00) |
| 961 |
__nvvm_f2bf16_rz(1); |
| 962 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.f2bf16.rz.relu(float 1.000000e+00) |
| 963 |
__nvvm_f2bf16_rz_relu(1); |
| 964 |
|
| 965 |
// CHECK_PTX70_SM80: call i32 @llvm.nvvm.f2tf32.rna(float 1.000000e+00) |
| 966 |
__nvvm_f2tf32_rna(1); |
| 967 |
#endif |
| 968 |
// CHECK: ret void |
| 969 |
} |
| 970 |
|
| 971 |
#define NAN32 0x7FBFFFFF |
| 972 |
#define NAN16 (__bf16)0x7FBF |
| 973 |
#define BF16 (__bf16)0.1f |
| 974 |
#define BF16_2 (__bf16)0.2f |
| 975 |
#define NANBF16 (__bf16)0xFFC1 |
| 976 |
#define BF16X2 {(__bf16)0.1f, (__bf16)0.1f} |
| 977 |
#define BF16X2_2 {(__bf16)0.2f, (__bf16)0.2f} |
| 978 |
#define NANBF16X2 {NANBF16, NANBF16} |
| 979 |
|
| 980 |
// CHECK-LABEL: nvvm_abs_neg_bf16_bf16x2_sm80 |
| 981 |
__device__ void nvvm_abs_neg_bf16_bf16x2_sm80() { |
| 982 |
#if __CUDA_ARCH__ >= 800 |
| 983 |
|
| 984 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.abs.bf16(bfloat 0xR3DCD) |
| 985 |
__nvvm_abs_bf16(BF16); |
| 986 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.abs.bf16x2(<2 x bfloat> <bfloat 0xR3DCD, bfloat 0xR3DCD>) |
| 987 |
__nvvm_abs_bf16x2(BF16X2); |
| 988 |
|
| 989 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.neg.bf16(bfloat 0xR3DCD) |
| 990 |
__nvvm_neg_bf16(BF16); |
| 991 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.neg.bf16x2(<2 x bfloat> <bfloat 0xR3DCD, bfloat 0xR3DCD>) |
| 992 |
__nvvm_neg_bf16x2(BF16X2); |
| 993 |
#endif |
| 994 |
// CHECK: ret void |
| 995 |
} |
| 996 |
|
| 997 |
// CHECK-LABEL: nvvm_min_max_sm80 |
| 998 |
__device__ void nvvm_min_max_sm80() { |
| 999 |
#if __CUDA_ARCH__ >= 800 |
| 1000 |
|
| 1001 |
// CHECK_PTX70_SM80: call float @llvm.nvvm.fmin.nan.f |
| 1002 |
__nvvm_fmin_nan_f(0.1f, (float)NAN32); |
| 1003 |
// CHECK_PTX70_SM80: call float @llvm.nvvm.fmin.ftz.nan.f |
| 1004 |
__nvvm_fmin_ftz_nan_f(0.1f, (float)NAN32); |
| 1005 |
|
| 1006 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.fmin.bf16 |
| 1007 |
__nvvm_fmin_bf16(BF16, BF16_2); |
| 1008 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.fmin.ftz.bf16 |
| 1009 |
__nvvm_fmin_ftz_bf16(BF16, BF16_2); |
| 1010 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.fmin.nan.bf16 |
| 1011 |
__nvvm_fmin_nan_bf16(BF16, NANBF16); |
| 1012 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.fmin.ftz.nan.bf16 |
| 1013 |
__nvvm_fmin_ftz_nan_bf16(BF16, NANBF16); |
| 1014 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.fmin.bf16x2 |
| 1015 |
__nvvm_fmin_bf16x2(BF16X2, BF16X2_2); |
| 1016 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.fmin.ftz.bf16x2 |
| 1017 |
__nvvm_fmin_ftz_bf16x2(BF16X2, BF16X2_2); |
| 1018 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.fmin.nan.bf16x2 |
| 1019 |
__nvvm_fmin_nan_bf16x2(BF16X2, NANBF16X2); |
| 1020 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.fmin.ftz.nan.bf16x2 |
| 1021 |
__nvvm_fmin_ftz_nan_bf16x2(BF16X2, NANBF16X2); |
| 1022 |
// CHECK_PTX70_SM80: call float @llvm.nvvm.fmax.nan.f |
| 1023 |
__nvvm_fmax_nan_f(0.1f, 0.11f); |
| 1024 |
// CHECK_PTX70_SM80: call float @llvm.nvvm.fmax.ftz.nan.f |
| 1025 |
__nvvm_fmax_ftz_nan_f(0.1f, (float)NAN32); |
| 1026 |
|
| 1027 |
// CHECK_PTX70_SM80: call float @llvm.nvvm.fmax.nan.f |
| 1028 |
__nvvm_fmax_nan_f(0.1f, (float)NAN32); |
| 1029 |
// CHECK_PTX70_SM80: call float @llvm.nvvm.fmax.ftz.nan.f |
| 1030 |
__nvvm_fmax_ftz_nan_f(0.1f, (float)NAN32); |
| 1031 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.fmax.bf16 |
| 1032 |
__nvvm_fmax_bf16(BF16, BF16_2); |
| 1033 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.fmax.ftz.bf16 |
| 1034 |
__nvvm_fmax_ftz_bf16(BF16, BF16_2); |
| 1035 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.fmax.nan.bf16 |
| 1036 |
__nvvm_fmax_nan_bf16(BF16, NANBF16); |
| 1037 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.fmax.ftz.nan.bf16 |
| 1038 |
__nvvm_fmax_ftz_nan_bf16(BF16, NANBF16); |
| 1039 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.fmax.bf16x2 |
| 1040 |
__nvvm_fmax_bf16x2(BF16X2, BF16X2_2); |
| 1041 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.fmax.ftz.bf16x2 |
| 1042 |
__nvvm_fmax_ftz_bf16x2(BF16X2, BF16X2_2); |
| 1043 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.fmax.nan.bf16x2 |
| 1044 |
__nvvm_fmax_nan_bf16x2(NANBF16X2, BF16X2); |
| 1045 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.fmax.ftz.nan.bf16x2 |
| 1046 |
__nvvm_fmax_ftz_nan_bf16x2(NANBF16X2, BF16X2); |
| 1047 |
// CHECK_PTX70_SM80: call float @llvm.nvvm.fmax.nan.f |
| 1048 |
__nvvm_fmax_nan_f(0.1f, (float)NAN32); |
| 1049 |
// CHECK_PTX70_SM80: call float @llvm.nvvm.fmax.ftz.nan.f |
| 1050 |
__nvvm_fmax_ftz_nan_f(0.1f, (float)NAN32); |
| 1051 |
|
| 1052 |
#endif |
| 1053 |
// CHECK: ret void |
| 1054 |
} |
| 1055 |
|
| 1056 |
// CHECK-LABEL: nvvm_fma_bf16_bf16x2_sm80 |
| 1057 |
__device__ void nvvm_fma_bf16_bf16x2_sm80() { |
| 1058 |
#if __CUDA_ARCH__ >= 800 |
| 1059 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.fma.rn.bf16 |
| 1060 |
__nvvm_fma_rn_bf16(BF16, BF16_2, BF16_2); |
| 1061 |
// CHECK_PTX70_SM80: call bfloat @llvm.nvvm.fma.rn.relu.bf16 |
| 1062 |
__nvvm_fma_rn_relu_bf16(BF16, BF16_2, BF16_2); |
| 1063 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.fma.rn.bf16x2 |
| 1064 |
__nvvm_fma_rn_bf16x2(BF16X2, BF16X2_2, BF16X2_2); |
| 1065 |
// CHECK_PTX70_SM80: call <2 x bfloat> @llvm.nvvm.fma.rn.relu.bf16x2 |
| 1066 |
__nvvm_fma_rn_relu_bf16x2(BF16X2, BF16X2_2, BF16X2_2); |
| 1067 |
#endif |
| 1068 |
// CHECK: ret void |
| 1069 |
} |
| 1070 |
|
| 1071 |
// CHECK-LABEL: nvvm_min_max_sm86 |
| 1072 |
__device__ void nvvm_min_max_sm86() { |
| 1073 |
#if __CUDA_ARCH__ >= 860 |
| 1074 |
|
| 1075 |
// CHECK_PTX72_SM86: call bfloat @llvm.nvvm.fmin.xorsign.abs.bf16 |
| 1076 |
__nvvm_fmin_xorsign_abs_bf16(BF16, BF16_2); |
| 1077 |
// CHECK_PTX72_SM86: call bfloat @llvm.nvvm.fmin.nan.xorsign.abs.bf16 |
| 1078 |
__nvvm_fmin_nan_xorsign_abs_bf16(BF16, NANBF16); |
| 1079 |
// CHECK_PTX72_SM86: call <2 x bfloat> @llvm.nvvm.fmin.xorsign.abs.bf16x2 |
| 1080 |
__nvvm_fmin_xorsign_abs_bf16x2(BF16X2, BF16X2_2); |
| 1081 |
// CHECK_PTX72_SM86: call <2 x bfloat> @llvm.nvvm.fmin.nan.xorsign.abs.bf16x2 |
| 1082 |
__nvvm_fmin_nan_xorsign_abs_bf16x2(BF16X2, NANBF16X2); |
| 1083 |
// CHECK_PTX72_SM86: call float @llvm.nvvm.fmin.xorsign.abs.f |
| 1084 |
__nvvm_fmin_xorsign_abs_f(-0.1f, 0.1f); |
| 1085 |
// CHECK_PTX72_SM86: call float @llvm.nvvm.fmin.ftz.xorsign.abs.f |
| 1086 |
__nvvm_fmin_ftz_xorsign_abs_f(-0.1f, 0.1f); |
| 1087 |
// CHECK_PTX72_SM86: call float @llvm.nvvm.fmin.nan.xorsign.abs.f |
| 1088 |
__nvvm_fmin_nan_xorsign_abs_f(-0.1f, (float)NAN32); |
| 1089 |
// CHECK_PTX72_SM86: call float @llvm.nvvm.fmin.ftz.nan.xorsign.abs.f |
| 1090 |
__nvvm_fmin_ftz_nan_xorsign_abs_f(-0.1f, (float)NAN32); |
| 1091 |
|
| 1092 |
// CHECK_PTX72_SM86: call bfloat @llvm.nvvm.fmax.xorsign.abs.bf16 |
| 1093 |
__nvvm_fmax_xorsign_abs_bf16(BF16, BF16_2); |
| 1094 |
// CHECK_PTX72_SM86: call bfloat @llvm.nvvm.fmax.nan.xorsign.abs.bf16 |
| 1095 |
__nvvm_fmax_nan_xorsign_abs_bf16(BF16, NANBF16); |
| 1096 |
// CHECK_PTX72_SM86: call <2 x bfloat> @llvm.nvvm.fmax.xorsign.abs.bf16x2 |
| 1097 |
__nvvm_fmax_xorsign_abs_bf16x2(BF16X2, BF16X2_2); |
| 1098 |
// CHECK_PTX72_SM86: call <2 x bfloat> @llvm.nvvm.fmax.nan.xorsign.abs.bf16x2 |
| 1099 |
__nvvm_fmax_nan_xorsign_abs_bf16x2(BF16X2, NANBF16X2); |
| 1100 |
// CHECK_PTX72_SM86: call float @llvm.nvvm.fmax.xorsign.abs.f |
| 1101 |
__nvvm_fmax_xorsign_abs_f(-0.1f, 0.1f); |
| 1102 |
// CHECK_PTX72_SM86: call float @llvm.nvvm.fmax.ftz.xorsign.abs.f |
| 1103 |
__nvvm_fmax_ftz_xorsign_abs_f(-0.1f, 0.1f); |
| 1104 |
// CHECK_PTX72_SM86: call float @llvm.nvvm.fmax.nan.xorsign.abs.f |
| 1105 |
__nvvm_fmax_nan_xorsign_abs_f(-0.1f, (float)NAN32); |
| 1106 |
// CHECK_PTX72_SM86: call float @llvm.nvvm.fmax.ftz.nan.xorsign.abs.f |
| 1107 |
__nvvm_fmax_ftz_nan_xorsign_abs_f(-0.1f, (float)NAN32); |
| 1108 |
#endif |
| 1109 |
// CHECK: ret void |
| 1110 |
} |