Description
This is a MSVC-compatibility issue and relates only to that environent.
We've observed references to_ fltused being issued due to the presence of vector floating point operations.
- According to the MSVC folks, a reference to fltused should be issued in the presence of floating point types, not vectors. The whole fltused thing may precede the existence of vectors :).
- By inspection, the CRT code invoked by referencing fltused fills in a table of handlers used by the CRT related to floating point value conversions to strings, removing trailing zeros from floating point output, ascii to float conversion, etc and locale aware versions. if you ended up in a pathway using these routines without fltused, you should get something like 'floating point not loaded'. Most of the fltused functionality is trying to solve problems similar to the module printf implementation.
- There is some old code related to x86 precision that may also get invoked.
The net is that vectors of floats and operations on them should not trigger the fltused reference and i've confirmed that with MSVC folks. If the code starts to operate on an individual float, then_fltused should get pulled in. There have been some comments previously that this _fltused mechanism was used to prevent vector operation use in the systems code -- that's not accurate.
Demonstration of issue
Code that does loads a vector of floats:
#define __MM_MALLOC_H
#include <xmmintrin.h>
extern float foo[4];
__m128 func() {
__m128 vector1 = _mm_load_ps(foo);
return vector1;
}
This does not generate a reference to fltused on MSVC but does on clang
https://godbolt.org/z/a1v9MdEW7
We see the same behavior with this code:
__m128 multiply_vectors(__m128 a, __m128 b) {
return _mm_mul_ps(a, b);
}
There is a 2 line fix for this issue that t that will be brought as a PR.