2015-12-10 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-typecast-1.c
blobe69e9c0b2b7ef59529aac541453bb44312a80428
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
5 #include "avx512f-check.h"
7 extern int memcmp (const void *, const void *, __SIZE_TYPE__);
9 void
10 avx512f_test (void)
12 union512i_d a, ad;
13 union512 b, bd;
14 union512d c, cd;
15 union256i_d d, dd;
16 union256 e, ed;
17 union256d f, fd;
18 union128i_d g, gd;
19 union128 h, hd;
20 union128d k, kd;
21 int i;
23 for (i = 0; i < 16; i++)
25 a.a[i] = 7146908634 + i;
26 b.a[i] = 45.12f + i;
29 for (i = 0; i < 8; i++)
31 c.a[i] = 41234512513451345.0905 + i;
32 d.a[i] = 109534 + i;
33 e.a[i] = 85034.095f + i;
36 for (i = 0; i < 4; i++)
38 f.a[i] = 41234512451345.0905 + i;
39 g.a[i] = 71469086341 + i;
40 h.a[i] = 45.1264f + i;
43 for (i = 0; i < 2; i++)
45 k.a[i] = 7146908634.576 + i;
48 bd.x = _mm512_castpd_ps (c.x);
49 if (memcmp(bd.a, c.a, 64))
50 abort ();
52 ad.x = _mm512_castpd_si512 (c.x);
53 if (memcmp(ad.a, c.a, 64))
54 abort ();
56 cd.x = _mm512_castps_pd (b.x);
57 if (memcmp(cd.a, b.a, 64))
58 abort ();
60 ad.x = _mm512_castps_si512 (b.x);
61 if (memcmp(ad.a, b.a, 64))
62 abort ();
64 bd.x = _mm512_castsi512_ps (a.x);
65 if (memcmp(bd.a, a.a, 64))
66 abort ();
68 cd.x = _mm512_castsi512_pd (a.x);
69 if (memcmp(cd.a, a.a, 64))
70 abort ();
72 kd.x = _mm512_castpd512_pd128 (c.x);
73 if (memcmp(kd.a, c.a, 16))
74 abort ();
76 hd.x = _mm512_castps512_ps128 (b.x);
77 if (memcmp(hd.a, b.a, 16))
78 abort ();
80 gd.x = _mm512_castsi512_si128 (a.x);
81 if (memcmp(gd.a, a.a, 16))
82 abort ();
84 fd.x = _mm512_castpd512_pd256 (c.x);
85 if (memcmp(fd.a, c.a, 32))
86 abort ();
88 ed.x = _mm512_castps512_ps256 (b.x);
89 if (memcmp(ed.a, b.a, 32))
90 abort ();
92 dd.x = _mm512_castsi512_si256 (a.x);
93 if (memcmp(dd.a, a.a, 32))
94 abort ();
96 cd.x = _mm512_castpd128_pd512 (k.x);
97 if (memcmp(cd.a, k.a, 16))
98 abort ();
100 bd.x = _mm512_castps128_ps512 (h.x);
101 if (memcmp(bd.a, h.a, 16))
102 abort ();
104 ad.x = _mm512_castsi128_si512 (g.x);
105 if (memcmp(ad.a, g.a, 16))
106 abort ();
108 cd.x = _mm512_castpd256_pd512 (f.x);
109 if (memcmp(cd.a, f.a, 32))
110 abort ();
112 bd.x = _mm512_castps256_ps512 (e.x);
113 if (memcmp(bd.a, e.a, 32))
114 abort ();
116 ad.x = _mm512_castsi256_si512 (d.x);
117 if (memcmp(ad.a, d.a, 32))
118 abort ();