1; RUN: llvm-as %s -o %t.bc
2; RUN: llvm-spirv %t.bc -spirv-text -o %t.txt
3; RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV
4; RUN: llvm-spirv %t.bc -o %t.spv
5; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
6; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
7
8target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
9target triple = "spir64-unknown-unknown"
10
11; CHECK-SPIRV-NOT: SConvert
12
13; Check no OpenCL convert builtin function generated
14; CHECK-LLVM-NOT: call {{.*}} @_Z{{[0-9]*}}convert
15
16; Function Attrs: nounwind
17define spir_kernel void @math_kernel8(<8 x i32> addrspace(1)* nocapture %out, <8 x float> addrspace(1)* nocapture readonly %in1, <8 x float> addrspace(1)* nocapture readonly %in2) #0 {
18entry:
19  %call = tail call spir_func i64 @_Z13get_global_idj(i32 0) #2
20  %sext = shl i64 %call, 32
21  %idxprom = ashr exact i64 %sext, 32
22  %arrayidx = getelementptr inbounds <8 x float>, <8 x float> addrspace(1)* %in1, i64 %idxprom
23  %0 = load <8 x float>, <8 x float> addrspace(1)* %arrayidx, align 32, !tbaa !9
24  %arrayidx2 = getelementptr inbounds <8 x float>, <8 x float> addrspace(1)* %in2, i64 %idxprom
25  %1 = load <8 x float>, <8 x float> addrspace(1)* %arrayidx2, align 32, !tbaa !9
26  %call3 = tail call spir_func <8 x i32> @_Z7isequalDv8_fDv8_f(<8 x float> %0, <8 x float> %1) #2
27  %arrayidx5 = getelementptr inbounds <8 x i32>, <8 x i32> addrspace(1)* %out, i64 %idxprom
28  store <8 x i32> %call3, <8 x i32> addrspace(1)* %arrayidx5, align 32, !tbaa !9
29  ret void
30}
31
32; Function Attrs: nounwind readnone
33declare spir_func i64 @_Z13get_global_idj(i32) #1
34
35; Function Attrs: nounwind readnone
36declare spir_func <8 x i32> @_Z7isequalDv8_fDv8_f(<8 x float>, <8 x float>) #1
37
38attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
39attributes #1 = { nounwind readnone "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
40attributes #2 = { nounwind readnone }
41
42!opencl.kernels = !{!0}
43!opencl.enable.FP_CONTRACT = !{}
44!opencl.spir.version = !{!6}
45!opencl.ocl.version = !{!6}
46!opencl.used.extensions = !{!7}
47!opencl.used.optional.core.features = !{!7}
48!opencl.compiler.options = !{!7}
49!llvm.ident = !{!8}
50
51!0 = !{void (<8 x i32> addrspace(1)*, <8 x float> addrspace(1)*, <8 x float> addrspace(1)*)* @math_kernel8, !1, !2, !3, !4, !5}
52!1 = !{!"kernel_arg_addr_space", i32 1, i32 1, i32 1}
53!2 = !{!"kernel_arg_access_qual", !"none", !"none", !"none"}
54!3 = !{!"kernel_arg_type", !"int8*", !"float8*", !"float8*"}
55!4 = !{!"kernel_arg_type_qual", !"", !"", !""}
56!5 = !{!"kernel_arg_base_type", !"int8*", !"float8*", !"float8*"}
57!6 = !{i32 2, i32 0}
58!7 = !{}
59!8 = !{!"clang version 3.4 "}
60!9 = !{!10, !10, i64 0}
61!10 = !{!"omnipotent char", !11, i64 0}
62!11 = !{!"Simple C/C++ TBAA"}
63