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