Debian Codegraph @

gcc/testsuite/gcc.target/i386/avx512bw-vpackssdw-3.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512bw" } */
3 /* { dg-require-effective-target avx512bw } */
4
5 #define AVX512BW
6 #include "avx512f-helper.h"
7
8 #define DST_SIZE (AVX512F_LEN / 16)
9 #define SRC_SIZE (AVX512F_LEN / 32)
10
11 #include "limits.h"
12
13 #include "avx512f-mask-type.h"
14
15 static short
16 int_to_short (int iVal)
17 {
18 short sVal;
19
20 if (iVal < -32768)
21 sVal = -32768;
22 else if (iVal > 32767)
23 sVal = 32767;
24 else
25 sVal = iVal;
26
27 return sVal;
28 }
29
30 void
31 TEST (void)
32 {
33 union512i_d s1, s2;
34 union512i_w res1;
35 short dst_ref[32];
36 int i;
37
38 s1.x = _mm512_set_epi32 (1, 2, 3, 4, 65000, 20, 30, 90, 88, 44, 33, 22, 11, 98, 76, -65000);
39 s2.x = _mm512_set_epi32 (80, 40, 31, 21, 10, 99, 74, -65000, 2, 3, 4, 5, 65010, 21, 31, 91);
40 res1.x = _mm512_packs_epi32 (s1.x, s2.x);
41 for (int i = 0; i != 4; i++)
42 {
43 dst_ref[i] = int_to_short (s1.a[i]);
44 dst_ref[i + 4] = int_to_short (s2.a[i]);
45 dst_ref[i + 8] = int_to_short (s1.a[i + 4]);
46 dst_ref[i + 12] = int_to_short (s2.a[i + 4]);
47 dst_ref[i + 16] = int_to_short (s1.a[i + 8]);
48 dst_ref[i + 20] = int_to_short (s2.a[i + 8]);
49 dst_ref[i + 24] = int_to_short (s1.a[i + 12]);
50 dst_ref[i + 28] = int_to_short (s2.a[i + 12]);
51 }
52
53 if (check_union512i_w (res1, dst_ref))
54 abort ();
55 }