2014-04-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vmovdqu32-2.c
blobf1ae73c1d824c0d4590dcacb05502de3aa75fb0f
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 typedef struct
14 char c;
15 int a[SIZE];
16 } __attribute__ ((packed)) EVAL(unaligned_array, AVX512F_LEN,);
18 static void
19 TEST (void)
21 UNION_TYPE (AVX512F_LEN, i_d) s2, res1, res3, res4;
22 EVAL(unaligned_array, AVX512F_LEN,) s1, res2, res5;
23 MASK_TYPE mask = MASK_VALUE;
24 int i, sign = 1;
26 for (i = 0; i < SIZE; i++)
28 s1.a[i] = 12345 * (i + 2000) * sign;
29 s2.a[i] = 67890 * (i + 2000) * sign;
30 res3.a[i] = DEFAULT_VALUE;
31 res5.a[i] = DEFAULT_VALUE;
32 sign = -sign;
35 #if AVX512F_LEN == 512
36 res1.x = _mm512_loadu_si512 (s1.a);
37 _mm512_storeu_si512 (res2.a, s2.x);
38 #endif
39 res3.x = INTRINSIC (_mask_loadu_epi32) (res3.x, mask, s1.a);
40 res4.x = INTRINSIC (_maskz_loadu_epi32) (mask, s1.a);
41 INTRINSIC (_mask_storeu_epi32) (res5.a, mask, s2.x);
43 #if AVX512F_LEN == 512
44 if (UNION_CHECK (AVX512F_LEN, i_d) (res1, s1.a))
45 abort ();
47 if (UNION_CHECK (AVX512F_LEN, i_d) (s2, res2.a))
48 abort ();
49 #endif
51 MASK_MERGE (i_d) (s1.a, mask, SIZE);
52 if (UNION_CHECK (AVX512F_LEN, i_d) (res3, s1.a))
53 abort ();
55 MASK_ZERO (i_d) (s1.a, mask, SIZE);
56 if (UNION_CHECK (AVX512F_LEN, i_d) (res4, s1.a))
57 abort ();
59 MASK_MERGE (i_d) (s2.a, mask, SIZE);
60 if (UNION_CHECK (AVX512F_LEN, i_d) (s2, res5.a))
61 abort ();