1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
4 ;; kernel void testConvertPtrToU(global int *a, global unsigned long *res) {
5 ;; res[0] = (unsigned long)&a[0];
8 ; CHECK-SPIRV: OpConvertPtrToU
10 define dso_local spir_kernel void @testConvertPtrToU(i32 addrspace(1)* noundef %a, i64 addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
12 %0 = ptrtoint i32 addrspace(1)* %a to i32
13 %1 = zext i32 %0 to i64
14 store i64 %1, i64 addrspace(1)* %res, align 8
18 ;; kernel void testConvertUToPtr(unsigned long a) {
19 ;; global unsigned int *res = (global unsigned int *)a;
23 ; CHECK-SPIRV: OpConvertUToPtr
25 define dso_local spir_kernel void @testConvertUToPtr(i64 noundef %a) local_unnamed_addr {
27 %conv = trunc i64 %a to i32
28 %0 = inttoptr i32 %conv to i32 addrspace(1)*
29 store i32 0, i32 addrspace(1)* %0, align 4