1 /* { dg-do compile } */
2 /* { dg-options "-mavx512bw -mavx512vl -O2" } */
3 /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
4 /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
5 /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}{z}(?:\n|\[ \\t\]+#)" 1 } } */
6 /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*res1\[^\n\]*\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
7 /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
8 /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
9 /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}{z}(?:\n|\[ \\t\]+#)" 1 } } */
10 /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*res2\[^\n\]*\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
11 /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
12 /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
13 /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}{z}(?:\n|\[ \\t\]+#)" 1 } } */
14 /* { dg-final { scan-assembler-times "vpmovswb\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*res3\[^\n\]*\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
16 #include <immintrin.h>
18 volatile __m128i x
, z
, res1
;
19 volatile __m256i y
, res2
;
20 volatile __m512i u
, res3
;
22 volatile __mmask16 m2
;
23 volatile __mmask32 m3
;
28 z
= _mm_cvtsepi16_epi8 (x
);
29 z
= _mm_mask_cvtsepi16_epi8 (z
, m1
, x
);
30 z
= _mm_maskz_cvtsepi16_epi8 (m1
, x
);
31 _mm_mask_cvtsepi16_storeu_epi8 ((void *) &res1
, m1
, x
);
32 z
= _mm256_cvtsepi16_epi8 (y
);
33 z
= _mm256_mask_cvtsepi16_epi8 (z
, m2
, y
);
34 z
= _mm256_maskz_cvtsepi16_epi8 (m2
, y
);
35 _mm256_mask_cvtsepi16_storeu_epi8 ((void *) &res2
, m2
, y
);
36 y
= _mm512_cvtsepi16_epi8 (u
);
37 y
= _mm512_mask_cvtsepi16_epi8 (y
, m3
, u
);
38 y
= _mm512_maskz_cvtsepi16_epi8 (m3
, u
);
39 _mm512_mask_cvtsepi16_storeu_epi8 ((void *) &res3
, m3
, u
);