brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 93aecc5 Raw
32 lines · plain
1; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}3 4;; kernel void testConvertPtrToU(global int *a, global unsigned long *res) {5;;   res[0] = (unsigned long)&a[0];6;; }7 8; CHECK-SPIRV: OpConvertPtrToU9 10define dso_local spir_kernel void @testConvertPtrToU(i32 addrspace(1)* noundef %a, i64 addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {11entry:12  %0 = ptrtoint i32 addrspace(1)* %a to i3213  %1 = zext i32 %0 to i6414  store i64 %1, i64 addrspace(1)* %res, align 815  ret void16}17 18;; kernel void testConvertUToPtr(unsigned long a) {19;;   global unsigned int *res = (global unsigned int *)a;20;;   res[0] = 0;21;; }22 23; CHECK-SPIRV: OpConvertUToPtr24 25define dso_local spir_kernel void @testConvertUToPtr(i64 noundef %a) local_unnamed_addr {26entry:27  %conv = trunc i64 %a to i3228  %0 = inttoptr i32 %conv to i32 addrspace(1)*29  store i32 0, i32 addrspace(1)* %0, align 430  ret void31}32