| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -mavx" } */ |
| 3 |
/* { dg-require-effective-target avx } */ |
| 4 |
|
| 5 |
#include "avx-check.h" |
| 6 |
|
| 7 |
extern int memcmp (const void *, const void *, __SIZE_TYPE__); |
| 8 |
|
| 9 |
void |
| 10 |
avx_test (void) |
| 11 |
{ |
| 12 |
union256i_d a, ad; |
| 13 |
union256 b, bd; |
| 14 |
union256d c, cd; |
| 15 |
union128i_d d, dd; |
| 16 |
union128 e, ed; |
| 17 |
union128d f, fd; |
| 18 |
int i; |
| 19 |
|
| 20 |
for (i = 0; i < 8; i++) |
| 21 |
{ |
| 22 |
a.a[i] = 7146908634 + i; |
| 23 |
b.a[i] = 45.12f + i; |
| 24 |
} |
| 25 |
|
| 26 |
for (i = 0; i < 4; i++) |
| 27 |
{ |
| 28 |
c.a[i] = 41234512513451345.0905 + i; |
| 29 |
d.a[i] = 109534 + i; |
| 30 |
e.a[i] = 85034.095f + i; |
| 31 |
} |
| 32 |
|
| 33 |
for (i = 0; i < 2; i++) |
| 34 |
f.a[i] = 41234512451345.0905 + i; |
| 35 |
|
| 36 |
bd.x = _mm256_castpd_ps (c.x); |
| 37 |
if (memcmp (bd.a, c.a, 32)) |
| 38 |
abort (); |
| 39 |
|
| 40 |
ad.x = _mm256_castpd_si256 (c.x); |
| 41 |
if (memcmp (ad.a, c.a, 32)) |
| 42 |
abort (); |
| 43 |
|
| 44 |
cd.x = _mm256_castps_pd (b.x); |
| 45 |
if (memcmp (cd.a, b.a, 32)) |
| 46 |
abort (); |
| 47 |
|
| 48 |
ad.x = _mm256_castps_si256 (b.x); |
| 49 |
if (memcmp (ad.a, b.a, 32)) |
| 50 |
abort (); |
| 51 |
|
| 52 |
bd.x = _mm256_castsi256_ps (a.x); |
| 53 |
if (memcmp (bd.a, a.a, 32)) |
| 54 |
abort (); |
| 55 |
|
| 56 |
cd.x = _mm256_castsi256_pd (a.x); |
| 57 |
if (memcmp (cd.a, a.a, 32)) |
| 58 |
abort (); |
| 59 |
|
| 60 |
fd.x = _mm256_castpd256_pd128 (c.x); |
| 61 |
if (memcmp (fd.a, c.a, 16)) |
| 62 |
abort (); |
| 63 |
|
| 64 |
ed.x = _mm256_castps256_ps128 (b.x); |
| 65 |
if (memcmp (ed.a, b.a, 16)) |
| 66 |
abort (); |
| 67 |
|
| 68 |
dd.x = _mm256_castsi256_si128 (a.x); |
| 69 |
if (memcmp (dd.a, a.a, 16)) |
| 70 |
abort (); |
| 71 |
|
| 72 |
cd.x = _mm256_castpd128_pd256 (f.x); |
| 73 |
if (memcmp (cd.a, f.a, 16)) |
| 74 |
abort (); |
| 75 |
|
| 76 |
bd.x = _mm256_castps128_ps256 (e.x); |
| 77 |
if (memcmp (bd.a, e.a, 16)) |
| 78 |
abort (); |
| 79 |
|
| 80 |
ad.x = _mm256_castsi128_si256 (d.x); |
| 81 |
if (memcmp (ad.a, d.a, 16)) |
| 82 |
abort (); |
| 83 |
} |