1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
4
5 #define AVX512F
6
7 #include "avx512f-helper.h"
8
9 #define SIZE (AVX512F_LEN / 32)
10 #include "avx512f-mask-type.h"
11
12 static void
CALC(float * i1,float * r)13 CALC (float *i1, float *r)
14 {
15 int i;
16
17 for (i = 0; i < SIZE; i++)
18 if (i1[i] < 0)
19 r[i] = -i1[i];
20 else
21 r[i] = i1[i];
22 }
23
24 void
TEST(void)25 TEST (void)
26 {
27 float ck[SIZE];
28 int i;
29 UNION_TYPE (AVX512F_LEN, ) s, d, dm;
30 MASK_TYPE mask = MASK_VALUE;
31
32 for (i = 0; i < SIZE; i++)
33 {
34 s.a[i] = i * ((i & 1) ? 3.5f : -7.5f);
35 d.a[i] = DEFAULT_VALUE;
36 dm.a[i] = DEFAULT_VALUE;
37 }
38
39 CALC (s.a, ck);
40
41 d.x = INTRINSIC (_abs_ps) (s.x);
42 dm.x = INTRINSIC (_mask_abs_ps) (dm.x, mask, s.x);
43
44 if (UNION_CHECK (AVX512F_LEN, ) (d, ck))
45 abort ();
46
47 MASK_MERGE () (ck, mask, SIZE);
48 if (UNION_CHECK (AVX512F_LEN, ) (dm, ck))
49 abort ();
50 }
51