2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-absps-1.c
blob14ed03744441dd9f9f8af82ad188b8abc15d2215
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
5 #define AVX512F
7 #include "avx512f-helper.h"
9 #define SIZE (AVX512F_LEN / 32)
10 #include "avx512f-mask-type.h"
12 static void
13 CALC (float *i1, float *r)
15 int i;
17 for (i = 0; i < SIZE; i++)
18 if (i1[i] < 0)
19 r[i] = -i1[i];
20 else
21 r[i] = i1[i];
24 void
25 TEST (void)
27 float ck[SIZE];
28 int i;
29 UNION_TYPE (AVX512F_LEN, ) s, d, dm;
30 MASK_TYPE mask = MASK_VALUE;
32 for (i = 0; i < SIZE; i++)
34 s.a[i] = i * ((i & 1) ? 3.5f : -7.5f);
35 d.a[i] = DEFAULT_VALUE;
36 dm.a[i] = DEFAULT_VALUE;
39 CALC (s.a, ck);
41 d.x = INTRINSIC (_abs_ps) (s.x);
42 dm.x = INTRINSIC (_mask_abs_ps) (dm.x, mask, s.x);
44 if (UNION_CHECK (AVX512F_LEN, ) (d, ck))
45 abort ();
47 MASK_MERGE () (ck, mask, SIZE);
48 if (UNION_CHECK (AVX512F_LEN, ) (dm, ck))
49 abort ();