Debian Codegraph @

gcc/testsuite/gcc.target/i386/avx10_2-512-vcvttpd2dqs-2.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O2 -march=x86-64-v3 -mavx10.2" } */
3 /* { dg-require-effective-target avx10_2 } */
4
5 #ifndef AVX10_2
6 #define AVX10_2
7 #define AVX10_2_512
8 #define AVX10_512BIT
9 #endif
10 #include "avx10-helper.h"
11 #include <limits.h>
12 #include <string.h>
13
14 #define SRC_SIZE (AVX512F_LEN / 64)
15 #define SIZE (AVX512F_LEN_HALF / 32)
16 #include "avx512f-mask-type.h"
17
18 static void
19 CALC (double *s, int *r)
20 {
21 int i;
22
23 for (i = 0; i < SRC_SIZE; i++)
24 {
25 if (s[i] > INT_MAX)
26 r[i] = INT_MAX;
27 else if (s[i] < INT_MIN)
28 r[i] = INT_MIN;
29 else
30 r[i] = s[i];
31 }
32 }
33
34 void
35 TEST (void)
36 {
37 UNION_TYPE (AVX512F_LEN, d) s;
38 UNION_TYPE (AVX512F_LEN_HALF, i_d) res1, res2, res3;
39 MASK_TYPE mask = MASK_VALUE;
40 int res_ref[SIZE] = { 0 }, res_ref2[SIZE] = { 0 };
41 int i, sign = 1;
42
43 for (i = 0; i < SRC_SIZE; i++)
44 {
45 s.a[i] = 1.23 * (i + 2) * sign;
46 sign = -sign;
47 }
48
49 for (i = 0; i < SIZE; i++)
50 res2.a[i] = DEFAULT_VALUE;
51
52 res1.x = INTRINSIC (_cvtts_pd_epi32) (s.x);
53 res2.x = INTRINSIC (_mask_cvtts_pd_epi32) (res2.x, mask, s.x);
54 res3.x = INTRINSIC (_maskz_cvtts_pd_epi32) (mask, s.x);
55
56 CALC (s.a, res_ref);
57 memcpy(res_ref2, res_ref, sizeof(res_ref));
58
59 if (UNION_CHECK (AVX512F_LEN_HALF, i_d) (res1, res_ref))
60 abort ();
61
62 MASK_MERGE (i_d) (res_ref, mask, SRC_SIZE);
63 if (UNION_CHECK (AVX512F_LEN_HALF, i_d) (res2, res_ref))
64 abort ();
65
66 MASK_ZERO (i_d) (res_ref, mask, SRC_SIZE);
67 if (UNION_CHECK (AVX512F_LEN_HALF, i_d) (res3, res_ref))
68 abort ();
69
70 #if AVX512F_LEN == 512
71 for (i = 0; i < SIZE; i++)
72 res2.a[i] = DEFAULT_VALUE;
73
74 res1.x = INTRINSIC (_cvtts_roundpd_epi32) (s.x, 8);
75 res2.x = INTRINSIC (_mask_cvtts_roundpd_epi32) (res2.x, mask, s.x, 8);
76 res3.x = INTRINSIC (_maskz_cvtts_roundpd_epi32) (mask, s.x, 8);
77
78 if (UNION_CHECK (AVX512F_LEN_HALF, i_d) (res1, res_ref2))
79 abort ();
80
81 MASK_MERGE (i_d) (res_ref2, mask, SRC_SIZE);
82 if (UNION_CHECK (AVX512F_LEN_HALF, i_d) (res2, res_ref2))
83 abort ();
84
85 MASK_ZERO (i_d) (res_ref2, mask, SRC_SIZE);
86 if (UNION_CHECK (AVX512F_LEN_HALF, i_d) (res3, res_ref2))
87 abort ();
88 #endif
89 }