/**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and ** appearing in the file LICENSE.LGPL included in the packaging of this ** file. Please review the following information to ensure the GNU Lesser ** General Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU General ** Public License version 3.0 as published by the Free Software Foundation ** and appearing in the file LICENSE.GPL included in the packaging of this ** file. Please review the following information to ensure the GNU General ** Public License version 3.0 requirements will be met: ** http://www.gnu.org/copyleft/gpl.html. ** ** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QSIMD_P_H #define QSIMD_P_H #include QT_BEGIN_HEADER #if defined(QT_NO_MAC_XARCH) || (defined(Q_OS_DARWIN) && (defined(__ppc__) || defined(__ppc64__))) // Disable MMX and SSE on Mac/PPC builds, or if the compiler // does not support -Xarch argument passing #undef QT_HAVE_SSE #undef QT_HAVE_SSE2 #undef QT_HAVE_SSE3 #undef QT_HAVE_SSSE3 #undef QT_HAVE_SSE4_1 #undef QT_HAVE_SSE4_2 #undef QT_HAVE_AVX #undef QT_HAVE_3DNOW #undef QT_HAVE_MMX #endif #ifdef __MINGW64_VERSION_MAJOR #include #endif // SSE intrinsics #if defined(QT_HAVE_SSE2) && (defined(__SSE2__) || defined(Q_CC_MSVC)) #if defined(QT_LINUXBASE) /// this is an evil hack - the posix_memalign declaration in LSB /// is wrong - see http://bugs.linuxbase.org/show_bug.cgi?id=2431 # define posix_memalign _lsb_hack_posix_memalign # include # undef posix_memalign #else # include #endif // SSE3 intrinsics #if defined(QT_HAVE_SSE3) && (defined(__SSE3__) || defined(Q_CC_MSVC)) #include #endif // SSSE3 intrinsics #if defined(QT_HAVE_SSSE3) && (defined(__SSSE3__) || defined(Q_CC_MSVC)) #include #endif // SSE4.1 intrinsics #if defined(QT_HAVE_SSE4_1) && (defined(__SSE4_1__) || defined(Q_CC_MSVC)) #include #endif // SSE4.2 intrinsics #if defined(QT_HAVE_SSE4_2) && (defined(__SSE4_2__) || defined(Q_CC_MSVC)) #include #endif // AVX intrinsics #if defined(QT_HAVE_AVX) && (defined(__AVX__) || defined(Q_CC_MSVC)) #include #endif #if !defined(QT_BOOTSTRAPPED) && (!defined(Q_CC_MSVC) || (defined(_M_X64) || _M_IX86_FP == 2)) #define QT_ALWAYS_HAVE_SSE2 #endif #endif // defined(QT_HAVE_SSE2) && (defined(__SSE2__) || defined(Q_CC_MSVC)) // NEON intrinsics #if defined __ARM_NEON__ #define QT_ALWAYS_HAVE_NEON #include #endif // IWMMXT intrinsics #if defined(QT_HAVE_IWMMXT) #include #if defined(Q_OS_WINCE) # include "qplatformdefs.h" #endif #endif #if defined(QT_HAVE_IWMMXT) #if !defined(__IWMMXT__) && !defined(Q_OS_WINCE) # include #elif defined(Q_OS_WINCE_STD) && defined(_X86_) # pragma warning(disable: 4391) # include #endif #endif // 3D now intrinsics #if defined(QT_HAVE_3DNOW) #include #endif QT_BEGIN_NAMESPACE enum CPUFeatures { None = 0, MMX = 0x1, MMXEXT = 0x2, MMX3DNOW = 0x4, MMX3DNOWEXT = 0x8, SSE = 0x10, SSE2 = 0x20, CMOV = 0x40, IWMMXT = 0x80, NEON = 0x100, SSE3 = 0x200, SSSE3 = 0x400, SSE4_1 = 0x800, SSE4_2 = 0x1000, AVX = 0x2000 }; Q_CORE_EXPORT uint qDetectCPUFeatures(); #define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \ for (; i < static_cast(qMin(static_cast(length), ((4 - ((reinterpret_cast(ptr) >> 2) & 0x3)) & 0x3))); ++i) QT_END_NAMESPACE QT_END_HEADER #endif // QSIMD_P_H