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 %2 = math.log2 %1 : f32 13 return %2 : f32 14} 15 16// CHECK-LABEL: @vector 17func @vector(%arg0: vector<8xf32>) -> vector<8xf32> { 18 // CHECK-NOT: tanh 19 %0 = math.tanh %arg0 : vector<8xf32> 20 // CHECK-NOT: log 21 %1 = math.log %0 : vector<8xf32> 22 %2 = math.log2 %1 : vector<8xf32> 23 return %2 : vector<8xf32> 24} 25 26// CHECK-LABEL: @exp_scalar 27func @exp_scalar(%arg0: f32) -> f32 { 28 %0 = math.exp %arg0 : f32 29 return %0 : f32 30} 31 32// CHECK-LABEL: @exp_vector 33func @exp_vector(%arg0: vector<8xf32>) -> vector<8xf32> { 34 // CHECK-NOT: math.exp 35 %0 = math.exp %arg0 : vector<8xf32> 36 return %0 : vector<8xf32> 37} 38