Files
clang-p2996/mlir/test/Dialect/Math/polynomial-approximation.mlir
2021-03-01 11:02:07 -08:00

36 lines
890 B
MLIR

// RUN: mlir-opt %s -test-math-polynomial-approximation | FileCheck %s
// Check that all math functions lowered to approximations built from
// standard operations (add, mul, fma, shift, etc...).
// CHECK-LABEL: @scalar
func @scalar(%arg0: f32) -> f32 {
// CHECK-NOT: tanh
%0 = math.tanh %arg0 : f32
// CHECK-NOT: log
%1 = math.log %0 : f32
return %1 : f32
}
// CHECK-LABEL: @vector
func @vector(%arg0: vector<8xf32>) -> vector<8xf32> {
// CHECK-NOT: tanh
%0 = math.tanh %arg0 : vector<8xf32>
// CHECK-NOT: log
%1 = math.log %0 : vector<8xf32>
return %1 : vector<8xf32>
}
// CHECK-LABEL: @exp_scalar
func @exp_scalar(%arg0: f32) -> f32 {
%0 = math.exp %arg0 : f32
return %0 : f32
}
// CHECK-LABEL: @exp_vector
func @exp_vector(%arg0: vector<8xf32>) -> vector<8xf32> {
// CHECK-NOT: math.exp
%0 = math.exp %arg0 : vector<8xf32>
return %0 : vector<8xf32>
}