| 1 |
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 |
| 2 |
; RUN: llc -verify-machineinstrs -O3 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - | FileCheck %s |
| 3 |
; RUN: %if spirv-tools %{ llc -O3 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - -filetype=obj | spirv-val %} |
| 4 |
|
| 5 |
; struct S1 { |
| 6 |
; int4 i; |
| 7 |
; float4 f; |
| 8 |
; }; |
| 9 |
; struct S2 { |
| 10 |
; float4 f; |
| 11 |
; int4 i; |
| 12 |
; }; |
| 13 |
; |
| 14 |
; StructuredBuffer<S1> In : register(t1); |
| 15 |
; RWStructuredBuffer<S2> Out : register(u0); |
| 16 |
; |
| 17 |
; [numthreads(1,1,1)] |
| 18 |
; void main(uint GI : SV_GroupIndex) { |
| 19 |
; Out[GI].f = In[GI].f; |
| 20 |
; Out[GI].i = In[GI].i; |
| 21 |
; } |
| 22 |
|
| 23 |
%struct.S1 = type { <4 x i32>, <4 x float> } |
| 24 |
%struct.S2 = type { <4 x float>, <4 x i32> } |
| 25 |
|
| 26 |
@.str = private unnamed_addr constant [3 x i8] c"In\00", align 1 |
| 27 |
@.str.2 = private unnamed_addr constant [4 x i8] c"Out\00", align 1 |
| 28 |
|
| 29 |
define void @main() local_unnamed_addr #0 { |
| 30 |
; CHECK-LABEL: main |
| 31 |
; CHECK: %42 = OpFunction %2 None %3 ; -- Begin function main |
| 32 |
; CHECK-NEXT: %1 = OpLabel |
| 33 |
; CHECK-NEXT: %43 = OpVariable %27 Function %37 |
| 34 |
; CHECK-NEXT: %44 = OpVariable %26 Function %38 |
| 35 |
; CHECK-NEXT: %45 = OpCopyObject %19 %39 |
| 36 |
; CHECK-NEXT: %46 = OpCopyObject %16 %40 |
| 37 |
; CHECK-NEXT: %47 = OpLoad %4 %41 |
| 38 |
; CHECK-NEXT: %48 = OpAccessChain %13 %45 %28 %47 |
| 39 |
; CHECK-NEXT: %49 = OpInBoundsAccessChain %9 %48 %30 |
| 40 |
; CHECK-NEXT: %50 = OpLoad %8 %49 Aligned 1 |
| 41 |
; CHECK-NEXT: %51 = OpAccessChain %11 %46 %28 %47 |
| 42 |
; CHECK-NEXT: %52 = OpInBoundsAccessChain %9 %51 %28 |
| 43 |
; CHECK-NEXT: OpStore %52 %50 Aligned 1 |
| 44 |
; CHECK-NEXT: %53 = OpAccessChain %6 %48 %28 |
| 45 |
; CHECK-NEXT: %54 = OpLoad %5 %53 Aligned 1 |
| 46 |
; CHECK-NEXT: %55 = OpInBoundsAccessChain %6 %51 %30 |
| 47 |
; CHECK-NEXT: OpStore %55 %54 Aligned 1 |
| 48 |
; CHECK-NEXT: OpReturn |
| 49 |
; CHECK-NEXT: OpFunctionEnd |
| 50 |
entry: |
| 51 |
%0 = tail call target("spirv.VulkanBuffer", [0 x %struct.S1], 12, 0) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0s_struct.S1s_12_0t(i32 0, i32 1, i32 1, i32 0, ptr nonnull @.str) |
| 52 |
%1 = tail call target("spirv.VulkanBuffer", [0 x %struct.S2], 12, 1) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0s_struct.S2s_12_1t(i32 0, i32 0, i32 1, i32 0, ptr nonnull @.str.2) |
| 53 |
%2 = tail call i32 @llvm.spv.flattened.thread.id.in.group() |
| 54 |
%3 = tail call noundef align 1 dereferenceable(32) ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0s_struct.S1s_12_0t(target("spirv.VulkanBuffer", [0 x %struct.S1], 12, 0) %0, i32 %2) |
| 55 |
%f.i = getelementptr inbounds nuw i8, ptr addrspace(11) %3, i64 16 |
| 56 |
%4 = load <4 x float>, ptr addrspace(11) %f.i, align 1 |
| 57 |
%5 = tail call noundef align 1 dereferenceable(32) ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0s_struct.S2s_12_1t(target("spirv.VulkanBuffer", [0 x %struct.S2], 12, 1) %1, i32 %2) |
| 58 |
store <4 x float> %4, ptr addrspace(11) %5, align 1 |
| 59 |
%6 = load <4 x i32>, ptr addrspace(11) %3, align 1 |
| 60 |
%i6.i = getelementptr inbounds nuw i8, ptr addrspace(11) %5, i64 16 |
| 61 |
store <4 x i32> %6, ptr addrspace(11) %i6.i, align 1 |
| 62 |
ret void |
| 63 |
} |
| 64 |
|
| 65 |
declare i32 @llvm.spv.flattened.thread.id.in.group() |
| 66 |
|
| 67 |
declare target("spirv.VulkanBuffer", [0 x %struct.S1], 12, 0) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0s_struct.S1s_12_0t(i32, i32, i32, i32, ptr) |
| 68 |
|
| 69 |
declare target("spirv.VulkanBuffer", [0 x %struct.S2], 12, 1) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0s_struct.S2s_12_1t(i32, i32, i32, i32, ptr) |
| 70 |
|
| 71 |
declare ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0s_struct.S2s_12_1t(target("spirv.VulkanBuffer", [0 x %struct.S2], 12, 1), i32) |
| 72 |
|
| 73 |
declare ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0s_struct.S1s_12_0t(target("spirv.VulkanBuffer", [0 x %struct.S1], 12, 0), i32) |
| 74 |
|
| 75 |
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" } |