[flang-commits] [flang] [mlir] [RFC][mlir] Conditional support for fast-math attributes. (PR #125620)

Diego Caballero via flang-commits flang-commits at lists.llvm.org
Tue Feb 4 11:44:55 PST 2025


dcaballe wrote:

> > For example, it enables vectorization of loops with min/max reductions in LLVM. Flang is currently producing `arith.select` without fast-math attrs.
> > In general, in LLVM any instruction that produces a floating point result may have fast-math flags. This includes FP PHIs and selects.
> 
> Can you link to some example that shows why this is necessary? I'd think that `arith.select` preserves bitpatterns of its operands, so I struggle to see why it needs fast math flags; if llvm needs them, couldn't it calculate them as the intersection of the fast math flags of the operands?

I was asking myself the same question. I guess if an `arith.select` has `nnan` and one of the inputs is NaN we could turn it into poison...

https://github.com/llvm/llvm-project/pull/125620


More information about the flang-commits mailing list