[Mlir-commits] [mlir] [mlir][math] Add FP software implementation lowering pass: math-to-apfloat (PR #171221)
Matthias Springer
llvmlistbot at llvm.org
Wed Dec 17 01:27:46 PST 2025
================
@@ -0,0 +1,76 @@
+// REQUIRES: system-linux || system-darwin
+// TODO: Run only on Linux until we figure out how to build
+// mlir_apfloat_wrappers in a platform-independent way.
+
+// Case 1: All floating-point arithmetics is lowered through APFloat.
+// RUN: mlir-opt %s --convert-math-to-apfloat --convert-to-llvm | \
+// RUN: mlir-runner -e entryfp8 --entry-point-result=void \
+// RUN: --shared-libs=%mlir_c_runner_utils \
+// RUN: --shared-libs=%mlir_apfloat_wrappers | FileCheck %s --check-prefix=CHECK-FP8
+
+// Case 2: Only unsupported arithmetics is lowered through APFloat.
----------------
matthias-springer wrote:
I think it would be more interesting to also lower f32 to APFloat emulation. The reason why I had Case 1 and Case 2 in the other test case is to show that the order of the two passes `--convert-math-to-apfloat --convert-to-llvm` matters. We already did that in the other `test-apfloat-emulation` integration test. We don't get any extra test coverage by lowering to LLVM.
I'll leave it up to you, but I would drop Case 2 and use a single FileCheck and entry func for both f8 and f32.
https://github.com/llvm/llvm-project/pull/171221
More information about the Mlir-commits
mailing list