forked from KhronosGroup/SPIRV-LLVM-Translator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OpConvertPtrToU and OpConvertUToPtr tests
- Loading branch information
1 parent
9ed3c9d
commit cf70d1f
Showing
5 changed files
with
118 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
; REQUIRES: spirv-as | ||
; RUN: spirv-as --target-env spv1.0 -o %t.spv %s | ||
; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s | ||
OpCapability Addresses | ||
OpCapability Kernel | ||
OpCapability Int16 | ||
OpMemoryModel Physical32 OpenCL | ||
OpEntryPoint Kernel %1 "testNarrowingPtrToU" | ||
OpName %a "a" | ||
OpName %res "res" | ||
OpName %entry "entry" | ||
%uint = OpTypeInt 32 0 | ||
%ushort = OpTypeInt 16 0 | ||
%void = OpTypeVoid | ||
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint | ||
%_ptr_CrossWorkgroup_ushort = OpTypePointer CrossWorkgroup %ushort | ||
%17 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_ushort | ||
%1 = OpFunction %void None %17 | ||
%a = OpFunctionParameter %_ptr_CrossWorkgroup_uint | ||
%res = OpFunctionParameter %_ptr_CrossWorkgroup_ushort | ||
%entry = OpLabel | ||
%18 = OpConvertPtrToU %ushort %a | ||
OpStore %res %18 Aligned 2 | ||
OpReturn | ||
OpFunctionEnd | ||
|
||
; CHECK: ptrtoint i32 addrspace(1)* %a to i16 |
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,27 @@ | ||
; REQUIRES: spirv-as | ||
; RUN: spirv-as --target-env spv1.0 -o %t.spv %s | ||
; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s | ||
OpCapability Addresses | ||
OpCapability Kernel | ||
OpCapability Int64 | ||
OpMemoryModel Physical32 OpenCL | ||
OpEntryPoint Kernel %1 "testWideningPtrToU" | ||
OpName %a "a" | ||
OpName %res "res" | ||
OpName %entry "entry" | ||
%uint = OpTypeInt 32 0 | ||
%ulong = OpTypeInt 64 0 | ||
%void = OpTypeVoid | ||
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint | ||
%_ptr_CrossWorkgroup_ulong = OpTypePointer CrossWorkgroup %ulong | ||
%17 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_ulong | ||
%1 = OpFunction %void None %17 | ||
%a = OpFunctionParameter %_ptr_CrossWorkgroup_uint | ||
%res = OpFunctionParameter %_ptr_CrossWorkgroup_ulong | ||
%entry = OpLabel | ||
%18 = OpConvertPtrToU %ulong %a | ||
OpStore %res %18 Aligned 8 | ||
OpReturn | ||
OpFunctionEnd | ||
|
||
; CHECK: ptrtoint i32 addrspace(1)* %a to i64 |
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,25 @@ | ||
; REQUIRES: spirv-as | ||
; RUN: spirv-as --target-env spv1.0 -o %t.spv %s | ||
; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s | ||
OpCapability Addresses | ||
OpCapability Kernel | ||
OpCapability Int64 | ||
OpMemoryModel Physical32 OpenCL | ||
OpEntryPoint Kernel %1 "testNarrowingUToPtr" | ||
OpName %a "a" | ||
OpName %entry "entry" | ||
%uint = OpTypeInt 32 0 | ||
%uint_0 = OpConstant %uint 0 | ||
%ulong = OpTypeInt 64 0 | ||
%void = OpTypeVoid | ||
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint | ||
%9 = OpTypeFunction %void %ulong | ||
%1 = OpFunction %void None %9 | ||
%a = OpFunctionParameter %ulong | ||
%entry = OpLabel | ||
%10 = OpConvertUToPtr %_ptr_CrossWorkgroup_uint %a | ||
OpStore %10 %uint_0 Aligned 4 | ||
OpReturn | ||
OpFunctionEnd | ||
|
||
; CHECK: inttoptr i64 %a to i32 addrspace(1)* |
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,25 @@ | ||
; REQUIRES: spirv-as | ||
; RUN: spirv-as --target-env spv1.0 -o %t.spv %s | ||
; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s | ||
OpCapability Addresses | ||
OpCapability Kernel | ||
OpCapability Int16 | ||
OpMemoryModel Physical32 OpenCL | ||
OpEntryPoint Kernel %1 "testWideningUToPtr" | ||
OpName %a "a" | ||
OpName %entry "entry" | ||
%uint = OpTypeInt 32 0 | ||
%uint_0 = OpConstant %uint 0 | ||
%ushort = OpTypeInt 16 0 | ||
%void = OpTypeVoid | ||
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint | ||
%9 = OpTypeFunction %void %ushort | ||
%1 = OpFunction %void None %9 | ||
%a = OpFunctionParameter %ushort | ||
%entry = OpLabel | ||
%10 = OpConvertUToPtr %_ptr_CrossWorkgroup_uint %a | ||
OpStore %10 %uint_0 Aligned 4 | ||
OpReturn | ||
OpFunctionEnd | ||
|
||
; CHECK: inttoptr i16 %a to i32 addrspace(1)* |
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