| Issue |
109075
|
| Summary |
[Clang] -Wnan-infinity-disabled is annoying in SIMD code
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
Myriachan
|
The `-Wnan-infinity-disabled` warning added in Clang 18 is annoying when working with SIMD. The kinds of programs that use SIMD code often enable `-ffast-math` for the same reason SIMD is being used in the first place. The warning being enabled by default interferes with libraries. libc++ itself would trigger the warning in `#include <limits>` if Clang weren't suppressing warnings in system headers.
Example of SIMD code that trips up the warning (stripped from the original):
```
#include <immintrin.h>
#define FLOAT_TRUE_MASK (-__builtin_nanf("0x3FFFFF"))
__m128 TestFunction(__m128 v)
{
return _mm_and_ps(v, _mm_setr_ps(FLOAT_TRUE_MASK, 0.0f, FLOAT_TRUE_MASK, 0.0f));
}
```
Yes, it's undefined behavior, but it's also a common thing to do in SIMD code. This isn't a bug, just a coding annoyance.
By the way, it's nice that Clang sees through the masking and just does `vxorps` + `vblendps`. It recognized `0xFFFFFFFF` despite coming from floating-point.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs