From a43bb5d3d438ddff81800ee53ab9c487ea6a4dda Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Sun, 13 Oct 2019 12:16:24 +0000 Subject: [PATCH] Use avx or neon for auto-vectorisation --- meson.build | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/meson.build b/meson.build index 35d4762..07a203e 100644 --- a/meson.build +++ b/meson.build @@ -13,6 +13,22 @@ add_project_arguments([ '-fvisibility=hidden', ], language: 'c') +cpu = host_machine.cpu_family() + +if cpu == 'x86_64' + arch_args = [ + '-mavx', + ] +elif cpu == 'arm' or cpu == 'aarch64' + arch_args = [ + '-mfpu=neon', + ] +else + arch_args = [] +endif + +add_project_arguments(arch_args, language: 'c') + cc = meson.get_compiler('c') libm = cc.find_library('m', required: false)