236
|
1 // RUN: mlir-opt %s | mlir-opt | FileCheck %s
|
|
2
|
|
3 // CHECK-LABEL: @opaque_ptr_load
|
|
4 llvm.func @opaque_ptr_load(%arg0: !llvm.ptr) -> i32 {
|
|
5 // CHECK: = llvm.load %{{.*}} : !llvm.ptr -> i32
|
|
6 %0 = llvm.load %arg0 : !llvm.ptr -> i32
|
|
7 llvm.return %0 : i32
|
|
8 }
|
|
9
|
|
10 // CHECK-LABEL: @opaque_ptr_store
|
|
11 llvm.func @opaque_ptr_store(%arg0: i32, %arg1: !llvm.ptr){
|
|
12 // CHECK: llvm.store %{{.*}}, %{{.*}} : i32, !llvm.ptr
|
|
13 llvm.store %arg0, %arg1 : i32, !llvm.ptr
|
|
14 llvm.return
|
|
15 }
|
|
16
|
|
17 // CHECK-LABEL: @opaque_ptr_ptr_store
|
|
18 llvm.func @opaque_ptr_ptr_store(%arg0: !llvm.ptr, %arg1: !llvm.ptr) {
|
|
19 // CHECK: llvm.store %{{.*}}, %{{.*}} : !llvm.ptr, !llvm.ptr
|
|
20 llvm.store %arg0, %arg1 : !llvm.ptr, !llvm.ptr
|
|
21 llvm.return
|
|
22 }
|
|
23
|
|
24 // CHECK-LABEL: @opaque_ptr_alloca
|
|
25 llvm.func @opaque_ptr_alloca(%arg0: i32) -> !llvm.ptr {
|
|
26 // CHECK: llvm.alloca %{{.*}} x f32 : (i32) -> !llvm.ptr
|
|
27 %0 = llvm.alloca %arg0 x f32 : (i32) -> !llvm.ptr
|
|
28 llvm.return %0 : !llvm.ptr
|
|
29 }
|
|
30
|
|
31 // CHECK-LABEL: @opaque_ptr_gep
|
|
32 llvm.func @opaque_ptr_gep(%arg0: !llvm.ptr, %arg1: i32) -> !llvm.ptr {
|
|
33 // CHECK: = llvm.getelementptr %{{.*}}[%{{.*}}] : (!llvm.ptr, i32) -> !llvm.ptr, f32
|
|
34 %0 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i32) -> !llvm.ptr, f32
|
|
35 llvm.return %0 : !llvm.ptr
|
|
36 }
|
|
37
|
|
38 // CHECK-LABEL: @opaque_ptr_gep_struct
|
|
39 llvm.func @opaque_ptr_gep_struct(%arg0: !llvm.ptr, %arg1: i32) -> !llvm.ptr {
|
|
40 // CHECK: = llvm.getelementptr %{{.*}}[%{{.*}}, 0, 1]
|
|
41 // CHECK: : (!llvm.ptr, i32) -> !llvm.ptr, !llvm.struct<(struct<(f32, f64)>, struct<(i32, i64)>)>
|
|
42 %0 = llvm.getelementptr %arg0[%arg1, 0, 1] : (!llvm.ptr, i32) -> !llvm.ptr, !llvm.struct<(struct<(f32, f64)>, struct<(i32, i64)>)>
|
|
43 llvm.return %0 : !llvm.ptr
|
|
44 }
|
|
45
|
|
46 // CHECK-LABEL: @opaque_ptr_matrix_load_store
|
|
47 llvm.func @opaque_ptr_matrix_load_store(%ptr: !llvm.ptr, %stride: i64) -> vector<48 x f32> {
|
|
48 // CHECK: = llvm.intr.matrix.column.major.load
|
|
49 // CHECK: vector<48xf32> from !llvm.ptr stride i64
|
|
50 %0 = llvm.intr.matrix.column.major.load %ptr, <stride=%stride>
|
|
51 { isVolatile = 0: i1, rows = 3: i32, columns = 16: i32} :
|
|
52 vector<48 x f32> from !llvm.ptr stride i64
|
|
53 // CHECK: llvm.intr.matrix.column.major.store
|
|
54 // CHECK: vector<48xf32> to !llvm.ptr stride i64
|
|
55 llvm.intr.matrix.column.major.store %0, %ptr, <stride=%stride>
|
|
56 { isVolatile = 0: i1, rows = 3: i32, columns = 16: i32} :
|
|
57 vector<48 x f32> to !llvm.ptr stride i64
|
|
58 llvm.return %0 : vector<48 x f32>
|
|
59 }
|
|
60
|
|
61 // CHECK-LABEL: @opaque_ptr_masked_load
|
|
62 llvm.func @opaque_ptr_masked_load(%arg0: !llvm.ptr, %arg1: vector<7xi1>) -> vector<7xf32> {
|
|
63 // CHECK: = llvm.intr.masked.load
|
|
64 // CHECK: (!llvm.ptr, vector<7xi1>) -> vector<7xf32>
|
|
65 %0 = llvm.intr.masked.load %arg0, %arg1 { alignment = 1: i32} :
|
|
66 (!llvm.ptr, vector<7xi1>) -> vector<7xf32>
|
|
67 llvm.return %0 : vector<7 x f32>
|
|
68 }
|
|
69
|
|
70 // CHECK-LABEL: @opaque_ptr_gather
|
|
71 llvm.func @opaque_ptr_gather(%M: !llvm.vec<7 x ptr>, %mask: vector<7xi1>) -> vector<7xf32> {
|
|
72 // CHECK: = llvm.intr.masked.gather
|
|
73 // CHECK: (!llvm.vec<7 x ptr>, vector<7xi1>) -> vector<7xf32>
|
|
74 %a = llvm.intr.masked.gather %M, %mask { alignment = 1: i32} :
|
|
75 (!llvm.vec<7 x ptr>, vector<7xi1>) -> vector<7xf32>
|
|
76 llvm.return %a : vector<7xf32>
|
|
77 }
|