[mlir][math] Expand math.exp2 to use math.exp.
authorBalaji V. Iyer <bviyer@gmail.com>
Thu, 13 Apr 2023 15:54:21 +0000 (15:54 +0000)
committerRobert Suderman <suderman@google.com>
Thu, 13 Apr 2023 16:06:04 +0000 (16:06 +0000)
commit4da96515ea8552cdf14c6aa6310d2a91fbe74641
tree1488f1e84330180fb97fa1c9683f792d38e1284f
parentba19fb3bd7e87b749fc1ffe16649150512c6eda4
[mlir][math] Expand math.exp2 to use math.exp.

Exp2 functions are pushed directly to libm. This is problematic for
situations where libm is not available. This patch will expand the exp2
function to use exp2 with the input multiplied by ln2 (natural log).

Reviewed By: rsuderman

Differential Revision: https://reviews.llvm.org/D148064
mlir/include/mlir/Dialect/Math/Transforms/Passes.h
mlir/lib/Dialect/Math/Transforms/ExpandPatterns.cpp
mlir/test/Dialect/Math/expand-math.mlir
mlir/test/lib/Dialect/Math/TestExpandMath.cpp
mlir/test/mlir-cpu-runner/test-expand-math-approx.mlir [new file with mode: 0644]