Skip to content

Commit

Permalink
Merge pull request #154 from Xilinx/corentin.add_missing_libm
Browse files Browse the repository at this point in the history
[FXML-4376] Add missing Libm member Math operations to MathToLibm
  • Loading branch information
cferry-AMD authored Apr 8, 2024
2 parents 36f7315 + 78d3d76 commit 23171db
Show file tree
Hide file tree
Showing 2 changed files with 376 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ ScalarOpToLibmCall<Op>::matchAndRewrite(Op op,
void mlir::populateMathToLibmConversionPatterns(RewritePatternSet &patterns) {
MLIRContext *ctx = patterns.getContext();

populatePatternsForOp<math::AbsFOp>(patterns, ctx, "fabsf", "fabs");
populatePatternsForOp<math::AcosOp>(patterns, ctx, "acosf", "acos");
populatePatternsForOp<math::Atan2Op>(patterns, ctx, "atan2f", "atan2");
populatePatternsForOp<math::AtanOp>(patterns, ctx, "atanf", "atan");
Expand All @@ -172,13 +173,21 @@ void mlir::populateMathToLibmConversionPatterns(RewritePatternSet &patterns) {
populatePatternsForOp<math::CosOp>(patterns, ctx, "cosf", "cos");
populatePatternsForOp<math::CoshOp>(patterns, ctx, "coshf", "cosh");
populatePatternsForOp<math::ErfOp>(patterns, ctx, "erff", "erf");
populatePatternsForOp<math::ExpOp>(patterns, ctx, "expf", "exp");
populatePatternsForOp<math::Exp2Op>(patterns, ctx, "exp2f", "exp2");
populatePatternsForOp<math::ExpM1Op>(patterns, ctx, "expm1f", "expm1");
populatePatternsForOp<math::FloorOp>(patterns, ctx, "floorf", "floor");
populatePatternsForOp<math::FmaOp>(patterns, ctx, "fmaf", "fma");
populatePatternsForOp<math::LogOp>(patterns, ctx, "logf", "log");
populatePatternsForOp<math::Log2Op>(patterns, ctx, "log2f", "log2");
populatePatternsForOp<math::Log10Op>(patterns, ctx, "log10f", "log10");
populatePatternsForOp<math::Log1pOp>(patterns, ctx, "log1pf", "log1p");
populatePatternsForOp<math::PowFOp>(patterns, ctx, "powf", "pow");
populatePatternsForOp<math::RoundEvenOp>(patterns, ctx, "roundevenf",
"roundeven");
populatePatternsForOp<math::RoundOp>(patterns, ctx, "roundf", "round");
populatePatternsForOp<math::SinOp>(patterns, ctx, "sinf", "sin");
populatePatternsForOp<math::SqrtOp>(patterns, ctx, "sqrtf", "sqrt");
populatePatternsForOp<math::TanOp>(patterns, ctx, "tanf", "tan");
populatePatternsForOp<math::TanhOp>(patterns, ctx, "tanhf", "tanh");
populatePatternsForOp<math::TruncOp>(patterns, ctx, "truncf", "trunc");
Expand Down
Loading

0 comments on commit 23171db

Please sign in to comment.