[MLIR][Standard] Add log1p operation to std

Differential Revision: https://reviews.llvm.org/D95041
This commit is contained in:
Frederik Gossen 2021-01-20 18:52:55 +01:00
parent 719b563ecf
commit cc4244d55f
2 changed files with 32 additions and 0 deletions

View File

@ -1942,10 +1942,39 @@ def LogOp : FloatUnaryOp<"log"> {
let summary = "base-e logarithm of the specified value";
}
//===----------------------------------------------------------------------===//
// Log10Op
//===----------------------------------------------------------------------===//
def Log10Op : FloatUnaryOp<"log10"> {
let summary = "base-10 logarithm of the specified value";
}
//===----------------------------------------------------------------------===//
// Log1pOp
//===----------------------------------------------------------------------===//
def Log1pOp : FloatUnaryOp<"log1p"> {
let summary = "Computes the natural logarithm of one plus the given value";
let description = [{
Computes the base-e logarithm of one plus the given value. It takes one
operand and returns one result of the same type.
log1p(x) := log(1 + x)
Example:
```mlir
%y = log1p %x : f64
```
}];
}
//===----------------------------------------------------------------------===//
// Log2Op
//===----------------------------------------------------------------------===//
def Log2Op : FloatUnaryOp<"log2"> {
let summary = "base-2 logarithm of the specified value";
}

View File

@ -596,6 +596,9 @@ func @standard_instrs(tensor<4x4x?xf32>, f32, i32, index, i64, f16) {
// CHECK: %{{[0-9]+}} = ceildivi_signed %cst_4, %cst_4 : tensor<42xi32>
%174 = ceildivi_signed %tci32, %tci32 : tensor<42 x i32>
// CHECK: %{{[0-9]+}} = log1p %arg1 : f32
%175 = log1p %f : f32
return
}