Warning: Some posts on this platform may contain adult material intended for mature audiences only. Viewer discretion is advised. By clicking ‘Continue’, you confirm that you are 18 years or older and consent to viewing explicit content.
That’s pretty much exactly how it works already. You compile with -march=x86-64-v4 and it’ll use SSE and AVX all over the place.
glibc does the runtime thing, but only once on application startup where the dynamic linker will link the version of the function optimized for your CPU. But it’s a manual process on glibc’s part, the variants are written by hand.
Not every project cares enough to do it dynamically like that and it would be a nightmare that way.
The fallback is, recompile with -march=x86-64 which will only use the base set of instructions. Or -march=i486 if you want to run on absolutely ancient hardware.
That’s pretty much exactly how it works already. You compile with
-march=x86-64-v4
and it’ll use SSE and AVX all over the place.glibc does the runtime thing, but only once on application startup where the dynamic linker will link the version of the function optimized for your CPU. But it’s a manual process on glibc’s part, the variants are written by hand.
Not every project cares enough to do it dynamically like that and it would be a nightmare that way.
The fallback is, recompile with
-march=x86-64
which will only use the base set of instructions. Or-march=i486
if you want to run on absolutely ancient hardware.