2014-04-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vextracti32x4-2.c
blob1ea77b034227ec0cad2e95ed3c9b1f27b5058920
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 void
14 CALC (UNION_TYPE (AVX512F_LEN, i_d) s1, int *res_ref, int mask)
16 memset (res_ref, 0, 16);
17 memcpy (res_ref, s1.a + mask * 4, 16);
20 void static
21 TEST (void)
23 UNION_TYPE (AVX512F_LEN, i_d) s1;
24 union128i_d res1, res2, res3;
25 int 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 (_extracti32x4_epi32) (s1.x, 1);
42 res2.x =
43 INTRINSIC (_mask_extracti32x4_epi32) (res2.x, mask, s1.x, 1);
44 res3.x = INTRINSIC (_maskz_extracti32x4_epi32) (mask, s1.x, 1);
45 CALC (s1, res_ref, 1);
47 if (check_union128i_d (res1, res_ref))
48 abort ();
50 MASK_MERGE (i_d) (res_ref, mask, 4);
51 if (check_union128i_d (res2, res_ref))
52 abort ();
54 MASK_ZERO (i_d) (res_ref, mask, 4);
55 if (check_union128i_d (res3, res_ref))
56 abort ();