diff options
author | kcgen <kcgen@users.noreply.github.com> | 2022-04-04 23:54:19 +0300 |
---|---|---|
committer | kcgen <kcgen@users.noreply.github.com> | 2022-04-05 01:17:48 +0300 |
commit | 934c9efc3f495a8356316c6b7dc2228e738313df (patch) | |
tree | b8d6d55194bf2669e32be5eab0b18f941f64fe62 | |
parent | 4c510ff7dddf9aa177df8e41d5224b8789db2be6 (diff) |
Allow compilation with native CPU optimizationskc/use-native-opts-1
-rw-r--r-- | meson.build | 18 | ||||
-rw-r--r-- | meson_options.txt | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/meson.build b/meson.build index d5d72b69c..1e16ab238 100644 --- a/meson.build +++ b/meson.build @@ -62,6 +62,24 @@ if prefers_static_libs else extra_flags += ['-shared-libstdc++', '-shared-libgcc', '-fPIC'] endif + +# Optional native CPU (and extra) optimizations +if get_option('use_native') == true + extra_flags += [ + '-Ofast', + '-march=native', + '-mtune=native', + '-fipa-pta', + '-ffast-math', + '-mfpmath=both', + '-funroll-loops', + '-fgraphite-identity', + '-floop-nest-optimize', + '-malign-data=cacheline', + '-fdevirtualize-at-ltrans', + '-fno-semantic-interposition'] +endif + foreach flag : extra_flags if cc.has_argument(flag) add_project_arguments(flag, language : 'c') diff --git a/meson_options.txt b/meson_options.txt index 0bcd734bc..6631ce0bc 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -16,6 +16,9 @@ option('use_png', type : 'boolean', value : true, option('use_slirp', type : 'boolean', value : true, description : 'Enable Ethernet emulation using Libslirp') +option('use_native', type : 'boolean', value : false, + description : 'Enable native CPU instructions and extra optimizations') + # This option exists only for rare situations when Linux developer cannot # install ALSA library headers on their machine. # |