diff options
author | Ulrich Drepper <drepper@redhat.com> | 2009-07-29 15:22:28 -0700 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2009-07-29 15:22:28 -0700 |
commit | 9a1d2d455540ff99a586da5b550cc768f4f6fd5c (patch) | |
tree | 5a9409c3d0227294ddb39952a051de737839a959 /sysdeps/x86_64/multiarch/init-arch.h | |
parent | 586fa886ad1473759cddf897691fd3c63a6d2360 (diff) | |
download | glibc-9a1d2d455540ff99a586da5b550cc768f4f6fd5c.tar.gz glibc-9a1d2d455540ff99a586da5b550cc768f4f6fd5c.tar.xz glibc-9a1d2d455540ff99a586da5b550cc768f4f6fd5c.zip |
Prepare use if IFUNC functions outside libc.so.
We use a callback function into libc.so to get access to the data structure with the information and have special versions of the test macros which automatically use this function.
Diffstat (limited to 'sysdeps/x86_64/multiarch/init-arch.h')
-rw-r--r-- | sysdeps/x86_64/multiarch/init-arch.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h index 48a2127418..0151e8b95b 100644 --- a/sysdeps/x86_64/multiarch/init-arch.h +++ b/sysdeps/x86_64/multiarch/init-arch.h @@ -54,10 +54,28 @@ extern void __init_cpu_features (void) attribute_hidden; __init_cpu_features (); \ while (0) +/* Used from outside libc.so to get access to the CPU features structure. */ +extern const struct cpu_features *__get_cpu_features (void) + __attribute__ ((const)); + /* Following are the feature tests used throughout libc. */ -#define HAS_POPCOUNT \ +#ifndef NOT_IN_libc +# define HAS_POPCOUNT \ ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 23)) != 0) -#define HAS_SSE4_2 \ +# 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_POPCOUNT \ + ((__get_cpu_features ()->cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 23)) != 0) + +# define HAS_SSE4_2 \ + ((__get_cpu_features ()->cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 20)) != 0) + +# define HAS_FMA \ + ((__get_cpu_features ()->cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 12)) != 0) +#endif |