No fastmath attribute on `arith::CmpFOp`

Is there a reason why arith::CmpFOp does not have a fastmath attribute? The corresponding operation in the LLVM dialect (LLVM::FCmpOp) has this flag and thus I assumed that cmpf should have it as well.

I checked the revisions that introduced these flags to the Arith dialect (βš™ D126305 [mlir][arith] Initial support for fastmath flag attributes in the Arithmetic dialect (v2)) and the topic here on discourse ([RFC] FastMath flags support in MLIR (arith dialect)) but there was no mentioning of cmpf anywhere.

It was probably a mistake to add fast math flags to fcmp; it might make sense to not propagate that mistake up through mlir

Could you clarify why this was a mistake?

See __builtin_isnan/__builtin_isfinite should not produce poison with -ffinite-math-only Β· Issue #45422 Β· llvm/llvm-project Β· GitHub and similar issues. The short version is fcmp can be used for guarding code that would trigger edge case behavior and it’s more helpful to consider the inputs on their own

1 Like