annotate mlir/test/Dialect/LLVMIR/opaque-ptr.mlir @ 236:c4bab56944e8 llvm-original

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