| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 |
| ; RUN: llc -verify-machineinstrs -O3 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - | FileCheck %s |
| ; RUN: %if spirv-tools %{ llc -O3 -mtriple=spirv1.6-unknown-vulkan1.3-compute %s -o - -filetype=obj | spirv-val %} |
| |
| ; struct S1 { |
| ; int4 i; |
| ; float4 f; |
| ; }; |
| ; struct S2 { |
| ; float4 f; |
| ; int4 i; |
| ; }; |
| ; |
| ; StructuredBuffer<S1> In : register(t1); |
| ; RWStructuredBuffer<S2> Out : register(u0); |
| ; |
| ; [numthreads(1,1,1)] |
| ; void main(uint GI : SV_GroupIndex) { |
| ; Out[GI].f = In[GI].f; |
| ; Out[GI].i = In[GI].i; |
| ; } |
| |
| %struct.S1 = type { <4 x i32>, <4 x float> } |
| %struct.S2 = type { <4 x float>, <4 x i32> } |
| |
| @.str = private unnamed_addr constant [3 x i8] c"In\00", align 1 |
| @.str.2 = private unnamed_addr constant [4 x i8] c"Out\00", align 1 |
| |
| define void @main() local_unnamed_addr #0 { |
| ; CHECK-LABEL: main |
| ; CHECK: %42 = OpFunction %2 None %3 ; -- Begin function main |
| ; CHECK-NEXT: %1 = OpLabel |
| ; CHECK-NEXT: %43 = OpVariable %27 Function %37 |
| ; CHECK-NEXT: %44 = OpVariable %26 Function %38 |
| ; CHECK-NEXT: %45 = OpCopyObject %19 %39 |
| ; CHECK-NEXT: %46 = OpCopyObject %16 %40 |
| ; CHECK-NEXT: %47 = OpLoad %4 %41 |
| ; CHECK-NEXT: %48 = OpAccessChain %13 %45 %28 %47 |
| ; CHECK-NEXT: %49 = OpInBoundsAccessChain %9 %48 %30 |
| ; CHECK-NEXT: %50 = OpLoad %8 %49 Aligned 1 |
| ; CHECK-NEXT: %51 = OpAccessChain %11 %46 %28 %47 |
| ; CHECK-NEXT: %52 = OpInBoundsAccessChain %9 %51 %28 |
| ; CHECK-NEXT: OpStore %52 %50 Aligned 1 |
| ; CHECK-NEXT: %53 = OpAccessChain %6 %48 %28 |
| ; CHECK-NEXT: %54 = OpLoad %5 %53 Aligned 1 |
| ; CHECK-NEXT: %55 = OpInBoundsAccessChain %6 %51 %30 |
| ; CHECK-NEXT: OpStore %55 %54 Aligned 1 |
| ; CHECK-NEXT: OpReturn |
| ; CHECK-NEXT: OpFunctionEnd |
| entry: |
| %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) |
| %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) |
| %2 = tail call i32 @llvm.spv.flattened.thread.id.in.group() |
| %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) |
| %f.i = getelementptr inbounds nuw i8, ptr addrspace(11) %3, i64 16 |
| %4 = load <4 x float>, ptr addrspace(11) %f.i, align 1 |
| %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) |
| store <4 x float> %4, ptr addrspace(11) %5, align 1 |
| %6 = load <4 x i32>, ptr addrspace(11) %3, align 1 |
| %i6.i = getelementptr inbounds nuw i8, ptr addrspace(11) %5, i64 16 |
| store <4 x i32> %6, ptr addrspace(11) %i6.i, align 1 |
| ret void |
| } |
| |
| declare i32 @llvm.spv.flattened.thread.id.in.group() |
| |
| 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) |
| |
| 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) |
| |
| 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) |
| |
| 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) |
| |
| attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" } |