|
3 | 3 | ; RUN: llvm-spirv %t.spv -to-text -o %t.spt
|
4 | 4 | ; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
|
5 | 5 |
|
6 |
| -; TODO: come up with an approach and implement reverse translation |
7 |
| -; R/UN: llvm-spirv -r %t.spv -o %t.rev.bc |
8 |
| -; R/UN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM |
| 6 | +; RUN: llvm-spirv -r %t.spv -o %t.rev.bc |
| 7 | +; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM |
9 | 8 |
|
10 | 9 | ; CHECK-SPIRV: TypeInt [[#TypeInt:]] 32 0
|
11 | 10 | ; CHECK-SPIRV-DAG: Constant [[#TypeInt]] [[#Const0:]] 0
|
|
15 | 14 | ; CHECK-SPIRV-DAG: Constant [[#TypeInt]] [[#Const42:]] 42
|
16 | 15 |
|
17 | 16 | ; CHECK-SPIRV: TypeCooperativeMatrixKHR [[#TypeMatrix:]] [[#TypeInt]] [[#Const3]] [[#Const12]] [[#Const12]] [[#Const0]]
|
18 |
| -; CHECK-SPIRV: TypePointer [[#Type:]] 7 [[#TypeInt]] |
| 17 | +; CHECK-SPIRV: TypePointer [[#TypeMatrixPtr:]] 7 [[#TypeMatrix]] |
| 18 | +; CHECK-SPIRV: TypePointer [[#TypeIntPtr:]] 7 [[#TypeInt]] |
19 | 19 |
|
| 20 | +; CHECK-SPIRV: Variable [[#TypeMatrixPtr]] [[#VarMatrixPtr:]] 7 |
20 | 21 | ; CHECK-SPIRV: CompositeConstruct [[#TypeMatrix]] [[#Composite:]] [[#Const0]]
|
21 |
| -; CHECK-SPIRV: AccessChain [[#Type]] [[#Res:]] [[#Composite]] [[#Const1]] |
| 22 | +; CHECK-SPIRV: Store [[#VarMatrixPtr]] [[#Composite]] |
| 23 | +; CHECK-SPIRV: AccessChain [[#TypeIntPtr]] [[#Res:]] [[#VarMatrixPtr]] [[#Const1]] |
22 | 24 | ; CHECK-SPIRV: Store [[#Res]] [[#Const42]]
|
23 | 25 |
|
| 26 | +; CHECK-LLVM: %0 = alloca target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 0) |
| 27 | +; CHECK-LLVM: %Obj = call spir_func target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 0) @_Z26__spirv_CompositeConstructi(i32 0) |
| 28 | +; CHECK-LLVM: store target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 0) %Obj, ptr %0 |
| 29 | +; CHECK-LLVM: %call = call spir_func ptr @_Z19__spirv_AccessChainPPU3AS144__spirv_CooperativeMatrixKHR__uint_3_12_12_0i(ptr %0, i32 1) |
| 30 | +; CHECK-LLVM: store i32 42, ptr %call |
24 | 31 |
|
25 | 32 | target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
26 | 33 | target triple = "spir64-unknown-unknown"
|
27 | 34 |
|
28 | 35 | ; Function Attrs: mustprogress uwtable
|
29 | 36 | define dso_local void @_Z3fooi(i32 noundef %idx) local_unnamed_addr #0 {
|
30 | 37 | entry:
|
| 38 | + %0 = alloca target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 0), align 8 |
31 | 39 | %Obj = tail call spir_func noundef target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 0) @_Z26__spirv_CompositeConstruct(i32 noundef 0) #4
|
32 |
| - %call = call noundef ptr @_Z19__spirv_AccessChainP6Matrixii(target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 0) %Obj, i32 noundef 1) |
| 40 | + store target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 0) %Obj, ptr %0, align 8 |
| 41 | + %call = call noundef ptr @_Z19__spirv_AccessChainP6Matrixii(ptr %0, i32 noundef 1) |
33 | 42 | call void @_Z13__spirv_StorePii(ptr noundef %call, i32 noundef 42)
|
34 | 43 | ret void
|
35 | 44 | }
|
36 | 45 |
|
37 | 46 | declare dso_local spir_func noundef target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 0) @_Z26__spirv_CompositeConstruct(i32 noundef) local_unnamed_addr #2
|
38 | 47 |
|
39 |
| -declare noundef ptr @_Z19__spirv_AccessChainP6Matrixii(target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 0) noundef, i32 noundef) local_unnamed_addr #2 |
| 48 | +declare noundef ptr @_Z19__spirv_AccessChainP6Matrixii(ptr noundef, i32 noundef) local_unnamed_addr #2 |
40 | 49 |
|
41 | 50 | declare void @_Z13__spirv_StorePii(ptr noundef, i32 noundef) local_unnamed_addr #2
|
42 | 51 |
|
|
0 commit comments