diff options
author | Roland McGrath <roland@redhat.com> | 2009-10-06 19:59:03 -0700 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 2009-10-06 19:59:03 -0700 |
commit | 9d6982d5d2520fa714ad5de6a9a178fdd8ece92d (patch) | |
tree | a7b689204a4e64e764456dd55efe42fa165ca92d /sysdeps | |
parent | 930799d555e9534cf78f57fa88642a4a43d278f4 (diff) | |
download | glibc-9d6982d5d2520fa714ad5de6a9a178fdd8ece92d.tar glibc-9d6982d5d2520fa714ad5de6a9a178fdd8ece92d.tar.gz glibc-9d6982d5d2520fa714ad5de6a9a178fdd8ece92d.tar.bz2 glibc-9d6982d5d2520fa714ad5de6a9a178fdd8ece92d.zip |
Clean up x86 multiarch HAS_FOO macros.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/x86_64/multiarch/init-arch.c | 1 | ||||
-rw-r--r-- | sysdeps/x86_64/multiarch/init-arch.h | 32 |
2 files changed, 10 insertions, 23 deletions
diff --git a/sysdeps/x86_64/multiarch/init-arch.c b/sysdeps/x86_64/multiarch/init-arch.c index 9a1e776c9a..7823aceb9b 100644 --- a/sysdeps/x86_64/multiarch/init-arch.c +++ b/sysdeps/x86_64/multiarch/init-arch.c @@ -77,6 +77,7 @@ __init_cpu_features (void) __cpu_features.kind = arch_kind_other; } +#undef __get_cpu_features const struct cpu_features * __get_cpu_features (void) diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h index 8d9b1e8d8c..9b12831a6e 100644 --- a/sysdeps/x86_64/multiarch/init-arch.h +++ b/sysdeps/x86_64/multiarch/init-arch.h @@ -58,30 +58,16 @@ extern void __init_cpu_features (void) attribute_hidden; extern const struct cpu_features *__get_cpu_features (void) __attribute__ ((const)); -/* Following are the feature tests used throughout libc. */ - #ifndef NOT_IN_libc -# define HAS_SSE2 \ - ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].edx & (1 << 26)) != 0) - -# define HAS_POPCOUNT \ - ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 23)) != 0) - -# define HAS_SSE4_2 \ - ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 20)) != 0) - -# define HAS_FMA \ - ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 12)) != 0) -#else -# define HAS_SSE2 \ - ((__get_cpu_features ()->cpuid[COMMON_CPUID_INDEX_1].edx & (1 << 26)) != 0) +# define __get_cpu_features() (&__cpu_features) +#endif -# define HAS_POPCOUNT \ - ((__get_cpu_features ()->cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 23)) != 0) +#define HAS_CPU_FEATURE(idx, reg, bit) \ + ((__get_cpu_features ()->cpuid[idx].reg & (1 << (bit))) != 0) -# define HAS_SSE4_2 \ - ((__get_cpu_features ()->cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 20)) != 0) +/* Following are the feature tests used throughout libc. */ -# define HAS_FMA \ - ((__get_cpu_features ()->cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 12)) != 0) -#endif +#define HAS_SSE2 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, edx, 26) +#define HAS_POPCOUNT HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 23) +#define HAS_SSE4_2 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 20) +#define HAS_FMA HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 12) |