Debian Codegraph @

gcc/testsuite/gcc.target/i386/avx10_2-512-vpdpbuud-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
11 #include "avx10-helper.h"
12
13 #define SRC_SIZE (AVX512F_LEN / 8)
14 #define SIZE (AVX512F_LEN / 32)
15 #include "avx512f-mask-type.h"
16
17 static void
18 CALC (int *r, int *dst, unsigned char *s1, unsigned char *s2)
19 {
20 unsigned short tempres[SRC_SIZE];
21 for (int i = 0; i < SRC_SIZE; i++)
22 tempres[i] = (unsigned short) s1[i] * (unsigned short) s2[i];
23 for (int i = 0; i < SIZE; i++)
24 {
25 long long test = (long long) dst[i] + tempres[i * 4] + tempres[i * 4 + 1]
26 + tempres[i * 4 + 2] + tempres[i * 4 + 3];
27 r[i] = test;
28 }
29 }
30
31 void
32 TEST (void)
33 {
34 int i;
35 UNION_TYPE (AVX512F_LEN, i_d) res1, res2, res3;
36 UNION_TYPE (AVX512F_LEN, i_ub) src1;
37 UNION_TYPE (AVX512F_LEN, i_ub) src2;
38 MASK_TYPE mask = MASK_VALUE;
39 int res_ref[SIZE], res_ref2[SIZE];
40
41 for (i = 0; i < SRC_SIZE; i++)
42 {
43 src1.a[i] = 10 + 3 * i * i;
44 src2.a[i] = 10 * i * i;
45 }
46
47 for (i = 0; i < SIZE; i++)
48 {
49 res1.a[i] = 0x7FFFFFFF;
50 res2.a[i] = DEFAULT_VALUE;
51 res3.a[i] = DEFAULT_VALUE;
52 }
53
54 CALC (res_ref, res1.a, src1.a, src2.a);
55 CALC (res_ref2, res2.a, src1.a, src2.a);
56
57 res1.x = INTRINSIC (_dpbuud_epi32) (res1.x, src1.x, src2.x);
58 res2.x = INTRINSIC (_mask_dpbuud_epi32) (res2.x, mask, src1.x, src2.x);
59 res3.x = INTRINSIC (_maskz_dpbuud_epi32) (mask, res3.x, src1.x, src2.x);
60
61 if (UNION_CHECK (AVX512F_LEN, i_d) (res1, res_ref))
62 abort ();
63
64 MASK_MERGE (i_d) (res_ref2, mask, SIZE);
65 if (UNION_CHECK (AVX512F_LEN, i_d) (res2, res_ref2))
66 abort ();
67
68 MASK_ZERO (i_d) (res_ref2, mask, SIZE);
69 if (UNION_CHECK (AVX512F_LEN, i_d) (res3, res_ref2))
70 abort ();
71 }