From fac68dca46131d63f11c37210834073848f5a93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 11 Nov 2010 10:39:09 +0100 Subject: Don't set -mfpu=neon globally if the compiler supports neon. By default only drawhelpers and image loaders will now use neon. If -mfpu=neon has been explicitly enabled in the mkspec, QT_ALWAYS_HAVE_NEON will be defined, allowing the use of neon intrinsics elsewhere. Task-number: QTBUG-15163 Reviewed-by: Benjamin Poulain --- configure | 5 ++--- src/corelib/corelib.pro | 7 ------- src/corelib/tools/qsimd.cpp | 2 +- src/corelib/tools/qsimd_p.h | 3 ++- src/corelib/tools/qstring.cpp | 2 +- src/gui/gui.pro | 3 +-- 6 files changed, 7 insertions(+), 15 deletions(-) diff --git a/configure b/configure index a238300..5aab180 100755 --- a/configure +++ b/configure @@ -3526,7 +3526,7 @@ Usage: $relconf [-h] [-prefix ] [-prefix-install] [-bindir ] [-libdir [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv] [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked] [-no-gui] [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2] - [-no-sse3] [-no-ssse3] [-no-sse4.1] [-no-sse4.2] [-no-avx] + [-no-sse3] [-no-ssse3] [-no-sse4.1] [-no-sse4.2] [-no-avx] [-no-neon] [-qtnamespace ] [-qtlibinfix ] [-separate-debug-info] [-armfpa] [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns] [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend] @@ -3730,6 +3730,7 @@ cat << EOF -no-sse4.1.......... Do not compile with use of SSE4.1 instructions. -no-sse4.2.......... Do not compile with use of SSE4.2 instructions. -no-avx ............ Do not compile with use of AVX instructions. + -no-neon ........... Do not compile with use of NEON instructions. -qtnamespace Wraps all Qt library code in 'namespace {...}'. -qtlibinfix Renames all libQt*.so to libQt*.so. @@ -4161,8 +4162,6 @@ Qt for Embedded Linux only: -iwmmxt ............ Compile using the iWMMXt instruction set (available on some XScale CPUs). - - -no-neon ........... Do not compile with use of NEON instructions. EOF fi diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index b7d6034..a001940 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -37,10 +37,3 @@ symbian: { MMP_RULES -= PAGED MMP_RULES *= UNPAGED } - -neon { - DEFINES += QT_HAVE_NEON - QMAKE_CXXFLAGS *= -mfpu=neon -} - - diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index b2fe2da..63ebafb 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -135,7 +135,7 @@ static inline uint detectProcessorFeatures() #if defined(QT_HAVE_IWMMXT) // runtime detection only available when running as a previlegied process features = IWMMXT; -#elif defined(QT_HAVE_NEON) +#elif defined(QT_ALWAYS_HAVE_NEON) features = NEON; #endif diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 664543b..87fa770 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -105,7 +105,8 @@ QT_BEGIN_HEADER #endif // defined(QT_HAVE_SSE2) && (defined(__SSE2__) || defined(Q_CC_MSVC)) // NEON intrinsics -#if defined(QT_HAVE_NEON) +#if defined __ARM_NEON__ +#define QT_ALWAYS_HAVE_NEON #include #endif diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index bfbdb73..d4a1248 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -3572,7 +3572,7 @@ static QByteArray toLatin1_helper(const QChar *data, int length) } length = length % 16; } -#elif QT_HAVE_NEON +#elif QT_ALWAYS_HAVE_NEON // Refer to the documentation of the SSE2 implementation // this use eactly the same method as for SSE except: // 1) neon has unsigned comparison diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 90b5de5..4d51fa8 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -64,13 +64,12 @@ symbian { neon:*-g++* { DEFINES += QT_HAVE_NEON - QMAKE_CXXFLAGS *= -mfpu=neon HEADERS += $$NEON_HEADERS SOURCES += $$NEON_SOURCES DRAWHELPER_NEON_ASM_FILES = $$NEON_ASM - neon_compiler.commands = $$QMAKE_CXX -c + neon_compiler.commands = $$QMAKE_CXX -c -mfpu=neon neon_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} neon_compiler.dependency_type = TYPE_C neon_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} -- cgit v0.12