| 1 |
; Check support of OpBitcast with pointer operands |
| 2 |
; Converts to vectors of integers, which is supported by SPIR-V 1.5 |
| 3 |
|
| 4 |
; REQUIRES: spirv-as |
| 5 |
; RUN: spirv-as --target-env spv1.5 -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 |
%uint2 = OpTypeVector %uint 2 |
| 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 |
%dstint2 = OpBitcast %uint2 %srcptr |
| 24 |
%dstptr = OpBitcast %pptr_int %dstint2 |
| 25 |
OpReturn |
| 26 |
OpFunctionEnd |
| 27 |
|
| 28 |
|
| 29 |
; CHECK-LLVM: [[SRCPTR:%[a-z0-9.]+]] = alloca i32, align 4 |
| 30 |
; CHECK-LLVM: [[TMPLONG0:%[a-z0-9.]+]] = ptrtoint ptr [[SRCPTR]] to i64 |
| 31 |
; CHECK-LLVM: [[DSTINT2:%[a-z0-9.]+]] = bitcast i64 [[TMPLONG0]] to <2 x i32> |
| 32 |
; CHECK-LLVM: [[TMPLONG1:%[a-z0-9.]+]] = bitcast <2 x i32> [[DSTINT2]] to i64 |
| 33 |
; CHECK-LLVM: [[DSTPTR:%[a-z0-9.]+]] = inttoptr i64 [[TMPLONG1]] to ptr |