[MLIR][Math] Add round operation
authorlorenzo chelini <l.chelini@icloud.com>
Thu, 2 Jun 2022 14:49:23 +0000 (16:49 +0200)
committerlorenzo chelini <l.chelini@icloud.com>
Wed, 8 Jun 2022 11:07:39 +0000 (13:07 +0200)
commita0fc94ab618973dc4454d0695abb104f6a8644d2
tree3b2db3004e6f29155f2b8a0c9ed3be266e4c04ae
parent27f970aac8218b022f8b9282dcd47adb2c66cbb4
[MLIR][Math] Add round operation

Introduce RoundOp in the math dialect. The operation rounds the operand to the
nearest integer value in floating-point format. RoundOp lowers to LLVM
intrinsics 'llvm.intr.round' or as a function call to libm (round or roundf).

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D127286
mlir/include/mlir/Dialect/Math/IR/MathOps.td
mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp
mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
mlir/test/Conversion/MathToLLVM/math-to-llvm.mlir
mlir/test/Conversion/MathToLibm/convert-to-libm.mlir
mlir/test/Dialect/Math/ops.mlir