Skip to content

Commit cc4244d

Browse files
committed
[MLIR][Standard] Add log1p operation to std
Differential Revision: https://reviews.llvm.org/D95041
1 parent 719b563 commit cc4244d

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

mlir/include/mlir/Dialect/StandardOps/IR/Ops.td

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,10 +1942,39 @@ def LogOp : FloatUnaryOp<"log"> {
19421942
let summary = "base-e logarithm of the specified value";
19431943
}
19441944

1945+
//===----------------------------------------------------------------------===//
1946+
// Log10Op
1947+
//===----------------------------------------------------------------------===//
1948+
19451949
def Log10Op : FloatUnaryOp<"log10"> {
19461950
let summary = "base-10 logarithm of the specified value";
19471951
}
19481952

1953+
//===----------------------------------------------------------------------===//
1954+
// Log1pOp
1955+
//===----------------------------------------------------------------------===//
1956+
1957+
def Log1pOp : FloatUnaryOp<"log1p"> {
1958+
let summary = "Computes the natural logarithm of one plus the given value";
1959+
1960+
let description = [{
1961+
Computes the base-e logarithm of one plus the given value. It takes one
1962+
operand and returns one result of the same type.
1963+
1964+
log1p(x) := log(1 + x)
1965+
1966+
Example:
1967+
1968+
```mlir
1969+
%y = log1p %x : f64
1970+
```
1971+
}];
1972+
}
1973+
1974+
//===----------------------------------------------------------------------===//
1975+
// Log2Op
1976+
//===----------------------------------------------------------------------===//
1977+
19491978
def Log2Op : FloatUnaryOp<"log2"> {
19501979
let summary = "base-2 logarithm of the specified value";
19511980
}

mlir/test/IR/core-ops.mlir

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,9 @@ func @standard_instrs(tensor<4x4x?xf32>, f32, i32, index, i64, f16) {
596596
// CHECK: %{{[0-9]+}} = ceildivi_signed %cst_4, %cst_4 : tensor<42xi32>
597597
%174 = ceildivi_signed %tci32, %tci32 : tensor<42 x i32>
598598

599+
// CHECK: %{{[0-9]+}} = log1p %arg1 : f32
600+
%175 = log1p %f : f32
601+
599602
return
600603
}
601604

0 commit comments

Comments
 (0)