brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · a1ec2cd Raw
51 lines · plain
1; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-vulkan-compute %s -o - | FileCheck %s --match-full-lines2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan %s -o - -filetype=obj | spirv-val %}3 4; CHECK-DAG:        %[[#uint:]] = OpTypeInt 32 05; CHECK-DAG:     %[[#v2_uint:]] = OpTypeVector %[[#uint]] 26; CHECK-DAG:      %[[#double:]] = OpTypeFloat 647; CHECK-DAG:   %[[#v2_double:]] = OpTypeVector %[[#double]] 28; CHECK-DAG:     %[[#v4_uint:]] = OpTypeVector %[[#uint]] 49@.str = private unnamed_addr constant [3 x i8] c"In\00", align 110@.str.2 = private unnamed_addr constant [4 x i8] c"Out\00", align 111 12define void @main() local_unnamed_addr #0 {13entry:14  %0 = tail call target("spirv.VulkanBuffer", [0 x <2 x i32>], 12, 0) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0v2i32_12_0t(i32 0, i32 0, i32 1, i32 0, ptr nonnull @.str)15  %1 = tail call target("spirv.VulkanBuffer", [0 x <2 x double>], 12, 1) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0v2f64_12_1t(i32 0, i32 2, i32 1, i32 0, ptr nonnull @.str.2)16  %2 = tail call noundef align 8 dereferenceable(8) ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0v2i32_12_0t(target("spirv.VulkanBuffer", [0 x <2 x i32>], 12, 0) %0, i32 0)17  %3 = load <2 x i32>, ptr addrspace(11) %2, align 818  %4 = tail call noundef align 8 dereferenceable(8) ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0v2i32_12_0t(target("spirv.VulkanBuffer", [0 x <2 x i32>], 12, 0) %0, i32 1)19  %5 = load <2 x i32>, ptr addrspace(11) %4, align 820; CHECK: %[[#tmp:]] = OpVectorShuffle %[[#v4_uint]] {{%[0-9]+}} {{%[0-9]+}} 0 2 1 321  %6 = shufflevector <2 x i32> %3, <2 x i32> %5, <4 x i32> <i32 0, i32 2, i32 1, i32 3>22; CHECK: %[[#access:]] = OpAccessChain {{.*}}23  %7 = tail call noundef align 16 dereferenceable(16) ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0v2f64_12_1t(target("spirv.VulkanBuffer", [0 x <2 x double>], 12, 1) %1, i32 0)24; CHECK: %[[#bitcast:]] = OpBitcast %[[#v2_double]] %[[#tmp]]25; CHECK: OpStore %[[#access]] %[[#bitcast]] Aligned 1626  store <4 x i32> %6, ptr addrspace(11) %7, align 1627  ret void28}29 30; This tests a load from a pointer that has been bitcast between vector types31; which share the same total bit-width but have different numbers of elements.32; Tests that legalize-pointer-casts works correctly by moving the bitcast to33; the element that was loaded.34 35define void @main2() local_unnamed_addr #0 {36entry:37; CHECK:  %[[LOAD:[0-9]+]] = OpLoad %[[#v2_double]] {{.*}}38; CHECK:  %[[BITCAST1:[0-9]+]] = OpBitcast %[[#v4_uint]] %[[LOAD]]39; CHECK:  %[[BITCAST2:[0-9]+]] = OpBitcast %[[#v2_double]] %[[BITCAST1]]40; CHECK: OpStore {{%[0-9]+}} %[[BITCAST2]] {{.*}}41 42  %0 = tail call target("spirv.VulkanBuffer", [0 x <2 x double>], 12, 1) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0v2f64_12_1t(i32 0, i32 2, i32 1, i32 0, ptr nonnull @.str.2)43  %2 = tail call noundef align 16 dereferenceable(16) ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0v2f64_12_1t(target("spirv.VulkanBuffer", [0 x <2 x double>], 12, 1) %0, i32 0)44  %3 = load <4 x i32>, ptr addrspace(11) %245  %4 = tail call noundef align 16 dereferenceable(16) ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0v2f64_12_1t(target("spirv.VulkanBuffer", [0 x <2 x double>], 12, 1) %0, i32 1)46  store <4 x i32> %3, ptr addrspace(11) %447  ret void48}49 50attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }51