[llvm] CodeGen: Add -denormal-fp-math-bf16 flag (PR #90425)

Freddy Ye via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 06:11:50 PDT 2024


FreddyLeaf wrote:

> Does X86 actually have a separately controllable bfloat denormal mode? This does not _control_ the mode. It only informs the code generator that this is the mode. Without an underlying mode control bit, this is not correct/useful

You are right, currently X86 hardware now only has control bit on denormal mode for f32/f64 (in MXCSR IIRC). But even for attribute of `-denormal-fp-math`, I didn't find separate backend handlings on different attribute values. The motivation of this patch is to respect `-denormal-fp-math` for x86 backend, since all x86 bf16 instructions have only one denormal mode, which is flush to zero both for input and output. It can't respect for `ieee` and `dynamic`. If the attribute is set to other than "preserve-sign", I was considering to handle it by something like expand bf16 to f32. Anyway, I'm ok to continue to ignore -denormal-fp-math on this. And I'm interested if other targets also have this issue on bf16 and future variants of fp8.

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


More information about the llvm-commits mailing list