|
| 1 | +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_INTEL_blocking_pipes %s -o - | FileCheck %s --check-prefixes=CHECK-SPIRV |
| 2 | +; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_blocking_pipes %s -o - -filetype=obj | spirv-val %} |
| 3 | + |
| 4 | +%opencl.pipe_ro_t = type opaque |
| 5 | +%opencl.pipe_wo_t = type opaque |
| 6 | + |
| 7 | +; CHECK-SPIRV: OpCapability BlockingPipesINTEL |
| 8 | +; CHECK-SPIRV: OpExtension "SPV_INTEL_blocking_pipes" |
| 9 | +; CHECK-SPIRV: %[[PipeRTy:[0-9]+]] = OpTypePipe ReadOnly |
| 10 | +; CHECK-SPIRV: %[[PipeWTy:[0-9]+]] = OpTypePipe WriteOnly |
| 11 | +; CHECK-SPIRV: %[[PipeR1:[0-9]+]] = OpLoad %[[PipeRTy]] %[[#]] Aligned 8 |
| 12 | +; CHECK-SPIRV: OpReadPipeBlockingINTEL %[[PipeR1]] %[[#]] %[[#]] %[[#]] |
| 13 | +; CHECK-SPIRV: %[[PipeR2:[0-9]+]] = OpLoad %[[PipeRTy]] %[[#]] Aligned 8 |
| 14 | +; CHECK-SPIRV: OpReadPipeBlockingINTEL %[[PipeR2]] %[[#]] %[[#]] %[[#]] |
| 15 | +; CHECK-SPIRV: %[[PipeW1:[0-9]+]] = OpLoad %[[PipeWTy]] %[[#]] Aligned 8 |
| 16 | +; CHECK-SPIRV: OpWritePipeBlockingINTEL %[[PipeW1]] %[[#]] %[[#]] %[[#]] |
| 17 | +; CHECK-SPIRV: %[[PipeW2:[0-9]+]] = OpLoad %[[PipeWTy]] %[[#]] Aligned 8 |
| 18 | +; CHECK-SPIRV: OpWritePipeBlockingINTEL %[[PipeW2]] %[[#]] %[[#]] %[[#]] |
| 19 | + |
| 20 | + |
| 21 | +; Function Attrs: convergent noinline nounwind optnone |
| 22 | +define spir_func void @foo(target("spirv.Pipe", 0) %p, ptr addrspace(1) %ptr) #0 { |
| 23 | +entry: |
| 24 | + %p.addr = alloca target("spirv.Pipe", 0), align 8 |
| 25 | + %ptr.addr = alloca ptr addrspace(1), align 8 |
| 26 | + store target("spirv.Pipe", 0) %p, target("spirv.Pipe", 0)* %p.addr, align 8 |
| 27 | + store ptr addrspace(1) %ptr, ptr %ptr.addr, align 8 |
| 28 | + %0 = load target("spirv.Pipe", 0), target("spirv.Pipe", 0)* %p.addr, align 8 |
| 29 | + %1 = load ptr addrspace(1), ptr %ptr.addr, align 8 |
| 30 | + %2 = addrspacecast ptr addrspace(1) %1 to ptr addrspace(4) |
| 31 | + call spir_func void @_Z29__spirv_ReadPipeBlockingINTELIiEv8ocl_pipePiii(target("spirv.Pipe", 0) %0, ptr addrspace(4) %2, i32 4, i32 4) |
| 32 | + ret void |
| 33 | +} |
| 34 | + |
| 35 | +declare dso_local spir_func void @_Z29__spirv_ReadPipeBlockingINTELIiEv8ocl_pipePiii(target("spirv.Pipe", 0), ptr addrspace(4), i32, i32) |
| 36 | + |
| 37 | +; Function Attrs: convergent noinline nounwind optnone |
| 38 | +define spir_func void @bar(target("spirv.Pipe", 0) %p, ptr addrspace(1) %ptr) #0 { |
| 39 | +entry: |
| 40 | + %p.addr = alloca target("spirv.Pipe", 0), align 8 |
| 41 | + %ptr.addr = alloca ptr addrspace(1), align 8 |
| 42 | + store target("spirv.Pipe", 0) %p, target("spirv.Pipe", 0)* %p.addr, align 8 |
| 43 | + store ptr addrspace(1) %ptr, ptr %ptr.addr, align 8 |
| 44 | + %0 = load target("spirv.Pipe", 0), target("spirv.Pipe", 0)* %p.addr, align 8 |
| 45 | + %1 = load ptr addrspace(1), ptr %ptr.addr, align 8 |
| 46 | + %2 = addrspacecast ptr addrspace(1) %1 to ptr addrspace(4) |
| 47 | + call spir_func void @_Z29__spirv_ReadPipeBlockingINTELIiEv8ocl_pipePvii(target("spirv.Pipe", 0) %0, ptr addrspace(4) %2, i32 4, i32 4) |
| 48 | + ret void |
| 49 | +} |
| 50 | + |
| 51 | +declare dso_local spir_func void @_Z29__spirv_ReadPipeBlockingINTELIiEv8ocl_pipePvii(target("spirv.Pipe", 0), ptr addrspace(4), i32, i32) |
| 52 | + |
| 53 | +; Function Attrs: convergent noinline nounwind optnone |
| 54 | +define spir_func void @boo(target("spirv.Pipe", 1) %p, ptr addrspace(1) %ptr) #0 { |
| 55 | +entry: |
| 56 | + %p.addr = alloca target("spirv.Pipe", 1), align 8 |
| 57 | + %ptr.addr = alloca ptr addrspace(1), align 8 |
| 58 | + store target("spirv.Pipe", 1) %p, target("spirv.Pipe", 1)* %p.addr, align 8 |
| 59 | + store ptr addrspace(1) %ptr, ptr %ptr.addr, align 8 |
| 60 | + %0 = load target("spirv.Pipe", 1), target("spirv.Pipe", 1)* %p.addr, align 8 |
| 61 | + %1 = load ptr addrspace(1), ptr %ptr.addr, align 8 |
| 62 | + %2 = addrspacecast ptr addrspace(1) %1 to ptr addrspace(4) |
| 63 | + call spir_func void @_Z30__spirv_WritePipeBlockingINTELIKiEv8ocl_pipePiii(target("spirv.Pipe", 1) %0, ptr addrspace(4) %2, i32 4, i32 4) |
| 64 | + ret void |
| 65 | +} |
| 66 | + |
| 67 | +declare dso_local spir_func void @_Z30__spirv_WritePipeBlockingINTELIKiEv8ocl_pipePiii(target("spirv.Pipe", 1), ptr addrspace(4), i32, i32) |
| 68 | + |
| 69 | +; Function Attrs: convergent noinline nounwind optnone |
| 70 | +define spir_func void @baz(target("spirv.Pipe", 1) %p, ptr addrspace(1) %ptr) #0 { |
| 71 | +entry: |
| 72 | + %p.addr = alloca target("spirv.Pipe", 1), align 8 |
| 73 | + %ptr.addr = alloca ptr addrspace(1), align 8 |
| 74 | + store target("spirv.Pipe", 1) %p, target("spirv.Pipe", 1)* %p.addr, align 8 |
| 75 | + store ptr addrspace(1) %ptr, ptr %ptr.addr, align 8 |
| 76 | + %0 = load target("spirv.Pipe", 1), target("spirv.Pipe", 1)* %p.addr, align 8 |
| 77 | + %1 = load ptr addrspace(1), ptr %ptr.addr, align 8 |
| 78 | + %2 = addrspacecast ptr addrspace(1) %1 to ptr addrspace(4) |
| 79 | + call spir_func void @_Z30__spirv_WritePipeBlockingINTELIKiEv8ocl_pipePvii(target("spirv.Pipe", 1) %0, ptr addrspace(4) %2, i32 4, i32 4) |
| 80 | + ret void |
| 81 | +} |
| 82 | + |
| 83 | +declare dso_local spir_func void @_Z30__spirv_WritePipeBlockingINTELIKiEv8ocl_pipePvii(target("spirv.Pipe", 1), ptr addrspace(4), i32, i32) |
| 84 | + |
| 85 | +; CHECK-LLVM: declare spir_func void @__read_pipe_2_bl(ptr addrspace(1), ptr addrspace(4), i32, i32) |
| 86 | +; CHECK-LLVM: declare spir_func void @__write_pipe_2_bl(ptr addrspace(1), ptr addrspace(4), i32, i32) |
| 87 | + |
| 88 | +; Function Attrs: convergent mustprogress norecurse nounwind |
| 89 | +define linkonce_odr dso_local spir_func void @WritePipeBLockingi9Pointer(ptr addrspace(4) align 2 dereferenceable(2) %_Data) { |
| 90 | +entry: |
| 91 | + %_Data.addr = alloca ptr addrspace(4), align 8 |
| 92 | + %_WPipe = alloca target("spirv.Pipe", 1), align 8 |
| 93 | + %_Data.addr.ascast = addrspacecast ptr %_Data.addr to ptr addrspace(4) |
| 94 | + %_WPipe.ascast = addrspacecast target("spirv.Pipe", 1)* %_WPipe to target("spirv.Pipe", 1) addrspace(4)* |
| 95 | + store ptr addrspace(4) %_Data, ptr addrspace(4) %_Data.addr.ascast, align 8 |
| 96 | + %0 = bitcast target("spirv.Pipe", 1)* %_WPipe to ptr |
| 97 | + %1 = load target("spirv.Pipe", 1), target("spirv.Pipe", 1) addrspace(4)* %_WPipe.ascast, align 8 |
| 98 | + %2 = load ptr addrspace(4), ptr addrspace(4) %_Data.addr.ascast, align 8 |
| 99 | + call spir_func void @_Z30__spirv_WritePipeBlockingINTELIDU9_Ev8ocl_pipePKT_ii(target("spirv.Pipe", 1) %1, ptr addrspace(4) %2, i32 2, i32 2) |
| 100 | + ret void |
| 101 | +} |
| 102 | + |
| 103 | +declare dso_local spir_func void @_Z30__spirv_WritePipeBlockingINTELIDU9_Ev8ocl_pipePKT_ii(target("spirv.Pipe", 1), ptr addrspace(4), i32, i32) |
| 104 | + |
| 105 | +attributes #0 = { convergent noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "denorms-are-zero"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 106 | + |
| 107 | +!llvm.module.flags = !{!0} |
| 108 | +!opencl.ocl.version = !{!1} |
| 109 | +!opencl.spir.version = !{!1} |
| 110 | +!llvm.ident = !{!2} |
| 111 | + |
| 112 | +!0 = !{i32 1, !"wchar_size", i32 4} |
| 113 | +!1 = !{i32 2, i32 0} |
| 114 | +!2 = !{!"clang version 9.0.0 (https://github.com/MrSidims/llvm.git c627b787284c5bcc917ea9742908baa1b856e176)"} |
0 commit comments