Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/extensions/INTEL/SPV_INTEL_function_pointers/gv-func-ptr.ll

raw
1 ; RUN: llvm-as %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -spirv-ext=+SPV_INTEL_function_pointers -o %t.spv
3 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.r.bc
4 ; RUN: llvm-dis %t.r.bc -o %t.r.ll
5 ; RUN: FileCheck < %t.r.ll %s --check-prefix=CHECK-LLVM
6
7 ; ModuleID = 't.bc'
8 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024"
9 target triple = "spir64-unknown-unknown"
10
11 %structtype.3 = type { [1 x i8 addrspace(4)*] }
12
13 ; CHECK-LLVM: @A = addrspace(1) constant %structtype.3 { [1 x ptr addrspace(4)] [ptr addrspace(4) addrspacecast (ptr @foo to ptr addrspace(4))] }, align 8
14
15 @A = linkonce_odr addrspace(1) constant %structtype.3 { [1 x i8 addrspace(4)*] [i8 addrspace(4)* addrspacecast (i8* bitcast (void ()* @foo to i8*) to i8 addrspace(4)*)] }, align 8
16
17 ; Function Attrs: nounwind
18 define linkonce_odr spir_func void @foo() #0 {
19 entry:
20 ; CHECK-LLVM: %0 = getelementptr inbounds %structtype.3, ptr addrspace(1) @A, i64 0, i32 0, i64 2
21 %0 = getelementptr inbounds %structtype.3, %structtype.3 addrspace(1)* @A, i64 0, i32 0, i64 2
22 ret void
23 }
24
25 attributes #0 = { nounwind }
26
27 !spirv.MemoryModel = !{!0}
28 !spirv.Source = !{!1}
29 !opencl.spir.version = !{!2}
30 !opencl.ocl.version = !{!2}
31 !opencl.used.extensions = !{!3}
32 !opencl.used.optional.core.features = !{!4}
33 !spirv.Generator = !{!5}
34
35 !0 = !{i32 2, i32 2}
36 !1 = !{i32 4, i32 200000}
37 !2 = !{i32 2, i32 0}
38 !3 = !{!"cl_khr_int64_extended_atomics", !"cl_khr_subgroups"}
39 !4 = !{!"cl_doubles"}
40 !5 = !{i16 6, i16 14}