Centralize the x86 SIMD testing in one place
Since the x86_simd/main.cpp file already has all the source for each and every test anyway, just reuse it. Change-Id: I938b024e38bf4aac9154fffd14f779f450827fb9 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
parent
e1600c1a73
commit
e32812d1d2
@ -1,49 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 Intel Corporation.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the config.tests of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <wmmintrin.h>
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
__m128i a = _mm_setzero_si128();
|
||||
__m128i b = _mm_aesenc_si128(a, a);
|
||||
__m128i c = _mm_aesdec_si128(a, b);
|
||||
(void)c;
|
||||
return 0;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
SOURCES = aesni.cpp
|
||||
!defined(QMAKE_CFLAGS_AESNI, "var"): error("This compiler does not support AES New Instructions")
|
||||
else: QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_AESNI
|
@ -1,56 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 Intel Corporation.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the config.tests of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <immintrin.h>
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
unsigned short us;
|
||||
unsigned int ui;
|
||||
if (_rdrand16_step(&us))
|
||||
return 1;
|
||||
if (_rdrand32_step(&ui))
|
||||
return 1;
|
||||
#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
|
||||
unsigned long long ull;
|
||||
if (_rdrand64_step(&ull))
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
SOURCES += rdrnd.cpp
|
||||
!defined(QMAKE_CFLAGS_RDRND, "var"): error("This compiler does not support the RDRAND instruction")
|
||||
else: QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_RDRND
|
@ -1,50 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 Intel Corporation.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the config.tests of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <immintrin.h>
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
__m128i a = _mm_setzero_si128();
|
||||
__m128i b = _mm_sha1rnds4_epu32(a, a, 0);
|
||||
__m128i c = _mm_sha1msg1_epu32(a, b);
|
||||
__m128i d = _mm_sha256msg2_epu32(b, c);
|
||||
(void)d;
|
||||
return 0;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
SOURCES = shani.cpp
|
||||
!defined(QMAKE_CFLAGS_SHANI, "var"): error("This compiler does not support Secure Hash Algorithm extensions")
|
||||
else: QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SHANI
|
@ -41,7 +41,7 @@
|
||||
#include <immintrin.h>
|
||||
#define T(x) (QT_COMPILER_SUPPORTS_ ## x)
|
||||
|
||||
#if !defined(__INTEL_COMPILER) && !defined(_MSC_VER)
|
||||
#if !defined(__INTEL_COMPILER) && !defined(_MSC_VER) && !defined(NO_ATTRIBUTE)
|
||||
/* GCC requires attributes for a function */
|
||||
# define attribute_target(x) __attribute__((__target__(x)))
|
||||
#else
|
||||
|
@ -2,4 +2,10 @@ SOURCES = main.cpp
|
||||
for (config, SIMD) {
|
||||
uc = $$upper($$config)
|
||||
DEFINES += QT_COMPILER_SUPPORTS_$${uc}
|
||||
|
||||
add_cflags {
|
||||
cflags = QMAKE_CFLAGS_$${uc}
|
||||
!defined($$cflags, var): error("This compiler does not support $${uc}")
|
||||
QMAKE_CXXFLAGS += $$eval($$cflags)
|
||||
}
|
||||
}
|
||||
|
165
configure.json
165
configure.json
@ -218,7 +218,7 @@
|
||||
},
|
||||
|
||||
"testTypeAliases": {
|
||||
"compile": [ "library", "architecture", "x86SimdAlways" ]
|
||||
"compile": [ "library", "architecture", "x86Simd", "x86SimdAlways" ]
|
||||
},
|
||||
|
||||
"tests": {
|
||||
@ -362,206 +362,83 @@
|
||||
},
|
||||
"sse2": {
|
||||
"label": "SSE2 instructions",
|
||||
"type": "compile",
|
||||
"test": {
|
||||
"include": "emmintrin.h",
|
||||
"main": [
|
||||
"__m128i a = _mm_setzero_si128();",
|
||||
"_mm_maskmoveu_si128(a, _mm_setzero_si128(), 0);"
|
||||
],
|
||||
"qmake": [
|
||||
"!defined(QMAKE_CFLAGS_SSE2, var): error(\"This compiler does not support SSE2\")",
|
||||
"QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE2"
|
||||
]
|
||||
}
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"sse3": {
|
||||
"label": "SSE3 instructions",
|
||||
"type": "compile",
|
||||
"test": {
|
||||
"include": "pmmintrin.h",
|
||||
"main": [
|
||||
"__m128d a = _mm_set1_pd(6.28);",
|
||||
"__m128d b = _mm_set1_pd(3.14);",
|
||||
"__m128d result = _mm_addsub_pd(a, b);",
|
||||
"(void) _mm_movedup_pd(result);"
|
||||
],
|
||||
"qmake": [
|
||||
"!defined(QMAKE_CFLAGS_SSE3, var): error(\"This compiler does not support SSE3\")",
|
||||
"QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE3"
|
||||
]
|
||||
}
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"ssse3": {
|
||||
"label": "SSSE3 instructions",
|
||||
"type": "compile",
|
||||
"test": {
|
||||
"include": "tmmintrin.h",
|
||||
"main": [
|
||||
"__m128i a = _mm_set1_epi32(42);",
|
||||
"_mm_abs_epi8(a);",
|
||||
"(void) _mm_sign_epi16(a, _mm_set1_epi32(64));"
|
||||
],
|
||||
"qmake": [
|
||||
"!defined(QMAKE_CFLAGS_SSSE3, var): error(\"This compiler does not support SSSE3\")",
|
||||
"QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSSE3"
|
||||
]
|
||||
}
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"sse4_1": {
|
||||
"label": "SSE4.1 instructions",
|
||||
"type": "compile",
|
||||
"test": {
|
||||
"include": "smmintrin.h",
|
||||
"main": [
|
||||
"__m128 a = _mm_setzero_ps();",
|
||||
"_mm_ceil_ps(a);",
|
||||
"__m128i result = _mm_mullo_epi32(_mm_set1_epi32(42), _mm_set1_epi32(64));",
|
||||
"(void)result;"
|
||||
],
|
||||
"qmake": [
|
||||
"!defined(QMAKE_CFLAGS_SSE4_1, var): error(\"This compiler does not support SSE4.1\")",
|
||||
"QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE4_1"
|
||||
]
|
||||
}
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"sse4_2": {
|
||||
"label": "SSE4.2 instructions",
|
||||
"type": "compile",
|
||||
"test": {
|
||||
"include": "nmmintrin.h",
|
||||
"main": [
|
||||
"__m128i a = _mm_setzero_si128();",
|
||||
"__m128i b = _mm_set1_epi32(42);",
|
||||
"(void) _mm_cmpestrm(a, 16, b, 16, 0);"
|
||||
],
|
||||
"qmake": [
|
||||
"!defined(QMAKE_CFLAGS_SSE4_2, var): error(\"This compiler does not support SSE4.2\")",
|
||||
"QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE4_2"
|
||||
]
|
||||
}
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"aesni": {
|
||||
"label": "AES new instructions",
|
||||
"type": "compile",
|
||||
"test": "common/aesni"
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"f16c": {
|
||||
"label": "F16C instructions",
|
||||
"type": "compile",
|
||||
"test": {
|
||||
"include": "immintrin.h",
|
||||
"main": [
|
||||
"__m128i a = _mm_setzero_si128();",
|
||||
"__m128 b = _mm_cvtph_ps(a);",
|
||||
"__m256 b256 = _mm256_cvtph_ps(a);",
|
||||
"(void) _mm_cvtps_ph(b, 0);",
|
||||
"(void) _mm256_cvtps_ph(b256, 0);"
|
||||
],
|
||||
"qmake": [
|
||||
"!defined(QMAKE_CFLAGS_F16C, var): error(\"This compiler does not support F16C\")",
|
||||
"QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_F16C"
|
||||
]
|
||||
}
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"rdrnd": {
|
||||
"label": "RDRAND instruction",
|
||||
"type": "compile",
|
||||
"test": "common/rdrnd"
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"shani": {
|
||||
"label": "SHA new instructions",
|
||||
"type": "compile",
|
||||
"test": "common/shani"
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"avx": {
|
||||
"label": "AVX instructions",
|
||||
"type": "compile",
|
||||
"test": {
|
||||
"include": "immintrin.h",
|
||||
"main": [
|
||||
"__m256d a = _mm256_setzero_pd();",
|
||||
"__m256d b = _mm256_set1_pd(42.42);",
|
||||
"(void) _mm256_add_pd(a, b);"
|
||||
],
|
||||
"qmake": [
|
||||
"!defined(QMAKE_CFLAGS_AVX, var): error(\"This compiler does not support AVX\")",
|
||||
"QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_AVX"
|
||||
]
|
||||
}
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"avx2": {
|
||||
"label": "AVX2 instructions",
|
||||
"type": "compile",
|
||||
"test": {
|
||||
"include": "immintrin.h",
|
||||
"main": [
|
||||
"// AVX",
|
||||
"_mm256_zeroall();",
|
||||
"__m256i a = _mm256_setzero_si256();",
|
||||
"// AVX2",
|
||||
"__m256i b = _mm256_and_si256(a, a);",
|
||||
"(void) _mm256_add_epi8(a, b);"
|
||||
],
|
||||
"qmake": [
|
||||
"!defined(QMAKE_CFLAGS_AVX2, var): error(\"This compiler does not support AVX2\")",
|
||||
"QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_AVX2"
|
||||
]
|
||||
}
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"avx512f": {
|
||||
"label": "AVX512 F instructions",
|
||||
"type": "compile",
|
||||
"test": "avx512",
|
||||
"args": "AVX512=F"
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"avx512er": {
|
||||
"label": "AVX512 ER instructions",
|
||||
"type": "compile",
|
||||
"test": "avx512",
|
||||
"args": "AVX512=ER"
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"avx512cd": {
|
||||
"label": "AVX512 CD instructions",
|
||||
"type": "compile",
|
||||
"test": "avx512",
|
||||
"args": "AVX512=CD"
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"avx512pf": {
|
||||
"label": "AVX512 PF instructions",
|
||||
"type": "compile",
|
||||
"test": "avx512",
|
||||
"args": "AVX512=PF"
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"avx512dq": {
|
||||
"label": "AVX512 DQ instructions",
|
||||
"type": "compile",
|
||||
"test": "avx512",
|
||||
"args": "AVX512=DQ"
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"avx512bw": {
|
||||
"label": "AVX512 BW instructions",
|
||||
"type": "compile",
|
||||
"test": "avx512",
|
||||
"args": "AVX512=BW"
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"avx512vl": {
|
||||
"label": "AVX512 VL instructions",
|
||||
"type": "compile",
|
||||
"test": "avx512",
|
||||
"args": "AVX512=VL"
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"avx512ifma": {
|
||||
"label": "AVX512 IFMA instructions",
|
||||
"type": "compile",
|
||||
"test": "avx512",
|
||||
"args": "AVX512=IFMA"
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"avx512vbmi": {
|
||||
"label": "AVX512 VBMI instructions",
|
||||
"type": "compile",
|
||||
"test": "avx512",
|
||||
"args": "AVX512=VBMI"
|
||||
"type": "x86Simd"
|
||||
},
|
||||
"x86SimdAlways": {
|
||||
"label": "Intrinsics without -mXXX argument",
|
||||
|
@ -395,12 +395,22 @@ defineTest(qtConfTest_buildParts) {
|
||||
return(true)
|
||||
}
|
||||
|
||||
defineTest(qtConfTest_x86Simd) {
|
||||
simd = $$section(1, ".", -1) # last component
|
||||
$${1}.args = CONFIG+=add_cflags DEFINES+=NO_ATTRIBUTE SIMD=$$simd
|
||||
$${1}.test = x86_simd
|
||||
qtConfTest_compile($${1})
|
||||
}
|
||||
|
||||
defineTest(qtConfTest_x86SimdAlways) {
|
||||
configs =
|
||||
fpfx = $${currentConfig}.features
|
||||
simd = sse2 sse3 ssse3 sse4_1 sse4_2 rdrnd aesni shani avx avx2 avx512f \
|
||||
avx512er avx512cd avx512pf avx512dq avx512bw avx512vl avx512ifma avx512vbmi
|
||||
for (f, simd) {
|
||||
tpfx = $${currentConfig}.tests
|
||||
|
||||
# Make a list of all passing features whose tests have type=x86Simd
|
||||
for (f, $${tpfx}._KEYS_) {
|
||||
!equals($${tpfx}.$${f}.type, "x86Simd"): \
|
||||
next()
|
||||
qtConfCheckFeature($$f)
|
||||
equals($${fpfx}.$${f}.available, true): configs += $$f
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user