| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O3 -mavx2" } */ |
| 3 |
/* { dg-require-effective-target avx2 } */ |
| 4 |
|
| 5 |
#include "avx2-check.h" |
| 6 |
|
| 7 |
unsigned int |
| 8 |
__attribute__((noipa)) |
| 9 |
test(unsigned int a, unsigned char p[16]) { |
| 10 |
unsigned int res = 0; |
| 11 |
for (unsigned b = 0; b < a; b += 1) |
| 12 |
res = p[b] ? p[b] : (char) b; |
| 13 |
return res; |
| 14 |
} |
| 15 |
|
| 16 |
static void |
| 17 |
avx2_test (void) |
| 18 |
{ |
| 19 |
unsigned int a = 16U; |
| 20 |
unsigned char p[16]; |
| 21 |
for (int i = 0; i != 16; i++) |
| 22 |
p[i] = (unsigned char)128; |
| 23 |
unsigned int res = test (a, p); |
| 24 |
if (res != 128) |
| 25 |
__builtin_abort (); |
| 26 |
} |