1; RUN: llvm-as %s -o %t.bc
2; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_fpga_buffer_location -o %t.spv
3; RUN: llvm-spirv %t.spv -to-text -o %t.spt
4; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
5
6; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
7; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
8
9; RUN: llvm-spirv -spirv-text -r %t.spt -o %t.rev.bc
10; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
11
12; CHECK-SPIRV: 2 Capability FPGABufferLocationINTEL
13; CHECK-SPIRV: 9 Extension "SPV_INTEL_fpga_buffer_location"
14; CHECK-SPIRV: 3 Name [[ARGA:[0-9]+]] "a"
15; CHECK-SPIRV: 3 Name [[ARGB:[0-9]+]] "b"
16; CHECK-SPIRV: 3 Name [[ARGC:[0-9]+]] "c"
17; CHECK-SPIRV: 3 Name [[ARGD:[0-9]+]] "d"
18; CHECK-SPIRV: 3 Name [[ARGE:[0-9]+]] "e"
19; CHECK-SPIRV-NOT: 4 Decorate [[ARGC]] BufferLocationINTEL -1
20; CHECK-SPIRV-NOT: 4 Decorate [[ARGC]] BufferLocationINTEL -1
21; CHECK-SPIRV: 4 Decorate [[ARGA]] BufferLocationINTEL 1
22; CHECK-SPIRV: 4 Decorate [[ARGB]] BufferLocationINTEL 2
23; CHECK-SPIRV-NOT: 4 Decorate [[ARGD]] BufferLocationINTEL -1
24; CHECK-SPIRV-NOT: 4 Decorate [[ARGE]] BufferLocationINTEL 3
25
26; CHECK-SPIRV: 5 Function
27; CHECK-SPIRV: 3 FunctionParameter {{[0-9]+}} [[ARGA]]
28; CHECK-SPIRV: 3 FunctionParameter {{[0-9]+}} [[ARGB]]
29; CHECK-SPIRV: 3 FunctionParameter {{[0-9]+}} [[ARGC]]
30; CHECK-SPIRV: 3 FunctionParameter {{[0-9]+}} [[ARGD]]
31; CHECK-SPIRV: 3 FunctionParameter {{[0-9]+}} [[ARGE]]
32
33; CHECK-LLVM: define spir_kernel void @test{{.*}} !kernel_arg_buffer_location ![[BUFLOC_MD:[0-9]+]] {{.*}}
34; CHECK-LLVM: ![[BUFLOC_MD]] = !{i32 1, i32 2, i32 -1, i32 -1, i32 -1}
35
36; ModuleID = 'buffer_location.cl'
37source_filename = "buffer_location.cl"
38target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
39target triple = "spir64-unknown-unknown"
40
41; Function Attrs: norecurse nounwind readnone
42define spir_kernel void @test(i32 addrspace(1)* %a, float addrspace(1)* %b, i32 addrspace(1)* %c, i32 %d, i32 %e) local_unnamed_addr !kernel_arg_addr_space !3 !kernel_arg_access_qual !4 !kernel_arg_type !5 !kernel_arg_base_type !5 !kernel_arg_buffer_location !6 {
43entry:
44  ret void
45}
46
47!opencl.enable.FP_CONTRACT = !{}
48!opencl.ocl.version = !{!0}
49!opencl.spir.version = !{!0}
50!opencl.used.extensions = !{!1}
51!opencl.used.optional.core.features = !{!1}
52!opencl.compiler.options = !{!1}
53!llvm.ident = !{!2}
54
55!0 = !{i32 2, i32 0}
56!1 = !{}
57!2 = !{!""}
58!3 = !{i32 1, i32 1, i32 1}
59!4 = !{!"none", !"none", !"none"}
60!5 = !{!"int*", !"float*", !"int*"}
61!6 = !{i32 1, i32 2, i32 -1, i32 -1, i32 3}
62