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 void static
CALC(float * s1,float * s2,float * r)13 CALC (float *s1, float *s2, float *r)
14 {
15 int i;
16
17 for (i = 0; i < SIZE / 4; i++)
18 {
19 r[4 * i] = s1[4 * i + 2];
20 r[4 * i + 1] = s2[4 * i + 2];
21 r[4 * i + 2] = s1[4 * i + 3];
22 r[4 * i + 3] = s2[4 * i + 3];
23 }
24 }
25
26 void
TEST(void)27 TEST (void)
28 {
29 UNION_TYPE (AVX512F_LEN, ) s1, s2, res1, res2, res3;
30 MASK_TYPE mask = MASK_VALUE;
31 float res_ref[SIZE];
32 int i;
33
34 for (i = 0; i < SIZE; i++)
35 {
36 s1.a[i] = i * 123.2 + 32.6;
37 s2.a[i] = i + 2.5;
38 res2.a[i] = DEFAULT_VALUE;
39 }
40
41 res1.x = INTRINSIC (_unpackhi_ps) (s1.x, s2.x);
42 res2.x = INTRINSIC (_mask_unpackhi_ps) (res2.x, mask, s1.x, s2.x);
43 res3.x = INTRINSIC (_maskz_unpackhi_ps) (mask, s1.x, s2.x);
44
45 CALC (s1.a, s2.a, res_ref);
46
47 if (UNION_CHECK (AVX512F_LEN, ) (res1, res_ref))
48 abort ();
49
50 MASK_MERGE () (res_ref, mask, SIZE);
51 if (UNION_CHECK (AVX512F_LEN, ) (res2, res_ref))
52 abort ();
53
54 MASK_ZERO () (res_ref, mask, SIZE);
55 if (UNION_CHECK (AVX512F_LEN, ) (res3, res_ref))
56 abort ();
57 }
58