aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-12-03 19:31:12 -0600
committerRichard Henderson <richard.henderson@linaro.org>2023-01-16 10:14:12 -1000
commit701ea5870d3752173d0c78d79d9d1f57757a8036 (patch)
treef35668299954e5fdb0a056f56cdc8dd0ff152538 /meson.build
parent5584e2dbe8c9c95ceb178786fb88e5edf625e1b6 (diff)
downloadqemu-701ea5870d3752173d0c78d79d9d1f57757a8036.zip
qemu-701ea5870d3752173d0c78d79d9d1f57757a8036.tar.gz
qemu-701ea5870d3752173d0c78d79d9d1f57757a8036.tar.bz2
util/bufferiszero: Use __attribute__((target)) for avx2/avx512
Use the attribute, which is supported by clang, instead of the #pragma, which is not supported and, for some reason, also not detected by the meson probe, so we fail by -Werror. Include only <immintrin.h> as that is the outermost "official" header for these intrinsics -- emmintrin.h and smmintrin -- are older SSE2 and SSE4 specific headers, while the immintrin.h includes all of the Intel intrinsics. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build8
1 files changed, 2 insertions, 6 deletions
diff --git a/meson.build b/meson.build
index 6d212f6..58d8cd6 100644
--- a/meson.build
+++ b/meson.build
@@ -2338,11 +2338,9 @@ config_host_data.set('CONFIG_CPUID_H', have_cpuid_h)
config_host_data.set('CONFIG_AVX2_OPT', get_option('avx2') \
.require(have_cpuid_h, error_message: 'cpuid.h not available, cannot enable AVX2') \
.require(cc.links('''
- #pragma GCC push_options
- #pragma GCC target("avx2")
#include <cpuid.h>
#include <immintrin.h>
- static int bar(void *a) {
+ static int __attribute__((target("avx2"))) bar(void *a) {
__m256i x = *(__m256i *)a;
return _mm256_testz_si256(x, x);
}
@@ -2352,11 +2350,9 @@ config_host_data.set('CONFIG_AVX2_OPT', get_option('avx2') \
config_host_data.set('CONFIG_AVX512F_OPT', get_option('avx512f') \
.require(have_cpuid_h, error_message: 'cpuid.h not available, cannot enable AVX512F') \
.require(cc.links('''
- #pragma GCC push_options
- #pragma GCC target("avx512f")
#include <cpuid.h>
#include <immintrin.h>
- static int bar(void *a) {
+ static int __attribute__((target("avx512f"))) bar(void *a) {
__m512i x = *(__m512i *)a;
return _mm512_test_epi64_mask(x, x);
}