PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vextractf32x4-2.c
blob39d463d9697c0873a298c21f9df2bd7696e1d70f
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"
11 #include "string.h"
13 static void
14 CALC (UNION_TYPE (AVX512F_LEN,) s1, float *res_ref, int mask)
16 memset (res_ref, 0, 16);
17 memcpy (res_ref, s1.a + mask * 4, 16);
20 void
21 TEST (void)
23 UNION_TYPE (AVX512F_LEN,) s1;
24 union128 res1, res2, res3;
25 float res_ref[4];
26 MASK_TYPE mask = MASK_VALUE;
27 int j;
29 for (j = 0; j < SIZE; j++)
31 s1.a[j] = j * j / 4.56;
34 for (j = 0; j < 4; j++)
36 res1.a[j] = DEFAULT_VALUE;
37 res2.a[j] = DEFAULT_VALUE;
38 res3.a[j] = DEFAULT_VALUE;
41 res1.x = INTRINSIC (_extractf32x4_ps) (s1.x, 1);
42 res2.x = INTRINSIC (_mask_extractf32x4_ps) (res2.x, mask, s1.x, 1);
43 res3.x = INTRINSIC (_maskz_extractf32x4_ps) (mask, s1.x, 1);
44 CALC (s1, res_ref, 1);
46 if (check_union128 (res1, res_ref))
47 abort ();
49 MASK_MERGE ()(res_ref, mask, 4);
50 if (check_union128 (res2, res_ref))
51 abort ();
53 MASK_ZERO ()(res_ref, mask, 4);
54 if (check_union128 (res3, res_ref))
55 abort ();