-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Backport to 17] [SPIR-V 1.1] SPIRVReader: Add OpSizeOf support (#2853)…
… (#2863) The `OpSizeOf` instruction was added in SPIR-V 1.1, but not supported yet. (cherry picked from commit 9aeb7eb)
- Loading branch information
Showing
5 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
; REQUIRES: spirv-as | ||
; RUN: spirv-as --target-env spv1.1 -o %t.spv %s | ||
; TODO: reenable spirv-val when OpSizeOf is supported. | ||
; R/U/N: spirv-val %t.spv | ||
; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s | ||
OpCapability Addresses | ||
OpCapability Kernel | ||
OpMemoryModel Physical64 OpenCL | ||
OpEntryPoint Kernel %f "testSizeOf" | ||
OpName %p "p" | ||
%void = OpTypeVoid | ||
%bool = OpTypeBool | ||
%i32 = OpTypeInt 32 0 | ||
%struct = OpTypeStruct %i32 %i32 | ||
%_ptr_CrossWorkgroup_bool = OpTypePointer CrossWorkgroup %bool | ||
%_ptr_CrossWorkgroup_i32 = OpTypePointer CrossWorkgroup %i32 | ||
%_ptr_CrossWorkgroup_struct = OpTypePointer CrossWorkgroup %struct | ||
%fnTy = OpTypeFunction %void %_ptr_CrossWorkgroup_i32 | ||
|
||
%f = OpFunction %void None %fnTy | ||
%p = OpFunctionParameter %_ptr_CrossWorkgroup_i32 | ||
%10 = OpLabel | ||
|
||
; CHECK: store i32 1, ptr addrspace(1) %p | ||
%11 = OpSizeOf %i32 %_ptr_CrossWorkgroup_bool | ||
OpStore %p %11 | ||
|
||
; CHECK: store i32 8, ptr addrspace(1) %p | ||
%12 = OpSizeOf %i32 %_ptr_CrossWorkgroup_struct | ||
OpStore %p %12 | ||
|
||
OpReturn | ||
OpFunctionEnd |