| 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 |
union128i_q s1; |
| 12 |
union256i_q res, res1; |
| 13 |
long long int res_ref[4]; |
| 14 |
int i, j; |
| 15 |
int fail = 0; |
| 16 |
|
| 17 |
for (i = 0; i < 10; i++) |
| 18 |
{ |
| 19 |
for (j = 0; j < 2; j++) |
| 20 |
s1.a[j] = j * i; |
| 21 |
|
| 22 |
res.x = _mm256_broadcastsi128_si256 (s1.x); |
| 23 |
res1.x = _mm_broadcastsi128_si256 (s1.x); |
| 24 |
|
| 25 |
memcpy (res_ref, s1.a, 16); |
| 26 |
memcpy (res_ref + 2, s1.a, 16); |
| 27 |
|
| 28 |
fail += check_union256i_q (res, res_ref); |
| 29 |
fail += check_union256i_q (res1, res_ref); |
| 30 |
} |
| 31 |
|
| 32 |
if (fail != 0) |
| 33 |
abort (); |
| 34 |
|
| 35 |
} |