diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2011-07-27 17:39:58 +0200 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2011-07-27 17:39:58 +0200 |
commit | 5019a14eee123f629c24747178e6ab3c22a5dbc9 (patch) | |
tree | 30a92bd776f2098bf54c9a150f76213611aa0cdf /gcc | |
parent | 2fe83a0c9f923c21c75498982c2606beacc3f5d6 (diff) | |
download | gcc-5019a14eee123f629c24747178e6ab3c22a5dbc9.zip gcc-5019a14eee123f629c24747178e6ab3c22a5dbc9.tar.gz gcc-5019a14eee123f629c24747178e6ab3c22a5dbc9.tar.bz2 |
avx-os-support.h: New.
* gcc.target/i386/avx-os-support.h: New.
* gcc.target/i386/avx-check.h: Include avx-os-support.h
(main): Check avx_os_support before the test is run.
* gcc.target/i386/aes-avx-check.h: Ditto.
* gcc.target/i386/pclmul-avx-check.h: Ditto.
From-SVN: r176829
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/aes-avx-check.h | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/avx-check.h | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/avx-os-support.h | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pclmul-avx-check.h | 6 |
5 files changed, 29 insertions, 5 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a90a639..9beb225 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2011-07-27 Uros Bizjak <ubizjak@gmail.com> + + * gcc.target/i386/avx-os-support.h: New. + * gcc.target/i386/avx-check.h: Include avx-os-support.h + (main): Check avx_os_support before the test is run. + * gcc.target/i386/aes-avx-check.h: Ditto. + * gcc.target/i386/pclmul-avx-check.h: Ditto. + 2011-07-27 Kai Tietz <ktietz@redhat.com> * gcc.target/i386/aggregate-ret3.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/aes-avx-check.h b/gcc/testsuite/gcc.target/i386/aes-avx-check.h index 36a038e..f2a4ead 100644 --- a/gcc/testsuite/gcc.target/i386/aes-avx-check.h +++ b/gcc/testsuite/gcc.target/i386/aes-avx-check.h @@ -3,6 +3,7 @@ #endif #include <stdlib.h> #include "cpuid.h" +#include "avx-os-support.h" static void aes_avx_test (void); @@ -22,8 +23,9 @@ main () return 0; /* Run AES + AVX test only if host has AES + AVX support. */ - if ((ecx & (bit_AVX | bit_OSXSAVE | bit_AES)) - == (bit_AVX | bit_OSXSAVE | bit_AES)) + if (((ecx & (bit_AVX | bit_OSXSAVE | bit_AES)) + == (bit_AVX | bit_OSXSAVE | bit_AES)) + && avx_os_support ()) { do_test (); #ifdef DEBUG diff --git a/gcc/testsuite/gcc.target/i386/avx-check.h b/gcc/testsuite/gcc.target/i386/avx-check.h index b15584a..7ddca9d 100644 --- a/gcc/testsuite/gcc.target/i386/avx-check.h +++ b/gcc/testsuite/gcc.target/i386/avx-check.h @@ -1,6 +1,7 @@ #include <stdlib.h> #include "cpuid.h" #include "m256-check.h" +#include "avx-os-support.h" static void avx_test (void); @@ -20,7 +21,8 @@ main () return 0; /* Run AVX test only if host has AVX support. */ - if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE)) + if (((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE)) + && avx_os_support ()) { do_test (); #ifdef DEBUG diff --git a/gcc/testsuite/gcc.target/i386/avx-os-support.h b/gcc/testsuite/gcc.target/i386/avx-os-support.h new file mode 100644 index 0000000..21d332f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx-os-support.h @@ -0,0 +1,10 @@ +/* Check if the OS supports executing AVX instructions. */ + +static int +avx_os_support (void) +{ + unsigned int eax, edx; + + __asm__ ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0)); + return (eax & 6) == 6; +} diff --git a/gcc/testsuite/gcc.target/i386/pclmul-avx-check.h b/gcc/testsuite/gcc.target/i386/pclmul-avx-check.h index 750e25c..5eed2e2 100644 --- a/gcc/testsuite/gcc.target/i386/pclmul-avx-check.h +++ b/gcc/testsuite/gcc.target/i386/pclmul-avx-check.h @@ -3,6 +3,7 @@ #endif #include <stdlib.h> #include "cpuid.h" +#include "avx-os-support.h" static void pclmul_avx_test (void); @@ -22,8 +23,9 @@ main () return 0; /* Run PCLMUL + AVX test only if host has PCLMUL + AVX support. */ - if ((ecx & (bit_AVX | bit_OSXSAVE | bit_PCLMUL)) - == (bit_AVX | bit_OSXSAVE | bit_PCLMUL)) + if (((ecx & (bit_AVX | bit_OSXSAVE | bit_PCLMUL)) + == (bit_AVX | bit_OSXSAVE | bit_PCLMUL)) + && avx_os_support ()) { do_test (); #ifdef DEBUG |