* [PATCH] migration/xbzrle: Use __attribute__((target)) for avx512
@ 2023-05-01 21:05 Richard Henderson
2023-05-02 7:11 ` Juan Quintela
0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2023-05-01 21:05 UTC (permalink / raw)
To: qemu-devel; +Cc: quintela, peterx, leobras, pbonzini
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.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
migration/xbzrle.c | 9 ++++-----
meson.build | 5 +----
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/migration/xbzrle.c b/migration/xbzrle.c
index c6f8b20917..258e4959c9 100644
--- a/migration/xbzrle.c
+++ b/migration/xbzrle.c
@@ -177,11 +177,11 @@ int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen)
}
#if defined(CONFIG_AVX512BW_OPT)
-#pragma GCC push_options
-#pragma GCC target("avx512bw")
#include <immintrin.h>
-int xbzrle_encode_buffer_avx512(uint8_t *old_buf, uint8_t *new_buf, int slen,
- uint8_t *dst, int dlen)
+
+int __attribute__((target("avx512bw")))
+xbzrle_encode_buffer_avx512(uint8_t *old_buf, uint8_t *new_buf, int slen,
+ uint8_t *dst, int dlen)
{
uint32_t zrun_len = 0, nzrun_len = 0;
int d = 0, i = 0, num = 0;
@@ -296,5 +296,4 @@ int xbzrle_encode_buffer_avx512(uint8_t *old_buf, uint8_t *new_buf, int slen,
}
return d;
}
-#pragma GCC pop_options
#endif
diff --git a/meson.build b/meson.build
index f71653d0c8..4bbdbcef37 100644
--- a/meson.build
+++ b/meson.build
@@ -2386,12 +2386,9 @@ config_host_data.set('CONFIG_AVX512F_OPT', get_option('avx512f') \
config_host_data.set('CONFIG_AVX512BW_OPT', get_option('avx512bw') \
.require(have_cpuid_h, error_message: 'cpuid.h not available, cannot enable AVX512BW') \
.require(cc.links('''
- #pragma GCC push_options
- #pragma GCC target("avx512bw")
#include <cpuid.h>
#include <immintrin.h>
- static int bar(void *a) {
-
+ static int __attribute__((target("avx512bw"))) bar(void *a) {
__m512i *x = a;
__m512i res= _mm512_abs_epi8(*x);
return res[1];
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] migration/xbzrle: Use __attribute__((target)) for avx512
2023-05-01 21:05 [PATCH] migration/xbzrle: Use __attribute__((target)) for avx512 Richard Henderson
@ 2023-05-02 7:11 ` Juan Quintela
2023-05-02 10:31 ` Richard Henderson
0 siblings, 1 reply; 3+ messages in thread
From: Juan Quintela @ 2023-05-02 7:11 UTC (permalink / raw)
To: Richard Henderson; +Cc: qemu-devel, peterx, leobras, pbonzini
Richard Henderson <richard.henderson@linaro.org> wrote:
> 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.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] migration/xbzrle: Use __attribute__((target)) for avx512
2023-05-02 7:11 ` Juan Quintela
@ 2023-05-02 10:31 ` Richard Henderson
0 siblings, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2023-05-02 10:31 UTC (permalink / raw)
To: quintela; +Cc: qemu-devel, peterx, leobras, pbonzini
On 5/2/23 08:11, Juan Quintela wrote:
> Richard Henderson <richard.henderson@linaro.org> wrote:
>> 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.
>>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>
> Reviewed-by: Juan Quintela <quintela@redhat.com>
>
Queued to tcg-next.
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-02 10:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-01 21:05 [PATCH] migration/xbzrle: Use __attribute__((target)) for avx512 Richard Henderson
2023-05-02 7:11 ` Juan Quintela
2023-05-02 10:31 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).