| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target avx } */ |
| 3 |
/* { dg-options "-O3 -mavx" } */ |
| 4 |
|
| 5 |
#include <stdlib.h> |
| 6 |
#include "cpuid.h" |
| 7 |
#include "m256-check.h" |
| 8 |
#include "avx-os-support.h" |
| 9 |
|
| 10 |
static void __attribute__((constructor)) |
| 11 |
check_avx (void) |
| 12 |
{ |
| 13 |
unsigned int eax, ebx, ecx, edx; |
| 14 |
|
| 15 |
if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) |
| 16 |
exit (0); |
| 17 |
|
| 18 |
/* Run AVX test only if host has AVX support. */ |
| 19 |
if (((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE)) |
| 20 |
&& avx_os_support ()) |
| 21 |
return; |
| 22 |
|
| 23 |
exit (0); |
| 24 |
} |
| 25 |
|
| 26 |
struct S |
| 27 |
{ |
| 28 |
short b; |
| 29 |
long c; |
| 30 |
char d; |
| 31 |
long e; |
| 32 |
unsigned:8; |
| 33 |
}; |
| 34 |
|
| 35 |
int f, h, k, l; |
| 36 |
int g[10]; |
| 37 |
volatile struct S j; |
| 38 |
char m; |
| 39 |
|
| 40 |
int |
| 41 |
main (void) |
| 42 |
{ |
| 43 |
int i; |
| 44 |
struct S n; |
| 45 |
for (i = 0; i < 6; i++) |
| 46 |
{ |
| 47 |
for (f = 0; f < 10; f++) |
| 48 |
g[f] = 4; |
| 49 |
n = j; |
| 50 |
h = m == 0 ? 1 : 5 % m; |
| 51 |
if (l) |
| 52 |
n.b = k; |
| 53 |
} |
| 54 |
return n.b; |
| 55 |
} |