[Mlir-commits] [mlir] [mlir][arith] Add `arith.flush_denormals` operation (PR #192641)

Benoit Jacob llvmlistbot at llvm.org
Fri Apr 17 06:20:11 PDT 2026


bjacob wrote:

> Global status register. E.g., on x86_64, the above example can lower to _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); r = a + b; _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_OFF); _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_OFF);. Subsequent ON-OFF-ON switches can be folded away.

^ That is going to be inefficient, I can't see that being the right choice on any architecture.

On architectures that do not have a dedicated FTZ instruction, simply lower to bit manipulation (your 3rd option). Because denormals (along with the value 0) are identified by having all exponent bits set to zero, so it's going to be a very simple bit-masking operation: "If exponent bits are all zero, then return 0".

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


More information about the Mlir-commits mailing list