[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 6 10:52:29 PST 2024


andykaylor wrote:

> > I may have mentioned a few times that I don't like function attributes controlling fast-math behaviors.
> 
> It doesn't control it, it's informative. You just get undefined behavior if you end up calling mismatched mode functions.

What I meant to say was that I don't like function attributes controlling compiler behavior related to fast-math options. I'd like to have the abilitity to switch things on and off at the instruction level. That's not really relevant to this PR though.


> It does control it in the AMDGPU entry point function case, since we are more or less directly programming the initial register state on kernel launch in the compiler

Do you only set the register for kernel entries? Is the attribute ignored for other functions?

This is actually similar to how the Intel C/C++ compiler behaves when compiling hosted code. We insert code into the main() function to set MXCSR if that function was compiled with FTZ/DAZ enabled. I think this makes more sense than linking with crtfastmath.o, and it's a lot easier to explain the behavior to users.

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


More information about the cfe-commits mailing list