Debian Codegraph @

gcc/testsuite/gcc.target/i386/avx512dq-vandps-2.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512dq" } */
3 /* { dg-require-effective-target avx512dq } */
4
5 #define AVX512DQ
6 #include "avx512f-helper.h"
7
8 #define SIZE (AVX512F_LEN / 32)
9 #include "avx512f-mask-type.h"
10
11 void
12 CALC (float *s1, float *s2, float *r)
13 {
14 int i;
15 int tmp;
16
17 for (i = 0; i < SIZE; i++)
18 {
19 union U { float f; int i; } u1, u2;
20 u1.f = s1[i];
21 u2.f = s2[i];
22 u1.i &= u2.i;
23 r[i] = u1.f;
24 }
25 }
26
27 void
28 TEST (void)
29 {
30 UNION_TYPE (AVX512F_LEN, ) s1, s2, res1, res2, res3;
31 MASK_TYPE mask = MASK_VALUE;
32 float res_ref[SIZE];
33 int i;
34
35 for (i = 0; i < SIZE; i++)
36 {
37 s1.a[i] = 13. * i;
38 s2.a[i] = 17. * i;
39 res2.a[i] = DEFAULT_VALUE;
40 }
41
42 res1.x = INTRINSIC (_and_ps) (s1.x, s2.x);
43 res2.x = INTRINSIC (_mask_and_ps) (res2.x, mask, s1.x, s2.x);
44 res3.x = INTRINSIC (_maskz_and_ps) (mask, s1.x, s2.x);
45
46 CALC (s1.a, s2.a, res_ref);
47
48 if (UNION_CHECK (AVX512F_LEN, ) (res1, res_ref))
49 abort ();
50
51 MASK_MERGE () (res_ref, mask, SIZE);
52 if (UNION_CHECK (AVX512F_LEN, ) (res2, res_ref))
53 abort ();
54
55 MASK_ZERO () (res_ref, mask, SIZE);
56 if (UNION_CHECK (AVX512F_LEN, ) (res3, res_ref))
57 abort ();
58 }