summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Poulain <benjamin.poulain@nokia.com>2010-07-20 11:28:55 (GMT)
committerBenjamin Poulain <benjamin.poulain@nokia.com>2010-07-20 16:35:39 (GMT)
commit42267701edd266463c90cec82d45022446a2606a (patch)
tree6dc3e55f1e8f36de9ef3fe64d8b2a92d53cc0916
parentbd351c2119bf5fed3b5457a3df9fa82e4cd7863b (diff)
downloadQt-42267701edd266463c90cec82d45022446a2606a.zip
Qt-42267701edd266463c90cec82d45022446a2606a.tar.gz
Qt-42267701edd266463c90cec82d45022446a2606a.tar.bz2
Add support for more vector instructions on x86
Add the configuration, autodetection, and the #define for vector instructions on x86. The configuration has been extended with SSE3, SSSE3, SSE4.1, SSE4.2 and AVX. Reviewed-by: Andreas Kling
-rw-r--r--config.tests/unix/avx/avx.cpp51
-rw-r--r--config.tests/unix/avx/avx.pro3
-rw-r--r--config.tests/unix/sse3/sse3.cpp51
-rw-r--r--config.tests/unix/sse3/sse3.pro3
-rw-r--r--config.tests/unix/sse4_1/sse4_1.cpp51
-rw-r--r--config.tests/unix/sse4_1/sse4_1.pro3
-rw-r--r--config.tests/unix/sse4_2/sse4_2.cpp51
-rw-r--r--config.tests/unix/ssse3/ssse3.cpp51
-rw-r--r--config.tests/unix/ssse3/ssse3.pro3
-rwxr-xr-xconfigure100
-rw-r--r--src/corelib/corelib.pro15
-rw-r--r--src/gui/gui.pro5
12 files changed, 386 insertions, 1 deletions
diff --git a/config.tests/unix/avx/avx.cpp b/config.tests/unix/avx/avx.cpp
new file mode 100644
index 0000000..65a0eb8
--- /dev/null
+++ b/config.tests/unix/avx/avx.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <immintrin.h>
+
+int main(int, char**)
+{
+ volatile __m256d a = _mm256_setzero_pd();
+ volatile __m256d b = _mm256_set1_pd(42.42);
+ volatile __m256d result = _mm256_add_pd(a, b);
+ (void)result;
+ return 0;
+}
diff --git a/config.tests/unix/avx/avx.pro b/config.tests/unix/avx/avx.pro
new file mode 100644
index 0000000..00a0550
--- /dev/null
+++ b/config.tests/unix/avx/avx.pro
@@ -0,0 +1,3 @@
+SOURCES = avx.cpp
+CONFIG -= x11 qt
+mac:CONFIG -= app_bundle
diff --git a/config.tests/unix/sse3/sse3.cpp b/config.tests/unix/sse3/sse3.cpp
new file mode 100644
index 0000000..b159acf
--- /dev/null
+++ b/config.tests/unix/sse3/sse3.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <pmmintrin.h>
+
+int main(int, char**)
+{
+ volatile __m128d a = _mm_set1_pd(6.28);
+ volatile __m128d b = _mm_set1_pd(3.14);
+ volatile __m128d result = _mm_addsub_pd(a, b);
+ result = _mm_movedup_pd(result);
+ return 0;
+}
diff --git a/config.tests/unix/sse3/sse3.pro b/config.tests/unix/sse3/sse3.pro
new file mode 100644
index 0000000..009fea2
--- /dev/null
+++ b/config.tests/unix/sse3/sse3.pro
@@ -0,0 +1,3 @@
+SOURCES = sse3.cpp
+CONFIG -= x11 qt
+mac:CONFIG -= app_bundle
diff --git a/config.tests/unix/sse4_1/sse4_1.cpp b/config.tests/unix/sse4_1/sse4_1.cpp
new file mode 100644
index 0000000..e9bec9e
--- /dev/null
+++ b/config.tests/unix/sse4_1/sse4_1.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <smmintrin.h>
+
+int main(int, char**)
+{
+ volatile __m128 a = _mm_setzero_ps();
+ _mm_ceil_ps(a);
+ volatile __m128i result = _mm_mullo_epi32(_mm_set1_epi32(42), _mm_set1_epi32(64));
+ (void)result;
+ return 0;
+}
diff --git a/config.tests/unix/sse4_1/sse4_1.pro b/config.tests/unix/sse4_1/sse4_1.pro
new file mode 100644
index 0000000..c6c4746
--- /dev/null
+++ b/config.tests/unix/sse4_1/sse4_1.pro
@@ -0,0 +1,3 @@
+SOURCES = sse4_1.cpp
+CONFIG -= x11 qt
+mac:CONFIG -= app_bundle
diff --git a/config.tests/unix/sse4_2/sse4_2.cpp b/config.tests/unix/sse4_2/sse4_2.cpp
new file mode 100644
index 0000000..005b2c5
--- /dev/null
+++ b/config.tests/unix/sse4_2/sse4_2.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <smmintrin.h>
+
+int main(int, char**)
+{
+ volatile __m128i a = _mm_setzero_si128();
+ volatile __m128i b = _mm_set1_epi32(42);
+ volatile __m128i result = _mm_cmpestrm(a, 16, b, 16, 0);
+ (void)result;
+ return 0;
+}
diff --git a/config.tests/unix/ssse3/ssse3.cpp b/config.tests/unix/ssse3/ssse3.cpp
new file mode 100644
index 0000000..37fd479
--- /dev/null
+++ b/config.tests/unix/ssse3/ssse3.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <tmmintrin.h>
+
+int main(int, char**)
+{
+ volatile __m128i a = _mm_set1_epi32(42);
+ _mm_abs_epi8(a);
+ volatile __m128i result = _mm_sign_epi16(a, _mm_set1_epi32(64));
+ (void)result;
+ return 0;
+}
diff --git a/config.tests/unix/ssse3/ssse3.pro b/config.tests/unix/ssse3/ssse3.pro
new file mode 100644
index 0000000..4864267
--- /dev/null
+++ b/config.tests/unix/ssse3/ssse3.pro
@@ -0,0 +1,3 @@
+SOURCES = ssse3.cpp
+CONFIG -= x11 qt
+mac:CONFIG -= app_bundle
diff --git a/configure b/configure
index 11496c4..1122c7e 100755
--- a/configure
+++ b/configure
@@ -740,6 +740,11 @@ CFG_MMX=auto
CFG_3DNOW=auto
CFG_SSE=auto
CFG_SSE2=auto
+CFG_SSE3=auto
+CFG_SSSE3=auto
+CFG_SSE4_1=auto
+CFG_SSE4_2=auto
+CFG_AVX=auto
CFG_REDUCE_RELOCATIONS=no
CFG_IPV6=auto
CFG_NAS=no
@@ -1642,6 +1647,41 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
+ sse3)
+ if [ "$VAL" = "no" ]; then
+ CFG_SSE3="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
+ ssse3)
+ if [ "$VAL" = "no" ]; then
+ CFG_SSSE3="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
+ sse4.1)
+ if [ "$VAL" = "no" ]; then
+ CFG_SSE4_1="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
+ sse4.2)
+ if [ "$VAL" = "no" ]; then
+ CFG_SSE4_2="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
+ avx)
+ if [ "$VAL" = "no" ]; then
+ CFG_AVX="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
iwmmxt)
CFG_IWMMXT="yes"
;;
@@ -3427,6 +3467,7 @@ Usage: $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-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]
[-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa]
[-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns]
[-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
@@ -3618,6 +3659,11 @@ cat << EOF
-no-3dnow .......... Do not compile with use of 3DNOW instructions.
-no-sse ............ Do not compile with use of SSE instructions.
-no-sse2 ........... Do not compile with use of SSE2 instructions.
+ -no-sse3 ........... Do not compile with use of SSE3 instructions.
+ -no-ssse3 .......... Do not compile with use of SSSE3 instructions.
+ -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.
-qtnamespace <name> Wraps all Qt library code in 'namespace <name> {...}'.
-qtlibinfix <infix> Renames all libQt*.so to libQt*<infix>.so.
@@ -4667,6 +4713,51 @@ if [ "${CFG_SSE2}" = "auto" ]; then
fi
fi
+# detect sse3 support
+if [ "${CFG_SSE3}" = "auto" ]; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse3 "sse3" $L_FLAGS $I_FLAGS $l_FLAGS "-msse3"; then
+ CFG_SSE3=yes
+ else
+ CFG_SSE3=no
+ fi
+fi
+
+# detect ssse3 support
+if [ "${CFG_SSSE3}" = "auto" ]; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ssse3 "ssse3" $L_FLAGS $I_FLAGS $l_FLAGS "-mssse3"; then
+ CFG_SSSE3=yes
+ else
+ CFG_SSSE3=no
+ fi
+fi
+
+# detect sse4.1 support
+if [ "${CFG_SSE4_1}" = "auto" ]; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse4_1 "sse4_1" $L_FLAGS $I_FLAGS $l_FLAGS "-msse4.1"; then
+ CFG_SSE4_1=yes
+ else
+ CFG_SSE4_1=no
+ fi
+fi
+
+# detect sse4.2 support
+if [ "${CFG_SSE4_2}" = "auto" ]; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse4_2 "sse4_2" $L_FLAGS $I_FLAGS $l_FLAGS "-msse4.2"; then
+ CFG_SSE4_2=yes
+ else
+ CFG_SSE4_2=no
+ fi
+fi
+
+# detect avx support
+if [ "${CFG_AVX}" = "auto" ]; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx "avx" $L_FLAGS $I_FLAGS $l_FLAGS "-mavx"; then
+ CFG_AVX=yes
+ else
+ CFG_AVX=no
+ fi
+fi
+
# check iWMMXt support
if [ "$CFG_IWMMXT" = "yes" ]; then
"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $l_FLAGS "-mcpu=iwmmxt"
@@ -6558,6 +6649,11 @@ fi
[ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
[ "$CFG_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse"
[ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
+[ "$CFG_SSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse3"
+[ "$CFG_SSSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG ssse3"
+[ "$CFG_SSE4_1" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_1"
+[ "$CFG_SSE4_2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_2"
+[ "$CFG_AVX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx"
[ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
[ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon"
[ "$PLATFORM_MAC" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG $CFG_MAC_ARCHS"
@@ -7959,7 +8055,9 @@ echo "Support for S60 ........ $CFG_S60"
echo "Symbian DEF files ...... $CFG_SYMBIAN_DEFFILES"
echo "STL support ............ $CFG_STL"
echo "PCH support ............ $CFG_PRECOMPILE"
-echo "MMX/3DNOW/SSE/SSE2...... ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}"
+echo "MMX/3DNOW/SSE/SSE2/SSE3. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}/${CFG_SSE3}"
+echo "SSSE3/SSE4.1/SSE4.2..... ${CFG_SSSE3}/${CFG_SSE4_1}/${CFG_SSE4_2}"
+echo "AVX..................... ${CFG_AVX}"
if [ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]; then
echo "iWMMXt support ......... ${CFG_IWMMXT}"
echo "NEON support ........... ${CFG_NEON}"
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index dba2a42..bbf445f 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -66,6 +66,21 @@ sse {
sse2 {
DEFINES += QT_HAVE_SSE2
}
+sse3 {
+ DEFINES += QT_HAVE_SSE3
+}
+ssse3 {
+ DEFINES += QT_HAVE_SSSE3
+}
+sse4_1 {
+ DEFINES += QT_HAVE_SSE4_1
+}
+sse4_2 {
+ DEFINES += QT_HAVE_SSE4_2
+}
+avx {
+ DEFINES += QT_HAVE_AVX
+}
iwmmxt {
DEFINES += QT_HAVE_IWMMXT
}
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 41f1904..3aee078 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -84,6 +84,11 @@ contains(QMAKE_MAC_XARCH, no) {
3dnow:DEFINES += QT_HAVE_3DNOW
sse:DEFINES += QT_HAVE_SSE QT_HAVE_MMXEXT
sse2:DEFINES += QT_HAVE_SSE2
+ sse3:DEFINES += QT_HAVE_SSE3
+ ssse3:DEFINES += QT_HAVE_SSSE3
+ sse4_1:DEFINES += QT_HAVE_SSE4_1
+ sse4_2:DEFINES += QT_HAVE_SSE4_2
+ avx:DEFINES += QT_HAVE_AVX
iwmmxt:DEFINES += QT_HAVE_IWMMXT
win32-g++*|!win32:!*-icc* {