| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target avx2 } */ |
| 3 |
/* { dg-options "-O2 -mavx2" } */ |
| 4 |
|
| 5 |
#include <string.h> |
| 6 |
#include "avx2-check.h" |
| 7 |
|
| 8 |
void static |
| 9 |
avx2_test (void) |
| 10 |
{ |
| 11 |
union256i_q s1; |
| 12 |
union128i_q res; |
| 13 |
long long int res_ref[2]; |
| 14 |
int j; |
| 15 |
|
| 16 |
for (j = 0; j < 4; j++) |
| 17 |
s1.a[j] = j * j; |
| 18 |
|
| 19 |
res.x = _mm256_extracti128_si256 (s1.x, 0); |
| 20 |
|
| 21 |
memset (res_ref, 0, 16); |
| 22 |
memcpy (res_ref, s1.a, 16); |
| 23 |
|
| 24 |
if (check_union128i_q (res, res_ref)) |
| 25 |
abort (); |
| 26 |
|
| 27 |
res.x = _mm256_extracti128_si256 (s1.x, 1); |
| 28 |
|
| 29 |
memset (res_ref, 0, 16); |
| 30 |
memcpy (res_ref, s1.a + 2, 16); |
| 31 |
|
| 32 |
if (check_union128i_q (res, res_ref)) |
| 33 |
abort (); |
| 34 |
} |