ops.mlir
1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// RUN: mlir-opt %s | mlir-opt | FileCheck %s
// RUN: mlir-opt %s --mlir-print-op-generic | mlir-opt | FileCheck %s
// CHECK-LABEL: test_index_cast
func @test_index_cast(%arg0 : index) -> i64 {
%0 = index_cast %arg0 : index to i64
return %0 : i64
}
// CHECK-LABEL: test_index_cast_tensor
func @test_index_cast_tensor(%arg0 : tensor<index>) -> tensor<i64> {
%0 = index_cast %arg0 : tensor<index> to tensor<i64>
return %0 : tensor<i64>
}
// CHECK-LABEL: test_index_cast_tensor_reverse
func @test_index_cast_tensor_reverse(%arg0 : tensor<i64>) -> tensor<index> {
%0 = index_cast %arg0 : tensor<i64> to tensor<index>
return %0 : tensor<index>
}
// CHECK-LABEL: @assert
func @assert(%arg : i1) {
assert %arg, "Some message in case this assertion fails."
return
}
// CHECK-LABEL: @dynamic_tensor_from_elements
func @dynamic_tensor_from_elements(%m : index, %n : index)
-> tensor<?x3x?xf32> {
%tnsr = dynamic_tensor_from_elements %m, %n {
^bb0(%i : index, %j : index, %k : index):
%elem = constant 8.0 : f32
yield %elem : f32
} : tensor<?x3x?xf32>
return %tnsr : tensor<?x3x?xf32>
}
// CHECK-LABEL: @atan
func @atan(%arg : f32) -> f32 {
%result = atan %arg : f32
return %result : f32
}
// CHECK-LABEL: @atan2
func @atan2(%arg0 : f32, %arg1 : f32) -> f32 {
%result = atan2 %arg0, %arg1 : f32
return %result : f32
}