From 2aae5d2280d02812669ac38e3981692b98de7c10 Mon Sep 17 00:00:00 2001 From: Dor Askayo Date: Sat, 3 Apr 2021 16:37:30 +0300 Subject: [PATCH 1/2] graphene-config: Enable NEON for AArch64 on Linux NEON is fully supported by AArch64. However, GCC doesn't seem to define __ARM_NEON__ or _M_ARM64 for AArch64. Using __aarch64__ should allow a proper detection of this case. --- include/graphene-config.h.meson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/graphene-config.h.meson b/include/graphene-config.h.meson index 949eee7..96192cc 100644 --- a/include/graphene-config.h.meson +++ b/include/graphene-config.h.meson @@ -19,7 +19,7 @@ extern "C" { #mesondefine GRAPHENE_HAS_SSE # endif -# if defined(__ARM_NEON__) || defined (_M_ARM64) +# if defined(__ARM_NEON__) || defined (_M_ARM64) || defined (__aarch64__) #mesondefine GRAPHENE_HAS_ARM_NEON # endif -- 2.31.1 From fbfbdad5a3f38ddbe543ee8c236b4315bba111b9 Mon Sep 17 00:00:00 2001 From: Dor Askayo Date: Sat, 3 Apr 2021 16:40:30 +0300 Subject: [PATCH 2/2] meson: Fix detection of AArch64 on Linux Neither __ARM_EABI__ nor __ARM_NEON__ are defined by GCC for AArch64, and -mfpu=neon is not required as NEON is always supported in AArch64. --- meson.build | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index c96aded..86d8eb8 100644 --- a/meson.build +++ b/meson.build @@ -10,6 +10,7 @@ project('graphene', 'c', cc = meson.get_compiler('c') host_system = host_machine.system() +host_cpu_family = host_machine.cpu_family() add_project_arguments([ '-D_GNU_SOURCE' ], language: 'c') @@ -352,11 +353,13 @@ neon_cflags = [] if get_option('arm_neon') neon_prog = ''' #if !defined (_MSC_VER) || defined (__clang__) -# ifndef __ARM_EABI__ -# error "EABI is required (to be sure that calling conventions are compatible)" -# endif -# ifndef __ARM_NEON__ -# error "No ARM NEON instructions available" +# if !defined (_M_ARM64) && !defined (__aarch64__) +# ifndef __ARM_EABI__ +# error "EABI is required (to be sure that calling conventions are compatible)" +# endif +# ifndef __ARM_NEON__ +# error "No ARM NEON instructions available" +# endif # endif #endif #include @@ -376,7 +379,7 @@ int main () { test_neon_cflags = [] - if cc.get_id() != 'msvc' + if cc.get_id() != 'msvc' and host_cpu_family != 'aarch64' test_neon_cflags += ['-mfpu=neon'] endif -- 2.31.1