diff options
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr83735.c | 55 |
2 files changed, 60 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c6adde8..a46a5ee 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-10 H.J. Lu <hongjiu.lu@intel.com> + + PR target/83735 + * gcc.target/i386/pr83735.c: New test. + 2018-01-10 Christophe Lyon <christophe.lyon@linaro.org> * lib/target-supports.exp (check_effective_target_branch_cost): diff --git a/gcc/testsuite/gcc.target/i386/pr83735.c b/gcc/testsuite/gcc.target/i386/pr83735.c new file mode 100644 index 0000000..786c90a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr83735.c @@ -0,0 +1,55 @@ +/* { dg-do run } */ +/* { dg-require-effective-target avx } */ +/* { dg-options "-O3 -mavx" } */ + +#include <stdlib.h> +#include "cpuid.h" +#include "m256-check.h" +#include "avx-os-support.h" + +static void __attribute__((constructor)) +check_avx (void) +{ + unsigned int eax, ebx, ecx, edx; + + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + exit (0); + + /* Run AVX test only if host has AVX support. */ + if (((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE)) + && avx_os_support ()) + return; + + exit (0); +} + +struct S +{ + short b; + long c; + char d; + long e; + unsigned:8; +}; + +int f, h, k, l; +int g[10]; +volatile struct S j; +char m; + +int +main (void) +{ + int i; + struct S n; + for (i = 0; i < 6; i++) + { + for (f = 0; f < 10; f++) + g[f] = 4; + n = j; + h = m == 0 ? 1 : 5 % m; + if (l) + n.b = k; + } + return n.b; +} |