diff options
Diffstat (limited to 'config.tests')
22 files changed, 707 insertions, 14 deletions
diff --git a/config.tests/avx512/avx512.cpp b/config.tests/avx512/avx512.cpp index ca1a5d1357..29e88ebf15 100644 --- a/config.tests/avx512/avx512.cpp +++ b/config.tests/avx512/avx512.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 Intel Corporation. +** Copyright (C) 2017 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the configuration of the Qt Toolkit. @@ -39,15 +39,18 @@ #include <immintrin.h> -#ifndef AVX512WANT -# error ".pro file must define AVX512WANT macro to the AVX-512 feature to be tested" +#ifndef __AVX512F__ +# error "There doesn't seem to be AVX-512 support in this compiler" +#endif +#ifndef WANT_AVX512 +# error ".pro file must define WANT_AVX512 macro to the AVX-512 feature to be tested" #endif // The following checks if __AVXx__ is defined, where x is the value in -// AVX512WANT +// WANT_AVX512 #define HAS2(x) __AVX512 ## x ## __ #define HAS(x) HAS2(x) -#if !HAS(AVX512WANT) +#if !HAS(WANT_AVX512) # error "Feature not supported" #endif @@ -62,36 +65,36 @@ int main(int, char**argv) d = _mm512_loadu_pd((double *)argv + 64); f = _mm512_loadu_ps((float *)argv + 128); -#ifdef __AVX512ER__ +#ifdef WANT_AVX512ER /* AVX512 Exponential and Reciprocal */ f = _mm512_exp2a23_round_ps(f, 8); #endif -#ifdef __AVX512CD__ +#ifdef WANT_AVX512CD /* AVX512 Conflict Detection */ i = _mm512_maskz_conflict_epi32(m, i); #endif -#ifdef __AVX512PF__ +#ifdef WANT_AVX512PF /* AVX512 Prefetch */ _mm512_mask_prefetch_i64scatter_pd(argv, 0xf, i, 2, 2); #endif -#ifdef __AVX512DQ__ +#ifdef WANT_AVX512DQ /* AVX512 Doubleword and Quadword support */ m = _mm512_movepi32_mask(i); #endif -#ifdef __AVX512BW__ +#ifdef WANT_AVX512BW /* AVX512 Byte and Word support */ i = _mm512_mask_loadu_epi8(i, m, argv - 8); #endif -#ifdef __AVX512VL__ +#ifdef WANT_AVX512VL /* AVX512 Vector Length */ __m256i i2 = _mm256_maskz_loadu_epi32(0, argv); _mm256_mask_storeu_epi32(argv + 1, m, i2); #endif -#ifdef __AVX512IFMA__ +#ifdef WANT_AVX512IFMA /* AVX512 Integer Fused Multiply-Add */ i = _mm512_madd52lo_epu64(i, i, i); #endif -#ifdef __AVX512VBMI__ +#ifdef WANT_AVX512VBMI /* AVX512 Vector Byte Manipulation Instructions */ i = _mm512_permutexvar_epi8(i, i); #endif diff --git a/config.tests/avx512/avx512.pro b/config.tests/avx512/avx512.pro index 1edf5e5432..d295f6320c 100644 --- a/config.tests/avx512/avx512.pro +++ b/config.tests/avx512/avx512.pro @@ -7,4 +7,4 @@ value = $$eval($$varname) !defined($$varname, "var"): error("This compiler does not support AVX512") QMAKE_CXXFLAGS += $$value -DEFINES += AVX512WANT=$$AVX512 +DEFINES += WANT_AVX512=$$AVX512 WANT_AVX512$$AVX512 diff --git a/config.tests/qpa/vulkan/vulkan.cpp b/config.tests/qpa/vulkan/vulkan.cpp new file mode 100644 index 0000000000..22f5edf9f2 --- /dev/null +++ b/config.tests/qpa/vulkan/vulkan.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** 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$ +** +****************************************************************************/ + +// This is a header-only test. Qt does not rely on linking to a Vulkan library directly. + +#include <vulkan/vulkan.h> + +// The pData parameter has changed from uint32_t* to void* at some point. +// Ensure the headers have the updated one to prevent compile errors later on. +PFN_vkCmdUpdateBuffer cmdUpdBuf; +void testUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData) +{ + cmdUpdBuf(commandBuffer, dstBuffer, dstOffset, dataSize, pData); +} + +int main(int, char **) +{ + VkInstanceCreateInfo info; + testUpdateBuffer(0, 0, 0, 0, 0); + + return 0; +} diff --git a/config.tests/qpa/vulkan/vulkan.pro b/config.tests/qpa/vulkan/vulkan.pro new file mode 100644 index 0000000000..5f05bc49aa --- /dev/null +++ b/config.tests/qpa/vulkan/vulkan.pro @@ -0,0 +1 @@ +SOURCES = vulkan.cpp diff --git a/config.tests/unix/cxx11_random/cxx11_random.cpp b/config.tests/unix/cxx11_random/cxx11_random.cpp new file mode 100644 index 0000000000..d6872667fd --- /dev/null +++ b/config.tests/unix/cxx11_random/cxx11_random.cpp @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Intel Corporation. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <random> + +int main() +{ + std::mt19937 mt(0); + return 0; +} diff --git a/config.tests/unix/cxx11_random/cxx11_random.pro b/config.tests/unix/cxx11_random/cxx11_random.pro new file mode 100644 index 0000000000..0cd5fff9d9 --- /dev/null +++ b/config.tests/unix/cxx11_random/cxx11_random.pro @@ -0,0 +1 @@ +SOURCES = cxx11_random.cpp diff --git a/config.tests/unix/futimens/futimens.cpp b/config.tests/unix/futimens/futimens.cpp new file mode 100644 index 0000000000..1b66386ca1 --- /dev/null +++ b/config.tests/unix/futimens/futimens.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Raphael Gozzo <raphael.rg91@gmail.com> +** Contact: http://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 <sys/stat.h> + +int main(int, char **) +{ + futimens(-1,0); + return 0; +} + diff --git a/config.tests/unix/futimens/futimens.pro b/config.tests/unix/futimens/futimens.pro new file mode 100644 index 0000000000..83a122252a --- /dev/null +++ b/config.tests/unix/futimens/futimens.pro @@ -0,0 +1,6 @@ +SOURCES += futimens.cpp + +# Block futimens() on Apple platforms unless it's available on ALL deployment +# targets. This simplifies the logic at the call site dramatically, as it isn't +# strictly needed compared to futimes(). +darwin: QMAKE_CXXFLAGS += -Werror=unguarded-availability diff --git a/config.tests/unix/futimes/futimes.cpp b/config.tests/unix/futimes/futimes.cpp new file mode 100644 index 0000000000..553b39068e --- /dev/null +++ b/config.tests/unix/futimes/futimes.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Raphael Gozzo <raphael.rg91@gmail.com> +** Contact: http://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 <sys/time.h> + +int main(int, char **) +{ + futimes(-1,0); + return 0; +} + diff --git a/config.tests/unix/futimes/futimes.pro b/config.tests/unix/futimes/futimes.pro new file mode 100644 index 0000000000..8e7f2c0f62 --- /dev/null +++ b/config.tests/unix/futimes/futimes.pro @@ -0,0 +1 @@ +SOURCES += futimes.cpp diff --git a/config.tests/unix/getauxval/getauxval.cpp b/config.tests/unix/getauxval/getauxval.cpp new file mode 100644 index 0000000000..62f71e95d2 --- /dev/null +++ b/config.tests/unix/getauxval/getauxval.cpp @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Intel Corporation. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <sys/auxv.h> + +int main() +{ + return getauxval(AT_NULL); +} diff --git a/config.tests/unix/getauxval/getauxval.pro b/config.tests/unix/getauxval/getauxval.pro new file mode 100644 index 0000000000..ea46cb0bae --- /dev/null +++ b/config.tests/unix/getauxval/getauxval.pro @@ -0,0 +1 @@ +SOURCES = getauxval.cpp diff --git a/config.tests/unix/getentropy/getentropy.cpp b/config.tests/unix/getentropy/getentropy.cpp new file mode 100644 index 0000000000..6cb4dc3a95 --- /dev/null +++ b/config.tests/unix/getentropy/getentropy.cpp @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Intel Corporation. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <unistd.h> + +int main() +{ + char buf[32]; + return getentropy(buf, sizeof(buf)); +} diff --git a/config.tests/unix/getentropy/getentropy.pro b/config.tests/unix/getentropy/getentropy.pro new file mode 100644 index 0000000000..bdd626b513 --- /dev/null +++ b/config.tests/unix/getentropy/getentropy.pro @@ -0,0 +1 @@ +SOURCES = getentropy.cpp diff --git a/config.tests/unix/opengles32/opengles32.cpp b/config.tests/unix/opengles32/opengles32.cpp new file mode 100644 index 0000000000..0505510464 --- /dev/null +++ b/config.tests/unix/opengles32/opengles32.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** 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 <GLES3/gl32.h> + +int main(int, char **) +{ + glFramebufferTexture(GL_TEXTURE_2D, GL_DEPTH_STENCIL_ATTACHMENT, 1, 0); + + return 0; +} diff --git a/config.tests/unix/opengles32/opengles32.pro b/config.tests/unix/opengles32/opengles32.pro new file mode 100644 index 0000000000..c95ba83364 --- /dev/null +++ b/config.tests/unix/opengles32/opengles32.pro @@ -0,0 +1,7 @@ +# The library is expected to be the same as in ES 2.0 (libGLESv2). +# The difference is the header and the presence of the functions in +# the library. + +SOURCES = opengles32.cpp + +CONFIG -= qt diff --git a/config.tests/unix/openssl11/openssl.cpp b/config.tests/unix/openssl11/openssl.cpp new file mode 100644 index 0000000000..c20cc59deb --- /dev/null +++ b/config.tests/unix/openssl11/openssl.cpp @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** 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 <openssl/opensslv.h> + +#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER-0 < 0x10100000L +# error "OpenSSL >= 1.1 is required" +#endif + +int main() +{ +} diff --git a/config.tests/unix/openssl11/openssl.pro b/config.tests/unix/openssl11/openssl.pro new file mode 100644 index 0000000000..a023aee4aa --- /dev/null +++ b/config.tests/unix/openssl11/openssl.pro @@ -0,0 +1,2 @@ +SOURCES = openssl.cpp +CONFIG -= x11 qt diff --git a/config.tests/x11/xrender/xrender.cpp b/config.tests/x11/xrender/xrender.cpp new file mode 100644 index 0000000000..35203cc02c --- /dev/null +++ b/config.tests/x11/xrender/xrender.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** 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 <X11/Xlib.h> +#include <X11/extensions/Xrender.h> + +#if RENDER_MAJOR == 0 && RENDER_MINOR < 5 +# error "Required Xrender version 0.6 not found." +#else +int main(int, char **) +{ + XRenderPictFormat *format; + format = 0; + return 0; +} +#endif diff --git a/config.tests/x11/xrender/xrender.pro b/config.tests/x11/xrender/xrender.pro new file mode 100644 index 0000000000..ab5c5efa77 --- /dev/null +++ b/config.tests/x11/xrender/xrender.pro @@ -0,0 +1,3 @@ +SOURCES = xrender.cpp +CONFIG += x11 +CONFIG -= qt diff --git a/config.tests/x86_simd/main.cpp b/config.tests/x86_simd/main.cpp new file mode 100644 index 0000000000..8120cb9d3f --- /dev/null +++ b/config.tests/x86_simd/main.cpp @@ -0,0 +1,253 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Intel Corporation. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtCore module 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$ +** +****************************************************************************/ + +// All of our supported compilers support <immintrin.h> +#include <immintrin.h> +#define T(x) (QT_COMPILER_SUPPORTS_ ## x) + +#if !defined(__INTEL_COMPILER) && !defined(_MSC_VER) && !defined(NO_ATTRIBUTE) +/* GCC requires attributes for a function */ +# define attribute_target(x) __attribute__((__target__(x))) +#else +# define attribute_target(x) +#endif + +#if T(SSE2) +attribute_target("sse2") void test_sse2() +{ + __m128i a = _mm_setzero_si128(); + _mm_maskmoveu_si128(a, _mm_setzero_si128(), 0); +} +#endif + +#if T(SSE3) +attribute_target("sse3") void test_sse3() +{ + __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); +} +#endif + +#if T(SSSE3) +attribute_target("ssse3") void test_ssse3() +{ + __m128i a = _mm_set1_epi32(42); + _mm_abs_epi8(a); + (void) _mm_sign_epi16(a, _mm_set1_epi32(64)); +} +#endif + +#if T(SSE4_1) +attribute_target("sse4.1") void test_sse4_1() +{ + __m128 a = _mm_setzero_ps(); + _mm_ceil_ps(a); + __m128i result = _mm_mullo_epi32(_mm_set1_epi32(42), _mm_set1_epi32(64)); + (void)result; +} +#endif + +#if T(SSE4_2) +attribute_target("sse4.2") void test_sse4_2() +{ + __m128i a = _mm_setzero_si128(); + __m128i b = _mm_set1_epi32(42); + (void) _mm_cmpestrm(a, 16, b, 16, 0); +} +#endif + +#if T(AESNI) +attribute_target("aes,sse4.2") void test_aesni() +{ + __m128i a = _mm_setzero_si128(); + __m128i b = _mm_aesenc_si128(a, a); + __m128i c = _mm_aesdec_si128(a, b); + (void)c; +} +#endif + +#if T(F16C) +attribute_target("f16c") void test_f16c() +{ + __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); +} +#endif + +#if T(RDRND) +attribute_target("rdrnd") int test_rdrnd() +{ + 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 +} +#endif + +#if T(SHANI) +attribute_target("sha") void test_shani() +{ + __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; +} +#endif + +#if T(AVX) +attribute_target("avx") void test_avx() +{ + __m256d a = _mm256_setzero_pd(); + __m256d b = _mm256_set1_pd(42.42); + (void) _mm256_add_pd(a, b); +} +#endif + +#if T(AVX2) +attribute_target("avx2") void test_avx2() +{ + _mm256_zeroall(); + __m256i a = _mm256_setzero_si256(); + __m256i b = _mm256_and_si256(a, a); + (void) _mm256_add_epi8(a, b); +} +#endif + +#if T(AVX512F) +attribute_target("avx512f") void test_avx512f(char *ptr) +{ + /* AVX512 Foundation */ + __mmask16 m = ~1; + __m512i i; + __m512d d; + __m512 f; + i = _mm512_maskz_loadu_epi32(0, ptr); + d = _mm512_loadu_pd((double *)ptr + 64); + f = _mm512_loadu_ps((float *)ptr + 128); + _mm512_mask_storeu_epi64(ptr, m, i); + _mm512_mask_storeu_ps(ptr + 64, m, f); + _mm512_mask_storeu_pd(ptr + 128, m, d); +} +#endif + +#if T(AVX512ER) +attribute_target("avx512er") void test_avx512er() +{ + /* AVX512 Exponential and Reciprocal */ + __m512 f; + f = _mm512_exp2a23_round_ps(f, 8); +} +#endif + +#if T(AVX512CD) +attribute_target("avx512cd") void test_avx512cd() +{ + /* AVX512 Conflict Detection */ + __mmask16 m = ~1; + __m512i i; + i = _mm512_maskz_conflict_epi32(m, i); +} +#endif + +#if T(AVX512PF) +attribute_target("avx512pf") void test_avx512pf(void *ptr) +{ + /* AVX512 Prefetch */ + __m512i i; + __mmask16 m = 0xf; + _mm512_mask_prefetch_i64scatter_pd(ptr, m, i, 2, 2); +} +#endif + +#if T(AVX512DQ) +attribute_target("avx512dq") void test_avx512dq() +{ + /* AVX512 Doubleword and Quadword support */ + __m512i i; + __mmask16 m = ~1; + m = _mm512_movepi32_mask(i); +} +#endif + +#if T(AVX512BW) +attribute_target("avx512bw") void test_avx512bw(char *ptr) +{ + /* AVX512 Byte and Word support */ + __m512i i; + __mmask16 m = ~1; + i = _mm512_mask_loadu_epi8(i, m, ptr - 8); +} +#endif + +#if T(AVX512VL) +attribute_target("avx512vl") void test_avx512vl(char *ptr) +{ + /* AVX512 Vector Length */ + __mmask16 m = ~1; + __m256i i2 = _mm256_maskz_loadu_epi32(0, ptr); + _mm256_mask_storeu_epi32(ptr + 1, m, i2); +} +#endif + +#if T(AVX512IFMA) +attribute_target("avx512ifma") void test_avx512ifma() +{ + /* AVX512 Integer Fused Multiply-Add */ + __m512i i; + i = _mm512_madd52lo_epu64(i, i, i); +} +#endif + +int main() +{ + return 0; +} diff --git a/config.tests/x86_simd/x86_simd.pro b/config.tests/x86_simd/x86_simd.pro new file mode 100644 index 0000000000..5751432980 --- /dev/null +++ b/config.tests/x86_simd/x86_simd.pro @@ -0,0 +1,11 @@ +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) + } +} |