diff --git a/nc_optimisation.cmake b/nc_optimisation.cmake index 4bd5632..14e2cc9 100644 --- a/nc_optimisation.cmake +++ b/nc_optimisation.cmake @@ -65,9 +65,25 @@ canonical_host() ##----------------------------------------------------------------------------- if (${host_cpu} STREQUAL "x86_64") + # Explicitly qualify the CPU as the minimum viable architecture, but tune + # for common platforms. This might prevent some invalid instructions being + # emitted. + append_compile_flag(-march=x86-64) append_compile_flag(-mtune=generic) - append_compile_flag(-msse3) - append_compile_flag(-msahf) + + append_compile_flag(-msse) + append_compile_flag(-msse2) + append_compile_flag(-mno-sse3) + append_compile_flag(-mssse3) + append_compile_flag(-mno-avx) + append_compile_flag(-mno-avx2) + + # These instructions should always be available on reasonable platforms. + # They're almost 20 years old at this point. + #append_compile_flag(-msse) + #append_compile_flag(-msse2) + # append_compile_flag(-mssse3) + # append_compile_flag(-msahf) elseif (${host_cpu} STREQUAL "i686") append_compile_flag(-march=prescott) append_compile_flag(-mtune=generic)