1 ; Simple bit of IR to mimic CUDA's libdevice. We want to be
2 ; able to link with it and we need to make sure all __nvvm_reflect
3 ; calls are eliminated by the time PTX has been produced.
5 target triple = "nvptx-unknown-cuda"
7 declare i32 @__nvvm_reflect(ptr)
9 @"$str" = private addrspace(1) constant [8 x i8] c"USE_MUL\00"
11 define void @unused_subfunc(float %a) {
15 define void @used_subfunc(float %a) {
19 define float @_Z17device_mul_or_addff(float %a, float %b) {
20 %reflect = call i32 @__nvvm_reflect(ptr addrspacecast (ptr addrspace(1) @"$str" to ptr))
21 %cmp = icmp ne i32 %reflect, 0
22 br i1 %cmp, label %use_mul, label %use_add
25 %ret1 = fmul float %a, %b
29 %ret2 = fadd float %a, %b
33 %ret = phi float [%ret1, %use_mul], [%ret2, %use_add]
35 call void @used_subfunc(float %ret)