Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/OpBitcast_ptr_scalar.spvasm

raw
1 ; Check support of OpBitcast with pointer operands
2 ; Converts to scalar integers, which is supported by all SPIR-V versions
3
4 ; REQUIRES: spirv-as
5 ; RUN: spirv-as --target-env spv1.0 -o %t.spv %s
6 ; RUN: spirv-val %t.spv
7 ; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
8 ; RUN: llvm-dis %t.rev.bc
9 ; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM
10 OpCapability Addresses
11 OpCapability Kernel
12 OpCapability Int64
13 OpMemoryModel Physical64 OpenCL
14 OpEntryPoint Kernel %kernel "test"
15 %uint = OpTypeInt 32 0
16 %ulong = OpTypeInt 64 0
17 %void = OpTypeVoid
18 %pptr_int = OpTypePointer Function %uint
19 %kernel_sig = OpTypeFunction %void
20 %kernel = OpFunction %void None %kernel_sig
21 %entry = OpLabel
22 %srcptr = OpVariable %pptr_int Function
23 %dstint = OpBitcast %ulong %srcptr
24 %dstptr = OpBitcast %pptr_int %dstint
25 OpReturn
26 OpFunctionEnd
27
28
29 ; CHECK-LLVM: [[SRCPTR:%[a-z0-9.]+]] = alloca i32, align 4
30 ; CHECK-LLVM: [[DSTINT:%[a-z0-9.]+]] = ptrtoint ptr [[SRCPTR]] to i64
31 ; CHECK-LLVM: [[DSTPTR:%[a-z0-9.]+]] = inttoptr i64 [[DSTINT]] to ptr