Skip to content

Commit

Permalink
[spirv-ll] Fix two tests using OpTypeBool and OpVariable
Browse files Browse the repository at this point in the history
These can only be used with Workgroup, CrossWorkgroup, Private and
Function storage classes.
  • Loading branch information
frasercrmck committed Nov 13, 2023
1 parent f6443da commit 3382276
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %}
; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s
; RUN: spirv-ll-tool -a Vulkan %spv_file_s | FileCheck %s
OpCapability Shader
OpCapability Float64
OpCapability Int64
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
Expand All @@ -29,29 +27,26 @@
OpMemberName %a_block 0 "test_out"
OpName %_ ""
OpMemberDecorate %a_block 0 Offset 0
OpDecorate %a_block BufferBlock
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %11 SpecId 0
%void = OpTypeVoid
%3 = OpTypeFunction %void
%bool = OpTypeBool
%idx_type = OpTypeInt 32 0
%a_block = OpTypeStruct %bool
%ptr_Uniform_block = OpTypePointer Uniform %a_block
%_ = OpVariable %ptr_Uniform_block Uniform
%ptr_Uniform_block = OpTypePointer Workgroup %a_block
%_ = OpVariable %ptr_Uniform_block Workgroup
%10 = OpConstant %idx_type 0
%11 = OpSpecConstantFalse %bool ; testing this
%ptr_Uniform_bool = OpTypePointer Uniform %bool
%ptr_Uniform_bool = OpTypePointer Workgroup %bool
%main = OpFunction %void None %3
%5 = OpLabel
%13 = OpAccessChain %ptr_Uniform_bool %_ %10
OpStore %13 %11
OpReturn
OpFunctionEnd
; CHECK: ; ModuleID = '{{.*}}'
; CHECK: [[a_block:%[a-zA-Z0-9_]+]] = type { i1 }
; CHECK: define spir_kernel void @main(ptr addrspace(1){{( %0)?}}, ptr addrspace(1){{( %1)?}})
; CHECK: [[anon:%[a-zA-Z0-9]+]] = getelementptr [[a_block]], ptr addrspace(1) {{%[a-zA-Z0-9]+}}, i32 0, i32 0
; CHECK: store i1 false, ptr addrspace(1) [[anon]]
; CHECK: [[a_block:%.*]] = type { i1 }
; CHECK: [[global:@.*]] = internal addrspace(3) global [[a_block]] undef
; CHECK: define spir_kernel void @main()
; CHECK: [[anon:%.*]] = getelementptr [[a_block]], ptr addrspace(3) [[global]], i32 0, i32 0
; CHECK: store i1 false, ptr addrspace(3) [[anon]]
; CHECK: ret void
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

; RUN: %if online-spirv-as %{ spirv-as --target-env %spv_tgt_env -o %spv_file_s %s %}
; RUN: spirv-ll-tool -a Vulkan -c Float64 -c Int64 %spv_file_s | FileCheck %s
; RUN: spirv-ll-tool -a Vulkan %spv_file_s | FileCheck %s
OpCapability Shader
OpCapability Float64
OpCapability Int64
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
Expand All @@ -29,29 +27,26 @@
OpMemberName %a_block 0 "test_out"
OpName %_ ""
OpMemberDecorate %a_block 0 Offset 0
OpDecorate %a_block BufferBlock
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %11 SpecId 0
%void = OpTypeVoid
%3 = OpTypeFunction %void
%bool = OpTypeBool
%idx_type = OpTypeInt 32 0
%a_block = OpTypeStruct %bool
%ptr_Uniform_block = OpTypePointer Uniform %a_block
%_ = OpVariable %ptr_Uniform_block Uniform
%ptr_Uniform_block = OpTypePointer Workgroup %a_block
%_ = OpVariable %ptr_Uniform_block Workgroup
%10 = OpConstant %idx_type 0
%11 = OpSpecConstantTrue %bool ; testing this
%ptr_Uniform_bool = OpTypePointer Uniform %bool
%ptr_Uniform_bool = OpTypePointer Workgroup %bool
%main = OpFunction %void None %3
%5 = OpLabel
%13 = OpAccessChain %ptr_Uniform_bool %_ %10
OpStore %13 %11
OpReturn
OpFunctionEnd
; CHECK: ; ModuleID = '{{.*}}'
; CHECK: [[a_block:%[a-zA-Z0-9_]+]] = type { i1 }
; CHECK: define spir_kernel void @main(ptr addrspace(1){{( %0)?}}, ptr addrspace(1){{( %1)?}})
; CHECK: [[anon:%[a-zA-Z0-9]+]] = getelementptr [[a_block]], ptr addrspace(1) {{%[a-zA-Z0-9]+}}, i32 0, i32 0
; CHECK: store i1 true, ptr addrspace({{[0-9]}}) [[anon]]
; CHECK: [[a_block:%.*]] = type { i1 }
; CHECK: [[global:@.*]] = internal addrspace(3) global [[a_block]] undef
; CHECK: define spir_kernel void @main()
; CHECK: [[anon:%.*]] = getelementptr [[a_block]], ptr addrspace(3) [[global]], i32 0, i32 0
; CHECK: store i1 true, ptr addrspace(3) [[anon]]
; CHECK: ret void

0 comments on commit 3382276

Please sign in to comment.