mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2024-11-23 12:07:03 +08:00
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
// Copyright (C) 2017 Intel Corporation.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
|
|
|
// 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(AVX512VBMI2)
|
|
attribute_target("avx512vl,avx512vbmi2") void test_avx512vbmi2()
|
|
{
|
|
/* AVX512 Vector Byte Manipulation Instructions 2 */
|
|
__m128i a = _mm_maskz_compress_epi16(-1, _mm_set1_epi16(1));
|
|
__m128i b = _mm_shrdi_epi32(a, a, 7);
|
|
}
|
|
#endif
|
|
|
|
#if T(VAES)
|
|
// VAES does not require AVX512 and works on Alder Lake
|
|
attribute_target("avx2,vaes") void test_vaes()
|
|
{
|
|
/* 256- and 512-bit AES */
|
|
__m256i a = _mm256_set1_epi32(-1);
|
|
__m256i b = _mm256_aesenc_epi128(a, a);
|
|
__m256i c = _mm256_aesdec_epi128(b, a);
|
|
}
|
|
#endif
|
|
|
|
int main()
|
|
{
|
|
return 0;
|
|
}
|