Commit 1d8ec041 by Uros Bizjak Committed by Uros Bizjak

target-supports.exp (check_avx_hw_available): New procedure.

	* lib/target-supports.exp (check_avx_hw_available): New procedure.
	(check_effective_target_avx_runtime): New procedure.
	(check_effective_target_sse2_runtime): Add check_effective_target_sse2.
	(check_effective_target_sse_runtime): Add check_effective_target_sse.

	* gcc.dg/compat/pr38736_main.c: Use avx_runtime effective target.
	* gcc.dg/compat/vector-1b_main.c: Ditto.  Remove cpuid.h include
	and __get_cpuid test.
	* gcc.dg/compat/vector-2b_main.c: Ditto.

	* gcc.target/i386/avx-check.h (main): Also check bit_OSXSAVE.

	* gcc.dg/20020418-1.c: Do not require sse2 effective target
	for compile-time only test.
	* gcc.dg/pr32716.c: Ditto.
	* gcc.dg/pr34856.c: Ditto.
	* gcc.dg/pr36997.c: Ditto.
	* gcc.dg/prefetch-loop-arrays-1.c: Ditto.
	* gfortran.dg/pr28158.f90: Ditto.
	* gfortran.dg/pr30667.f: Ditto.

	* gcc.dg/vect/vect.exp: Use check_effective_target_sse2_runtime for
	i?86-*-* and x86_64-*-* targets to disable execution on targets
	without sse2 runtime support.
	* g++.dg/vect/vect.exp: Ditto.
	* gfortran.dg/vect/vect.exp: Ditto.

	* gcc.dg/pr36584.c: Remove now redundant sse2 effective target check.
	* gcc.dg/pr37544.c: Ditto.
	* gcc.dg/pr40550.c: Ditto.
	* gcc.dg/compat/union-m128-1_main.c: Ditto.
	* gcc.dg/compat/vector-1a_main.c: Ditto.
	* gcc.dg/compat/vector-2a_main.c: Ditto.
	* gcc.dg/torture/pr16104-1.c: Ditto.
	* gcc.dg/torture/pr35771-1.c: Ditto.
	* gcc.dg/torture/pr35771-2.c: Ditto.
	* gcc.dg/torture/pr35771-3.c: Ditto.
	* gcc.dg/torture/stackalign/alloca-2.c: Ditto.
	* gcc.dg/torture/stackalign/alloca-3.c: Ditto.
	* gcc.dg/torture/stackalign/push-1.c: Ditto.
	* gcc.dg/torture/stackalign/vararg-3.c: Ditto.
	* g++.dg/other/i386-1.C: Ditto.
	* g++.dg/other/pr40446.C: Ditto.

From-SVN: r162456
parent a23c4464
2010-06-23 Uros Bizjak <ubizjak@gmail.com>
* lib/target-supports.exp (check_avx_hw_available): New procedure.
(check_effective_target_avx_runtime): New procedure.
(check_effective_target_sse2_runtime): Add check_effective_target_sse2.
(check_effective_target_sse_runtime): Add check_effective_target_sse.
* gcc.dg/compat/pr38736_main.c: Use avx_runtime effective target.
* gcc.dg/compat/vector-1b_main.c: Ditto. Remove cpuid.h include
and __get_cpuid test.
* gcc.dg/compat/vector-2b_main.c: Ditto.
* gcc.target/i386/avx-check.h (main): Also check bit_OSXSAVE.
* gcc.dg/20020418-1.c: Do not require sse2 effective target
for compile-time only test.
* gcc.dg/pr32716.c: Ditto.
* gcc.dg/pr34856.c: Ditto.
* gcc.dg/pr36997.c: Ditto.
* gcc.dg/prefetch-loop-arrays-1.c: Ditto.
* gfortran.dg/pr28158.f90: Ditto.
* gfortran.dg/pr30667.f: Ditto.
* gcc.dg/vect/vect.exp: Use check_effective_target_sse2_runtime for
i?86-*-* and x86_64-*-* targets to disable execution on targets
without sse2 runtime support.
* g++.dg/vect/vect.exp: Ditto.
* gfortran.dg/vect/vect.exp: Ditto.
* gcc.dg/pr36584.c: Remove now redundant sse2 effective target check.
* gcc.dg/pr37544.c: Ditto.
* gcc.dg/pr40550.c: Ditto.
* gcc.dg/compat/union-m128-1_main.c: Ditto.
* gcc.dg/compat/vector-1a_main.c: Ditto.
* gcc.dg/compat/vector-2a_main.c: Ditto.
* gcc.dg/torture/pr16104-1.c: Ditto.
* gcc.dg/torture/pr35771-1.c: Ditto.
* gcc.dg/torture/pr35771-2.c: Ditto.
* gcc.dg/torture/pr35771-3.c: Ditto.
* gcc.dg/torture/stackalign/alloca-2.c: Ditto.
* gcc.dg/torture/stackalign/alloca-3.c: Ditto.
* gcc.dg/torture/stackalign/push-1.c: Ditto.
* gcc.dg/torture/stackalign/vararg-3.c: Ditto.
* g++.dg/other/i386-1.C: Ditto.
* g++.dg/other/pr40446.C: Ditto.
2010-07-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2010-07-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* gcc.dg/pr43058.c: Use dg-timeout-factor 4. * gcc.dg/pr43058.c: Use dg-timeout-factor 4.
......
/* { dg-do run { target i?86-*-* x86_64-*-* } } */ /* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-msse2" } */ /* { dg-options "-msse2" } */
/* { dg-require-effective-target sse2 } */
/* { dg-require-effective-target sse2_runtime } */ /* { dg-require-effective-target sse2_runtime } */
#include <xmmintrin.h> #include <xmmintrin.h>
......
// PR middle-end/40446 // PR middle-end/40446
// { dg-do run { target i?86-*-* x86_64-*-* } } // { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-options "-O1 -msse2" } // { dg-options "-O1 -msse2" }
// { dg-require-effective-target sse2 }
// { dg-require-effective-target sse2_runtime } // { dg-require-effective-target sse2_runtime }
#include <emmintrin.h> #include <emmintrin.h>
......
...@@ -75,11 +75,8 @@ if [istarget "powerpc-*paired*"] { ...@@ -75,11 +75,8 @@ if [istarget "powerpc-*paired*"] {
} elseif { [istarget "spu-*-*"] } { } elseif { [istarget "spu-*-*"] } {
set dg-do-what-default run set dg-do-what-default run
} elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } { } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
if { ![check_effective_target_sse2] } then {
return
}
lappend DEFAULT_VECTCFLAGS "-msse2" lappend DEFAULT_VECTCFLAGS "-msse2"
if { [check_sse2_hw_available] && [check_sse_os_support_available] } { if { [check_effective_target_sse2_runtime] } {
set dg-do-what-default run set dg-do-what-default run
} else { } else {
set dg-do-what-default compile set dg-do-what-default compile
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-options "-O2 -msse -ffast-math" { target i?86-*-* x86_64-*-* } } */ /* { dg-options "-O2 -msse -ffast-math" { target i?86-*-* x86_64-*-* } } */
/* { dg-require-effective-target sse { target i?86-*-* x86_64-*-* } } */
void bar (float *a, float *b); void bar (float *a, float *b);
......
/* PR target/38736 */ /* PR target/38736 */
/* { dg-skip-if "attribute ((aligned))" { ! { i?86-*-* x86_64-*-* } } } */ /* { dg-skip-if "attribute ((aligned))" { ! { i?86-*-* x86_64-*-* } } } */
/* { dg-require-effective-target avx } */ /* { dg-require-effective-target avx_runtime } */
/* Test compatibility of attribute ((aligned)) with and without -mavx. */ /* Test compatibility of attribute ((aligned)) with and without -mavx. */
......
/* { dg-skip-if "test SSE2 support" { ! { i?86-*-* x86_64-*-* } } } */ /* { dg-skip-if "test SSE2 support" { ! { i?86-*-* x86_64-*-* } } } */
/* { dg-options "-O" } */ /* { dg-options "-O" } */
/* { dg-require-effective-target sse2 } */
/* { dg-require-effective-target sse2_runtime } */ /* { dg-require-effective-target sse2_runtime } */
/* Test function argument passing. PR target/15301. */ /* Test function argument passing. PR target/15301. */
......
/* { dg-skip-if "test SSE2 vector" { ! { i?86-*-* x86_64-*-* } } } */ /* { dg-skip-if "test SSE2 vector" { ! { i?86-*-* x86_64-*-* } } } */
/* { dg-require-effective-target sse2 } */
/* { dg-require-effective-target sse2_runtime } */ /* { dg-require-effective-target sse2_runtime } */
/* Test compatibility of vector types: layout between separately-compiled /* Test compatibility of vector types: layout between separately-compiled
......
/* { dg-skip-if "test AVX vector" { ! { i?86-*-* x86_64-*-* } } } */ /* { dg-skip-if "test AVX vector" { ! { i?86-*-* x86_64-*-* } } } */
/* { dg-require-effective-target avx } */ /* { dg-require-effective-target avx_runtime } */
/* Test compatibility of vector types: layout between separately-compiled /* Test compatibility of vector types: layout between separately-compiled
modules, parameter passing, and function return. This test uses modules, parameter passing, and function return. This test uses
vectors of integer values. */ vectors of integer values. */
#include "cpuid.h"
extern void vector_1_x (void); extern void vector_1_x (void);
extern void exit (int); extern void exit (int);
int fails; int fails;
...@@ -14,14 +12,6 @@ int fails; ...@@ -14,14 +12,6 @@ int fails;
int int
main () main ()
{ {
unsigned int eax, ebx, ecx, edx; vector_1_x ();
if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
return 0;
/* Run AVX vector test only if host has AVX support. */
if (ecx & bit_AVX)
vector_1_x ();
exit (0); exit (0);
} }
/* { dg-skip-if "test SSE2 support" { ! { i?86-*-* x86_64-*-* } } } */ /* { dg-skip-if "test SSE2 support" { ! { i?86-*-* x86_64-*-* } } } */
/* { dg-require-effective-target sse2 } */
/* { dg-require-effective-target sse2_runtime } */ /* { dg-require-effective-target sse2_runtime } */
/* Test compatibility of vector types: layout between separately-compiled /* Test compatibility of vector types: layout between separately-compiled
......
/* { dg-skip-if "test AVX support" { ! { i?86-*-* x86_64-*-* } } } */ /* { dg-skip-if "test AVX support" { ! { i?86-*-* x86_64-*-* } } } */
/* { dg-require-effective-target avx } */ /* { dg-require-effective-target avx_runtime } */
/* Test compatibility of vector types: layout between separately-compiled /* Test compatibility of vector types: layout between separately-compiled
modules, parameter passing, and function return. This test uses modules, parameter passing, and function return. This test uses
vectors of floating points values. */ vectors of floating points values. */
#include "cpuid.h"
extern void vector_2_x (void); extern void vector_2_x (void);
extern void exit (int); extern void exit (int);
int fails; int fails;
...@@ -14,14 +12,6 @@ int fails; ...@@ -14,14 +12,6 @@ int fails;
int int
main () main ()
{ {
unsigned int eax, ebx, ecx, edx; vector_2_x ();
if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
return 0;
/* Run AVX vector test only if host has AVX support. */
if (ecx & bit_AVX)
vector_2_x ();
exit (0); exit (0);
} }
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fprefetch-loop-arrays -w" } */ /* { dg-options "-O2 -fprefetch-loop-arrays -w" } */
/* { dg-options "-O2 -fprefetch-loop-arrays -march=i686 -msse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ /* { dg-options "-O2 -fprefetch-loop-arrays -march=i686 -msse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-require-effective-target sse { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
void foo (void) void foo (void)
{ {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-options "-O2 -msse2" { target { i?86-*-* x86_64-*-* } } } */ /* { dg-options "-O2 -msse2" { target { i?86-*-* x86_64-*-* } } } */
/* { dg-require-effective-target sse2 { target { i?86-*-* x86_64-*-* } } } */
/* { dg-options "-O2 -maltivec" { target { powerpc*-*-linux* && powerpc_altivec_ok } } } */ /* { dg-options "-O2 -maltivec" { target { powerpc*-*-linux* && powerpc_altivec_ok } } } */
typedef unsigned __attribute__ ((__mode__ (__pointer__))) uintptr_t; typedef unsigned __attribute__ ((__mode__ (__pointer__))) uintptr_t;
......
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -lm" } */ /* { dg-options "-O2 -lm" } */
/* { dg-options "-O2 -msse2 -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ /* { dg-options "-O2 -msse2 -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-require-effective-target sse2 { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-require-effective-target sse2_runtime { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ /* { dg-require-effective-target sse2_runtime { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
extern double fabs (double); extern double fabs (double);
......
/* { dg-do compile { target x86_64-*-* i?86-*-* } } */ /* { dg-do compile { target x86_64-*-* i?86-*-* } } */
/* { dg-options "-std=c99 -msse2" } */ /* { dg-options "-std=c99 -msse2" } */
/* { dg-require-effective-target sse2 } */
typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__)); typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
__m64 _mm_add_si64 (__m64 __m1, __m64 __m2) __m64 _mm_add_si64 (__m64 __m1, __m64 __m2)
......
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-options "-O2 -msse2 -mtune=core2 -mfpmath=387" { target { i?86-*-* x86_64-*-* } } } */ /* { dg-options "-O2 -msse2 -mtune=core2 -mfpmath=387" { target { i?86-*-* x86_64-*-* } } } */
/* { dg-require-effective-target sse2 { target { i?86-*-* x86_64-*-* } } } */
/* { dg-require-effective-target sse2_runtime { target { i?86-*-* x86_64-*-* } } } */ /* { dg-require-effective-target sse2_runtime { target { i?86-*-* x86_64-*-* } } } */
extern void abort (void); extern void abort (void);
......
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-msse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ /* { dg-options "-msse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-require-effective-target sse { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-require-effective-target sse_runtime { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ /* { dg-require-effective-target sse_runtime { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
typedef float v2sf __attribute__ ((vector_size (2 * sizeof(float)))); typedef float v2sf __attribute__ ((vector_size (2 * sizeof(float))));
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fprefetch-loop-arrays -w" } */ /* { dg-options "-O2 -fprefetch-loop-arrays -w" } */
/* { dg-options "-O2 -fprefetch-loop-arrays -march=i686 -msse -w" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ /* { dg-options "-O2 -fprefetch-loop-arrays -march=i686 -msse -w" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-require-effective-target sse { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
__extension__ typedef __SIZE_TYPE__ size_t; __extension__ typedef __SIZE_TYPE__ size_t;
......
/* PR rtl-optimization/16104 */ /* PR rtl-optimization/16104 */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */ /* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-msse2" } */ /* { dg-options "-msse2" } */
/* { dg-require-effective-target sse2 } */
/* { dg-require-effective-target sse2_runtime } */ /* { dg-require-effective-target sse2_runtime } */
extern void abort (void); extern void abort (void);
......
/* { dg-do run { target i?86-*-* x86_64-*-* } } */ /* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-msse2" } */ /* { dg-options "-msse2" } */
/* { dg-require-effective-target sse2 } */
/* { dg-require-effective-target sse2_runtime } */ /* { dg-require-effective-target sse2_runtime } */
typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
......
/* { dg-do run { target i?86-*-* x86_64-*-* } } */ /* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-msse2" } */ /* { dg-options "-msse2" } */
/* { dg-require-effective-target sse2 } */
/* { dg-require-effective-target sse2_runtime } */ /* { dg-require-effective-target sse2_runtime } */
typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__)); typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__));
......
/* { dg-do run { target i?86-*-* x86_64-*-* } } */ /* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-msse2" } */ /* { dg-options "-msse2" } */
/* { dg-require-effective-target sse2 } */
/* { dg-require-effective-target sse2_runtime } */ /* { dg-require-effective-target sse2_runtime } */
typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__)); typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
......
/* PR middle-end/37009 */ /* PR middle-end/37009 */
/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-options "-msse2" } */ /* { dg-options "-msse2" } */
/* { dg-require-effective-target sse2 } */
/* { dg-require-effective-target sse2_runtime } */ /* { dg-require-effective-target sse2_runtime } */
#include <emmintrin.h> #include <emmintrin.h>
......
/* PR middle-end/37009 */ /* PR middle-end/37009 */
/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-options "-msse2" } */ /* { dg-options "-msse2" } */
/* { dg-require-effective-target sse2 } */
/* { dg-require-effective-target sse2_runtime } */ /* { dg-require-effective-target sse2_runtime } */
#include <emmintrin.h> #include <emmintrin.h>
......
/* PR middle-end/37010 */ /* PR middle-end/37010 */
/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-options "-msse2 -mpreferred-stack-boundary=2" } */ /* { dg-options "-msse2 -mpreferred-stack-boundary=2" } */
/* { dg-require-effective-target sse2 } */
/* { dg-require-effective-target sse2_runtime } */ /* { dg-require-effective-target sse2_runtime } */
#include <emmintrin.h> #include <emmintrin.h>
......
/* PR middle-end/37009 */ /* PR middle-end/37009 */
/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-options "-msse2" } */ /* { dg-options "-msse2" } */
/* { dg-require-effective-target sse2 } */
/* { dg-require-effective-target sse2_runtime } */ /* { dg-require-effective-target sse2_runtime } */
#include <stdarg.h> #include <stdarg.h>
......
...@@ -67,11 +67,8 @@ if [istarget "powerpc-*paired*"] { ...@@ -67,11 +67,8 @@ if [istarget "powerpc-*paired*"] {
} elseif { [istarget "spu-*-*"] } { } elseif { [istarget "spu-*-*"] } {
set dg-do-what-default run set dg-do-what-default run
} elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } { } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
if { ![check_effective_target_sse2] } then {
return
}
lappend DEFAULT_VECTCFLAGS "-msse2" lappend DEFAULT_VECTCFLAGS "-msse2"
if { [check_sse2_hw_available] && [check_sse_os_support_available] } { if { [check_effective_target_sse2_runtime] } {
set dg-do-what-default run set dg-do-what-default run
} else { } else {
set dg-do-what-default compile set dg-do-what-default compile
......
...@@ -20,7 +20,7 @@ main () ...@@ -20,7 +20,7 @@ main ()
return 0; return 0;
/* Run AVX test only if host has AVX support. */ /* Run AVX test only if host has AVX support. */
if (ecx & bit_AVX) if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE))
{ {
do_test (); do_test ();
#ifdef DEBUG #ifdef DEBUG
......
! { dg-do compile { target i?86-*-* x86_64-*-* } } ! { dg-do compile { target i?86-*-* x86_64-*-* } }
! { dg-require-effective-target ilp32 } ! { dg-require-effective-target ilp32 }
! { dg-options "-O -msse -mfpmath=sse" } ! { dg-options "-O -msse -mfpmath=sse" }
! { dg-require-effective-target sse }
subroutine yhalf(z) subroutine yhalf(z)
complex cdexpj,z complex cdexpj,z
z=cdexpj((0.d0,1.d0)*z) z=cdexpj((0.d0,1.d0)*z)
......
! { dg-do compile { target i?86-*-* x86_64-*-* } } ! { dg-do compile { target i?86-*-* x86_64-*-* } }
! { dg-require-effective-target ilp32 } ! { dg-require-effective-target ilp32 }
! { dg-options "-O2 -msse -ftree-vectorize" } ! { dg-options "-O2 -msse -ftree-vectorize" }
! { dg-require-effective-target sse }
subroutine cblank_cvb(a,ndim) subroutine cblank_cvb(a,ndim)
character*(*) a character*(*) a
character*1 blank character*1 blank
......
...@@ -68,11 +68,8 @@ if [istarget "powerpc-*paired*"] { ...@@ -68,11 +68,8 @@ if [istarget "powerpc-*paired*"] {
} elseif { [istarget "spu-*-*"] } { } elseif { [istarget "spu-*-*"] } {
set dg-do-what-default run set dg-do-what-default run
} elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } { } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
if { ![check_effective_target_sse2] } then {
return
}
lappend DEFAULT_VECTCFLAGS "-msse2" lappend DEFAULT_VECTCFLAGS "-msse2"
if { [check_sse2_hw_available] && [check_sse_os_support_available] } { if { [check_effective_target_sse2_runtime] } {
set dg-do-what-default run set dg-do-what-default run
} else { } else {
set dg-do-what-default compile set dg-do-what-default compile
......
...@@ -953,7 +953,7 @@ proc check_sse_hw_available { } { ...@@ -953,7 +953,7 @@ proc check_sse_hw_available { } {
#include "cpuid.h" #include "cpuid.h"
int main () int main ()
{ {
unsigned int eax, ebx, ecx, edx = 0; unsigned int eax, ebx, ecx, edx;
if (__get_cpuid (1, &eax, &ebx, &ecx, &edx)) if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
return !(edx & bit_SSE); return !(edx & bit_SSE);
return 1; return 1;
...@@ -976,7 +976,7 @@ proc check_sse2_hw_available { } { ...@@ -976,7 +976,7 @@ proc check_sse2_hw_available { } {
#include "cpuid.h" #include "cpuid.h"
int main () int main ()
{ {
unsigned int eax, ebx, ecx, edx = 0; unsigned int eax, ebx, ecx, edx;
if (__get_cpuid (1, &eax, &ebx, &ecx, &edx)) if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
return !(edx & bit_SSE2); return !(edx & bit_SSE2);
return 1; return 1;
...@@ -986,24 +986,60 @@ proc check_sse2_hw_available { } { ...@@ -986,24 +986,60 @@ proc check_sse2_hw_available { } {
}] }]
} }
# Return 1 if the target supports executing AVX instructions, 0
# otherwise. Cache the result.
proc check_avx_hw_available { } {
return [check_cached_effective_target avx_hw_available {
# If this is not the right target then we can skip the test.
if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
expr 0
} else {
check_runtime_nocache avx_hw_available {
#include "cpuid.h"
int main ()
{
unsigned int eax, ebx, ecx, edx;
if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
return ((ecx & (bit_AVX | bit_OSXSAVE))
!= (bit_AVX | bit_OSXSAVE));
return 1;
}
} ""
}
}]
}
# Return 1 if the target supports running SSE executables, 0 otherwise. # Return 1 if the target supports running SSE executables, 0 otherwise.
proc check_effective_target_sse_runtime { } { proc check_effective_target_sse_runtime { } {
if { [check_sse_hw_available] && [check_sse_os_support_available] } { if { [check_effective_target_sse]
&& [check_sse_hw_available]
&& [check_sse_os_support_available] } {
return 1 return 1
} else {
return 0
} }
return 0
} }
# Return 1 if the target supports running SSE2 executables, 0 otherwise. # Return 1 if the target supports running SSE2 executables, 0 otherwise.
proc check_effective_target_sse2_runtime { } { proc check_effective_target_sse2_runtime { } {
if { [check_sse2_hw_available] && [check_sse_os_support_available] } { if { [check_effective_target_sse2]
&& [check_sse2_hw_available]
&& [check_sse_os_support_available] } {
return 1 return 1
} else {
return 0
} }
return 0
}
# Return 1 if the target supports running AVX executables, 0 otherwise.
proc check_effective_target_avx_runtime { } {
if { [check_effective_target_avx]
&& [check_avx_hw_available] } {
return 1
}
return 0
} }
# Return 1 if the target supports executing VSX instructions, 0 # Return 1 if the target supports executing VSX instructions, 0
......
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