From 07fdfa559844403d0836ab0783f201b50a9961af Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Date: Thu, 12 Nov 2015 15:50:00 +0100 Subject: [PATCH] Detect NEON on AArch64 The __ARM_NEON is the standard define for NEON instructions support __ARM_NEON__ is only legacy, and specifically not defined in AArch64 builds, which causes us not to detect NEON support there. The NEON assembler files doesn't build with AArch64, so the NEON drawhelper methods must be excluded for now. Change-Id: Ie32f855bde94ee7efd8a8ddb7766c931778e729b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> --- config.tests/arch/arch.cpp | 2 +- src/corelib/tools/qsimd_p.h | 6 +++++- src/gui/painting/painting.pri | 2 +- src/gui/painting/qdrawhelper.cpp | 4 ++-- src/gui/painting/qdrawhelper_neon.cpp | 4 +--- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/config.tests/arch/arch.cpp b/config.tests/arch/arch.cpp index 7e481d4cf57..c4f23f7bcda 100644 --- a/config.tests/arch/arch.cpp +++ b/config.tests/arch/arch.cpp @@ -237,7 +237,7 @@ const char msg2[] = "==Qt=magic=Qt== Sub-architecture:" #endif // -- ARM -- -#ifdef __ARM_NEON__ +#if defined(__ARM_NEON) || defined(__ARM_NEON__) " neon" #endif #ifdef __IWMMXT__ diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 1e8b3420cf2..12a329f36c6 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -250,9 +250,13 @@ // NEON intrinsics // note: as of GCC 4.9, does not support function targets for ARM -#if defined __ARM_NEON__ +#if defined(__ARM_NEON) || defined(__ARM_NEON__) #include <arm_neon.h> #define QT_FUNCTION_TARGET_STRING_ARM_NEON "neon" +#ifndef __ARM_NEON__ +// __ARM_NEON__ is not defined on AArch64, but we need it in our NEON detection. +#define __ARM_NEON__ +#endif #endif #undef QT_COMPILER_SUPPORTS_SIMD_ALWAYS diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 2e2532a25f2..fd9ae0aacaa 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -101,7 +101,7 @@ SSE4_1_SOURCES += painting/qdrawhelper_sse4.cpp \ painting/qimagescale_sse4.cpp AVX2_SOURCES += painting/qdrawhelper_avx2.cpp -!ios { +!ios:!contains(QT_ARCH, "arm64") { CONFIG += no_clang_integrated_as NEON_SOURCES += painting/qdrawhelper_neon.cpp NEON_HEADERS += painting/qdrawhelper_neon_p.h diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 52843fa113b..988bee9b275 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6309,7 +6309,7 @@ void qt_memfill16(quint16 *dest, quint16 color, int count) qt_memfill_template<quint16>(dest, color, count); } #endif -#if !defined(__SSE2__) && !defined(__ARM_NEON__) +#if !defined(__SSE2__) && (!defined(__ARM_NEON__) || defined(Q_PROCESSOR_ARM_64)) # ifdef QT_COMPILER_SUPPORTS_MIPS_DSP extern "C" void qt_memfill32_asm_mips_dsp(quint32 *, quint32, int); # endif @@ -6425,7 +6425,7 @@ void qInitDrawhelperAsm() #endif // SSE2 -#if defined(__ARM_NEON__) && !defined(Q_OS_IOS) +#if defined(__ARM_NEON__) && !defined(Q_OS_IOS) && !defined(Q_PROCESSOR_ARM_64) qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index 08e564f0179..bf4758afd21 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -31,15 +31,13 @@ ** ****************************************************************************/ -#include <private/qdrawhelper_p.h> +#include <private/qdrawhelper_neon_p.h> #include <private/qblendfunctions_p.h> #include <private/qmath_p.h> #ifdef __ARM_NEON__ -#include <private/qdrawhelper_neon_p.h> #include <private/qpaintengine_raster_p.h> -#include <arm_neon.h> QT_BEGIN_NAMESPACE -- GitLab