1// RUN: mlir-opt %s -test-math-polynomial-approximation | FileCheck %s 2 3// Check that all math functions lowered to approximations built from 4// standard operations (add, mul, fma, shift, etc...). 5 6// CHECK-LABEL: @scalar 7func @scalar(%arg0: f32) -> f32 { 8 // CHECK-NOT: tanh 9 %0 = math.tanh %arg0 : f32 10 // CHECK-NOT: log 11 %1 = math.log %0 : f32 12 return %1 : f32 13} 14 15// CHECK-LABEL: @vector 16func @vector(%arg0: vector<8xf32>) -> vector<8xf32> { 17 // CHECK-NOT: tanh 18 %0 = math.tanh %arg0 : vector<8xf32> 19 // CHECK-NOT: log 20 %1 = math.log %0 : vector<8xf32> 21 return %1 : vector<8xf32> 22} 23 24// CHECK-LABEL: @exp_scalar 25func @exp_scalar(%arg0: f32) -> f32 { 26 %0 = math.exp %arg0 : f32 27 return %0 : f32 28} 29 30// CHECK-LABEL: @exp_vector 31func @exp_vector(%arg0: vector<8xf32>) -> vector<8xf32> { 32 // CHECK-NOT: math.exp 33 %0 = math.exp %arg0 : vector<8xf32> 34 return %0 : vector<8xf32> 35} 36