On 3/6/18 11:45 AM, Sitsofe Wheeler wrote: >> BTW, another (and probably more problematic) issue is that the >> compiler may well have support for sse/avx/avx512, while the >> machine it's run on does not. If we enable the instruction set >> based on that, we could be seeing illegal instructions outside >> just the memcpy test. And that would be a concern, since it would >> prevent fio from running at all. >> >> I think we have to make it something like the below because of that. > > If someone forces SSE on then by all means we should add it to the > CFLAGS but if they haven't and we can compile a program which uses > headers/instructions that are only available when SSE is enabled then > can't we deduce that the user is happy for those instructions to be in > their code? Right, _if_ they turn it on. The initial patch did it unconditionally, this followup patch adds the option to turn it on, while defaulting to not enabling sse. We can't add -msse if gcc decides to enable SSE memcpy, for instance, which will then fail with SIGILL if the machine doesn't support it. > [...] >> +########################################## >> +# sse probe >> +sse="no" >> +cat > $TMPC << EOF >> +#include <xmmintrin.h> >> +#include <immintrin.h> >> +int main(int argc, char **argv) >> +{ >> + __m128 val; >> + float const *src = NULL; >> + float *dst = NULL; >> + val = _mm_load_ps(src); >> + _mm_store_ps(dst, val); >> + return 0; >> +} > > We could try and use __builtin_ia32_addps (from > https://gcc.gnu.org/onlinedocs/gcc/x86-Built-in-Functions.html#x86-Built-in-Functions Sure >> +EOF >> +if test "$enable_sse" = "yes" && compile_prog "-msse" "" "sse"; then >> + sse="yes" >> +fi >> +print_config "SSE (compiler)" "$sse" > > Here we wouldn't explicitly add -msse because we would have already > added it to the global CFLAGS if forced or depended on the user's > particular compiler flags if not. It's only enabled IFF the global flag (--enable-sse) is set AND the configure test passes. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html