|
| 1 | +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_INTEL_fpga_buffer_location %s -o %t.spt |
| 2 | +; RUN: FileCheck %s --input-file=%t.spt |
| 3 | +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_INTEL_fpga_buffer_location %s -o - -filetype=obj | spirv-val %} |
| 4 | + |
| 5 | +; CHECK-DAG: OpCapability FPGABufferLocationINTEL |
| 6 | +; CHECK-DAG: OpExtension "SPV_INTEL_fpga_buffer_location" |
| 7 | +; CHECK-DAG: OpName %[[#ARGA:]] "a" |
| 8 | +; CHECK-DAG: OpName %[[#ARGB:]] "b" |
| 9 | +; CHECK-DAG: OpName %[[#ARGC:]] "c" |
| 10 | +; CHECK-DAG: OpName %[[#ARGD:]] "d" |
| 11 | +; CHECK-DAG: OpName %[[#ARGE:]] "e" |
| 12 | +; CHECK-NOT: OpDecorate %[[#ARGC]] BufferLocationINTEL -1 |
| 13 | +; CHECK-NOT: OpDecorate %[[#ARGC]] BufferLocationINTEL -1 |
| 14 | +; CHECK-DAG: OpDecorate %[[#ARGA]] BufferLocationINTEL 1 |
| 15 | +; CHECK-DAG: OpDecorate %[[#ARGB]] BufferLocationINTEL 2 |
| 16 | +; CHECK-NOT: OpDecorate %[[#ARGD]] BufferLocationINTEL -1 |
| 17 | +; CHECK-NOT: OpDecorate %[[#ARGE]] BufferLocationINTEL 3 |
| 18 | +; CHECK-DAG: OpDecorate %[[#]] BufferLocationINTEL 123456789 |
| 19 | + |
| 20 | +; CHECK-DAG: %[[#]] = OpFunction |
| 21 | +; CHECK-DAG: %[[#ARGA]] = OpFunctionParameter %[[#]] |
| 22 | +; CHECK-DAG: %[[#ARGB]] = OpFunctionParameter %[[#]] |
| 23 | +; CHECK-DAG: %[[#ARGC]] = OpFunctionParameter %[[#]] |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +%struct.MyIP = type { ptr addrspace(4) } |
| 29 | + |
| 30 | +@.str.4 = internal unnamed_addr addrspace(1) constant [19 x i8] c"{5921:\22123456789\22}\00" |
| 31 | +@.str.1 = internal unnamed_addr addrspace(1) constant [9 x i8] c"main.cpp\00" |
| 32 | + |
| 33 | +; Function Attrs: nounwind |
| 34 | +define spir_kernel void @test(ptr addrspace(1) %a, ptr addrspace(1) %b, ptr 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 |
| 35 | +{ |
| 36 | +entry: |
| 37 | + ret void |
| 38 | +} |
| 39 | + |
| 40 | +; test1 : direct on kernel argument |
| 41 | +; Function Attrs: norecurse nounwind readnone |
| 42 | +define spir_kernel void @test.1(ptr addrspace(4) %a) #0 |
| 43 | +{ |
| 44 | +entry: |
| 45 | + %0 = call ptr addrspace(4) @llvm.ptr.annotation.p4.p1(ptr addrspace(4) %a, ptr addrspace(1) getelementptr inbounds ([19 x i8], ptr addrspace(1) @.str.4, i32 0, i32 0), ptr addrspace(1) getelementptr inbounds ([9 x i8], ptr addrspace(1) @.str.1, i32 0, i32 0), i32 7, ptr addrspace(1) null) |
| 46 | + store i8 0, ptr addrspace(4) %0, align 8 |
| 47 | + ret void |
| 48 | +} |
| 49 | + |
| 50 | +$test.2 = comdat any |
| 51 | +; test2 : general |
| 52 | +; Function Attrs: convergent mustprogress norecurse |
| 53 | +define weak_odr dso_local spir_kernel void @test.2(ptr addrspace(1) align 4 %arg_a) #0 comdat !kernel_arg_buffer_location !7 { |
| 54 | +entry: |
| 55 | + %this.addr.i = alloca ptr addrspace(4), align 8 |
| 56 | + %arg_a.addr = alloca ptr addrspace(1), align 8 |
| 57 | + %MyIP = alloca %struct.MyIP, align 8 |
| 58 | + %arg_a.addr.ascast = addrspacecast ptr %arg_a.addr to ptr addrspace(4) |
| 59 | + %MyIP.ascast = addrspacecast ptr %MyIP to ptr addrspace(4) |
| 60 | + store ptr addrspace(1) %arg_a, ptr addrspace(4) %arg_a.addr.ascast, align 8 |
| 61 | + %a = getelementptr inbounds %struct.MyIP, ptr addrspace(4) %MyIP.ascast, i32 0, i32 0 |
| 62 | + %0 = call ptr addrspace(4) @llvm.ptr.annotation.p4.p1(ptr addrspace(4) %a, ptr addrspace(1) getelementptr inbounds ([33 x i8], ptr addrspace(1) @.str.4, i32 0, i32 0), ptr addrspace(1) getelementptr inbounds ([9 x i8], ptr addrspace(1) @.str.1, i32 0, i32 0), i32 7, ptr addrspace(1) null) |
| 63 | + %b = load ptr addrspace(1), ptr addrspace(4) %arg_a.addr.ascast, align 8 |
| 64 | + %1 = addrspacecast ptr addrspace(1) %b to ptr addrspace(4) |
| 65 | + store ptr addrspace(4) %1, ptr addrspace(4) %0, align 8 |
| 66 | + %this.addr.ascast.i = addrspacecast ptr %this.addr.i to ptr addrspace(4) |
| 67 | + store ptr addrspace(4) %MyIP.ascast, ptr addrspace(4) %this.addr.ascast.i, align 8 |
| 68 | + %this1.i = load ptr addrspace(4), ptr addrspace(4) %this.addr.ascast.i, align 8 |
| 69 | + %a.i = getelementptr inbounds %struct.MyIP, ptr addrspace(4) %this1.i, i32 0, i32 0 |
| 70 | + %2 = call ptr addrspace(4) @llvm.ptr.annotation.p4.p1(ptr addrspace(4) %a.i, ptr addrspace(1) getelementptr inbounds ([19 x i8], ptr addrspace(1) @.str.4, i32 0, i32 0), ptr addrspace(1) getelementptr inbounds ([9 x i8], ptr addrspace(1) @.str.1, i32 0, i32 0), i32 7, ptr addrspace(1) null) |
| 71 | + %3 = load ptr addrspace(4), ptr addrspace(4) %2, align 8 |
| 72 | + %4 = load i32, ptr addrspace(4) %3, align 4 |
| 73 | + %inc.i = add nsw i32 %4, 1 |
| 74 | + store i32 %inc.i, ptr addrspace(4) %3, align 4 |
| 75 | + ret void |
| 76 | +} |
| 77 | + |
| 78 | +; test3 : memcpy |
| 79 | +; Function Attrs: convergent mustprogress norecurse |
| 80 | +define spir_kernel void @test.3(ptr addrspace(1) align 4 %arg_a, ptr %arg_b) { |
| 81 | +entry: |
| 82 | + %this.addr.i = alloca ptr addrspace(4), align 8 |
| 83 | + %arg_a.addr = alloca ptr addrspace(1), align 8 |
| 84 | + %MyIP = alloca %struct.MyIP, align 8 |
| 85 | + %arg_a.addr.ascast = addrspacecast ptr %arg_a.addr to ptr addrspace(4) |
| 86 | + %MyIP.ascast = addrspacecast ptr %MyIP to ptr addrspace(4) |
| 87 | + store ptr addrspace(1) %arg_a, ptr addrspace(4) %arg_a.addr.ascast, align 8 |
| 88 | + %a = getelementptr inbounds %struct.MyIP, ptr addrspace(4) %MyIP.ascast, i32 0, i32 0 |
| 89 | + %0 = call ptr addrspace(4) @llvm.ptr.annotation.p4.p1(ptr addrspace(4) %a, ptr addrspace(1) getelementptr inbounds ([19 x i8], ptr addrspace(1) @.str.4, i32 0, i32 0), ptr addrspace(1) getelementptr inbounds ([9 x i8], ptr addrspace(1) @.str.1, i32 0, i32 0), i32 7, ptr addrspace(1) null) |
| 90 | + call void @llvm.memcpy.p4.p0(ptr addrspace(4) %0, ptr %arg_b, i64 4, i1 false) |
| 91 | + ret void |
| 92 | +} |
| 93 | + |
| 94 | +; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) |
| 95 | +declare ptr addrspace(4) @llvm.ptr.annotation.p4.p1(ptr addrspace(4), ptr addrspace(1), ptr addrspace(1), i32, ptr addrspace(1)) #1 |
| 96 | + |
| 97 | +; Function Attrs: argmemonly nofree nounwind willreturn |
| 98 | +declare void @llvm.memcpy.p4.p0(ptr addrspace(4) noalias captures(none) writeonly, ptr noalias captures(none) readonly, i64, i1 immarg) #2 |
| 99 | + |
| 100 | +!opencl.enable.FP_CONTRACT = !{} |
| 101 | +!opencl.ocl.version = !{!0} |
| 102 | +!opencl.spir.version = !{!0} |
| 103 | +!opencl.used.extensions = !{!1} |
| 104 | +!opencl.used.optional.core.features = !{!1} |
| 105 | +!opencl.compiler.options = !{!1} |
| 106 | +!llvm.ident = !{!2} |
| 107 | + |
| 108 | +!0 = !{i32 2, i32 0} |
| 109 | +!1 = !{} |
| 110 | +!2 = !{!""} |
| 111 | +!3 = !{i32 1, i32 1, i32 1} |
| 112 | +!4 = !{!"none", !"none", !"none"} |
| 113 | +!5 = !{!"int*", !"float*", !"int*"} |
| 114 | +!6 = !{i32 1, i32 2, i32 -1, i32 -1, i32 3} |
| 115 | +!7 = !{i32 -1} |
0 commit comments