backport: target-supports.exp (check_avx_hw_available): New procedure.
Backport from mainline: 2010-07-23 Uros Bizjak <ubizjak@gmail.com> * lib/target-supports.exp (check_avx_hw_available): New procedure. (check_effective_target_avx_runtime): New procedure. * gcc.dg/compat/vector-1b_main.c: Use avx_runtime effective target. 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. From-SVN: r169887
This commit is contained in:
parent
4daf27c02d
commit
d2f64ff500
|
@ -1,3 +1,17 @@
|
|||
2011-02-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||
|
||||
Backport from mainline:
|
||||
2010-07-23 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
* lib/target-supports.exp (check_avx_hw_available): New procedure.
|
||||
(check_effective_target_avx_runtime): New procedure.
|
||||
|
||||
* gcc.dg/compat/vector-1b_main.c: Use avx_runtime effective target.
|
||||
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.
|
||||
|
||||
2011-02-03 Jonathan Wakely <jwakely.gcc@gmail.com>
|
||||
|
||||
PR c++/47589
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
/* { 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
|
||||
modules, parameter passing, and function return. This test uses
|
||||
vectors of integer values. */
|
||||
|
||||
#include "cpuid.h"
|
||||
|
||||
extern void vector_1_x (void);
|
||||
extern void exit (int);
|
||||
int fails;
|
||||
|
@ -14,14 +12,6 @@ int fails;
|
|||
int
|
||||
main ()
|
||||
{
|
||||
unsigned int eax, ebx, ecx, edx;
|
||||
|
||||
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 ();
|
||||
|
||||
vector_1_x ();
|
||||
exit (0);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
/* { 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
|
||||
modules, parameter passing, and function return. This test uses
|
||||
vectors of floating points values. */
|
||||
|
||||
#include "cpuid.h"
|
||||
|
||||
extern void vector_2_x (void);
|
||||
extern void exit (int);
|
||||
int fails;
|
||||
|
@ -14,14 +12,6 @@ int fails;
|
|||
int
|
||||
main ()
|
||||
{
|
||||
unsigned int eax, ebx, ecx, edx;
|
||||
|
||||
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 ();
|
||||
|
||||
vector_2_x ();
|
||||
exit (0);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ main ()
|
|||
return 0;
|
||||
|
||||
/* Run AVX test only if host has AVX support. */
|
||||
if (ecx & bit_AVX)
|
||||
if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE))
|
||||
{
|
||||
avx_test ();
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright (C) 1999, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
# 2011 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -926,6 +926,30 @@ 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.
|
||||
|
||||
proc check_effective_target_sse_runtime { } {
|
||||
|
@ -946,6 +970,16 @@ proc check_effective_target_sse2_runtime { } {
|
|||
}
|
||||
}
|
||||
|
||||
# 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 AltiVec instructions, 0
|
||||
# otherwise. Cache the result.
|
||||
|
||||
|
|
Loading…
Reference in New Issue