|
| 1 | +; RUN: llvm-as < %s -o %t.bc |
| 2 | +; RUN: llvm-spirv %t.bc -o %t.spv |
| 3 | +; RUN: spirv-val %t.spv |
| 4 | +; RUN: llvm-spirv -to-text %t.spv -o - | FileCheck %s |
| 5 | +; RUN: llvm-spirv -r %t.spv -o %t.rev.bc |
| 6 | +; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM |
| 7 | + |
| 8 | +target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" |
| 9 | +target triple = "spir64-unknown-unknown" |
| 10 | + |
| 11 | +; CHECK: TypeInt [[#Int64Ty:]] 64 0 |
| 12 | +; CHECK: TypeInt [[#Int32Ty:]] 32 0 |
| 13 | +; CHECK: Constant [[#Int32Ty]] [[#ZeroConst:]] 0 |
| 14 | +; CHECK: TypePointer [[#PtrInt32Ty:]] 7 [[#Int32Ty]] |
| 15 | +; CHECK: TypeFunction [[#FTy:]] [[#Int64Ty]] [[#PtrInt32Ty]] |
| 16 | +; CHECK: TypePointer [[#PtrInt64Ty:]] 7 [[#Int64Ty]] |
| 17 | + |
| 18 | +; CHECK: Function [[#Int64Ty]] [[#FuncId:]] 0 [[#FTy]] |
| 19 | +; CHECK: FunctionParameter [[#PtrInt32Ty]] [[#ParamId:]] |
| 20 | +; CHECK: Store [[#ParamId]] [[#ZeroConst]] 2 4 |
| 21 | +; CHECK: Bitcast [[#PtrInt64Ty]] [[#CastId:]] [[#ParamId]] |
| 22 | +; CHECK: Load [[#Int64Ty]] [[#ResultId:]] [[#CastId]] 2 4 |
| 23 | +; CHECK: ReturnValue [[#ResultId]] |
| 24 | + |
| 25 | +; CHECK-LLVM: define spir_func i64 @test(ptr [[p:%.*]]) |
| 26 | +; CHECK-LLVM: store i32 0, ptr [[p]], align 4 |
| 27 | +; CHECK-LLVM: [[bc:%.*]] = bitcast ptr [[p]] to ptr |
| 28 | +; CHECK-LLVM: [[v:%.*]] = load i64, ptr [[bc]], align 4 |
| 29 | + |
| 30 | +define i64 @test(ptr %p) { |
| 31 | + store i32 0, ptr %p, align 4 |
| 32 | + %v = load i64, ptr %p, align 4 |
| 33 | + ret i64 %v |
| 34 | +} |
0 commit comments