diff options
author | Uros Bizjak <uros@gcc.gnu.org> | 2007-09-05 19:43:01 +0200 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2007-09-05 19:43:01 +0200 |
commit | b3172cabd267a6e6dd535c565cb7be297907f9e8 (patch) | |
tree | 16b3a7f9f7833da2cad7c43376d098af0e2601ca /libgomp/testsuite | |
parent | 57df7359df5ff4a87858e0da6da703ec7a6624eb (diff) | |
download | gcc-b3172cabd267a6e6dd535c565cb7be297907f9e8.zip gcc-b3172cabd267a6e6dd535c565cb7be297907f9e8.tar.gz gcc-b3172cabd267a6e6dd535c565cb7be297907f9e8.tar.bz2 |
cpuid.h: New file.
* gcc/config/i386/cpuid.h: New file.
* gcc/config/i386/driver-i386.c: Include cpuid.h.
(describe_cache): Shrink size and line strings to 100 bytes.
(detect_caches_amd): Return "" for unsupported max_ext_level.
Use __cpuid function.
(detect_caches_intel): Return "" for unsupported max_level.
Use __cpuid function.
(host_detect_local_cpu): Change feature flag variables to
unsigned int. Initialize only extended feature flag variables.
Use __get_cpuid_max to determine max supported cpuid level.
Use __cpuid function to determine supported features. Fix
calculation of family id. Remove is_amd and check signature
directly. Check for Geode signature. Handle family 4 id.
[PROCESSOR_GENERIC32]: New default for unknown family id. Move
cpu discovery code to other part of the function.
[PROCESSOR_PENTIUM, PROCESSOR_K6, PROCESSOR_ATHLON]: Do not tune
for sub-architecture.
[PROCESSOR_PENTIUMPRO]: Simplify cpu discovery code.
[PROCESSOR_K8]: Add k8-sse3 architecture.
[PROCESSOR_GENERIC64]: Remove.
* gcc/config/i386/x-i386 (driver-i386.o): Depend on cpuid.h.
* gcc/config/i386/crtfastmath.c: Include cpuid.h. Use __get_cpuid
to check for SSE and FXSAVE support.
* gcc/config/i386/t-crtfm (crtfastmath.o): Depend on cpuid.h.
Add -minline-all-stringops.
* gcc/config.gcc (i[34567]86-*-*): Add cpuid.h to extra_headers.
(x86_64-*-*): Ditto.
testsuite/ChangeLog:
* gcc.dg/i386-cpuid.h: Remove.
* gcc.target/i386/mmx-check.h: Include cpuid.h. Use __get_cpuid.
* gcc.target/i386/sse-check.h: Ditto.
* gcc.target/i386/sse2-check.h: Ditto.
* gcc.target/i386/sse3-check.h: Ditto.
* gcc.target/i386/ssse3-check.h: Ditto.
* gcc.target/i386/sse4_1-check.h: Ditto.
* gcc.target/i386/sse4_2-check.h: Ditto.
* gcc.target/i386/sse4a-check.h: Ditto.
* gcc.dg/torture/pr16104-1.c: Ditto.
* gcc.target/i386/mmx-4.c: Do not use NOINLINE.
* gcc.target/i386/sse-6.c: Ditto.
* gcc.target/i386/sse-7.c: Ditto.
* g++.dg/other/i386-1.C: Include cpuid.h.
(main): New function. Use __get_cpuid to check target fetaures.
libgomp/ChangeLog:
* testsuite/libgomp.c/atomic-1.c: Include cpuid.h for i386 targets.
(main): Use __get_cpuid to get i386 target fetaures.
* testsuite/libgomp.c/atomic-2.c: Include cpuid.h for x86_64 targets.
(main): Use __get_cpuid to get x86_64 target fetaures.
From-SVN: r128141
Diffstat (limited to 'libgomp/testsuite')
-rw-r--r-- | libgomp/testsuite/libgomp.c/atomic-1.c | 10 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/atomic-2.c | 15 |
2 files changed, 15 insertions, 10 deletions
diff --git a/libgomp/testsuite/libgomp.c/atomic-1.c b/libgomp/testsuite/libgomp.c/atomic-1.c index dfbcf85..b2be8f0 100644 --- a/libgomp/testsuite/libgomp.c/atomic-1.c +++ b/libgomp/testsuite/libgomp.c/atomic-1.c @@ -2,8 +2,7 @@ /* { dg-options "-O2 -march=pentium" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ #ifdef __i386__ -#include "../../../gcc/testsuite/gcc.dg/i386-cpuid.h" -#define bit_CX8 (1 << 8) +#include "cpuid.h" #endif extern void abort (void); @@ -41,11 +40,12 @@ int main (void) { #ifdef __i386__ - unsigned long cpu_facilities; + unsigned int eax, ebx, ecx, edx; - cpu_facilities = i386_cpuid (); + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; - if (!(cpu_facilities & bit_CX8)) + if (!(edx & bit_CMPXCHG8B)) return 0; #endif diff --git a/libgomp/testsuite/libgomp.c/atomic-2.c b/libgomp/testsuite/libgomp.c/atomic-2.c index 50529eb..c877948 100644 --- a/libgomp/testsuite/libgomp.c/atomic-2.c +++ b/libgomp/testsuite/libgomp.c/atomic-2.c @@ -1,6 +1,10 @@ /* { dg-do run } */ /* { dg-options "-O2 -mcx16" { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ +#ifdef __x86_64__ +#include "cpuid.h" +#endif + double d = 1.5; long double ld = 3; extern void abort (void); @@ -20,11 +24,12 @@ int main (void) { #ifdef __x86_64__ -# define bit_CX16 (1 << 13) - unsigned int ax, bx, cx, dx; - __asm__ ("cpuid" : "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) - : "0" (1) : "cc"); - if (!(cx & bit_CX16)) + unsigned int eax, ebx, ecx, edx; + + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; + + if (!(ecx & bit_CMPXCHG16B)) return 0; #endif test (); |