xref: /llvm-project/llvm/test/CodeGen/NVPTX/nvvm-reflect-ocl.ll (revision ff9af4c43ad71eeba2cabe99609cfaa0fd54c1d0)
1ce43e2f0SHugh Delaney; Verify that __nvvm_reflect_ocl() is replaced with an appropriate value
2ce43e2f0SHugh Delaney;
3d6775052SPavel Kopyl; RUN: opt %s -S -passes='default<O2>' -mtriple=nvptx64 -mcpu=sm_20 \
4ce43e2f0SHugh Delaney; RUN:   | FileCheck %s --check-prefixes=COMMON,SM20
5ce43e2f0SHugh Delaney; RUN: opt %s -S -passes='default<O2>' -mtriple=nvptx64 -mcpu=sm_35 \
6ce43e2f0SHugh Delaney; RUN:   | FileCheck %s --check-prefixes=COMMON,SM35
7ce43e2f0SHugh Delaney
8ce43e2f0SHugh Delaney@"$str" = private addrspace(4) constant [12 x i8] c"__CUDA_ARCH\00"
9ce43e2f0SHugh Delaney
10ce43e2f0SHugh Delaneydeclare i32 @__nvvm_reflect_ocl(ptr addrspace(4) noundef)
11ce43e2f0SHugh Delaney
12ce43e2f0SHugh Delaney; COMMON-LABEL: @foo
13ce43e2f0SHugh Delaneydefine i32 @foo(float %a, float %b) {
14ce43e2f0SHugh Delaney; COMMON-NOT: call i32 @__nvvm_reflect_ocl
15*ff9af4c4SNikita Popov  %reflect = tail call i32 @__nvvm_reflect_ocl(ptr addrspace(4) noundef @"$str")
16ce43e2f0SHugh Delaney; SM20: ret i32 200
17ce43e2f0SHugh Delaney; SM35: ret i32 350
18ce43e2f0SHugh Delaney  ret i32 %reflect
19ce43e2f0SHugh Delaney}
20ce43e2f0SHugh Delaney
21