Commit c7447c82 authored by uros's avatar uros
Browse files

* 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.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176829 138bc75d-0d04-0410-961f-82ee72b054a4
parent 05b56dfa
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.
......
......@@ -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
......
#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
......
/* 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;
}
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment