olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-rh1292018-2.patch

ce426f
We keep with the idea behind this patch but adjust all of the changes
ce426f
to match the existing impelementations in RHEL 7.3.
ce426f
ce426f
commit 0b5395f052ee09cd7e3d219af4e805c38058afb5
ce426f
Author: H.J. Lu <hjl.tools@gmail.com>
ce426f
Date:   Thu Aug 13 03:38:47 2015 -0700
ce426f
ce426f
    Update x86_64 multiarch functions for <cpu-features.h>
ce426f
    
ce426f
    This patch updates x86_64 multiarch functions to use the newly defined
ce426f
    HAS_CPU_FEATURE, HAS_ARCH_FEATURE and LOAD_RTLD_GLOBAL_RO_RDX from
ce426f
    <cpu-features.h>.
ce426f
    
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/e_asin.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/e_asin.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/e_asin.c
ce426f
@@ -8,11 +8,15 @@ extern double __ieee754_acos_fma4 (doubl
ce426f
 extern double __ieee754_asin_fma4 (double);
ce426f
 
ce426f
 libm_ifunc (__ieee754_acos,
ce426f
-	    HAS_FMA4 ? __ieee754_acos_fma4 : __ieee754_acos_sse2);
ce426f
+	    HAS_ARCH_FEATURE (FMA4_Usable)
ce426f
+	    ? __ieee754_acos_fma4
ce426f
+	    : __ieee754_acos_sse2);
ce426f
 strong_alias (__ieee754_acos, __acos_finite)
ce426f
 
ce426f
 libm_ifunc (__ieee754_asin,
ce426f
-	    HAS_FMA4 ? __ieee754_asin_fma4 : __ieee754_asin_sse2);
ce426f
+	    HAS_ARCH_FEATURE (FMA4_Usable)
ce426f
+	    ? __ieee754_asin_fma4
ce426f
+	    : __ieee754_asin_sse2);
ce426f
 strong_alias (__ieee754_asin, __asin_finite)
ce426f
 
ce426f
 # define __ieee754_acos __ieee754_acos_sse2
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/e_atan2.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/e_atan2.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/e_atan2.c
ce426f
@@ -7,14 +7,15 @@ extern double __ieee754_atan2_avx (doubl
ce426f
 # ifdef HAVE_FMA4_SUPPORT
ce426f
 extern double __ieee754_atan2_fma4 (double, double);
ce426f
 # else
ce426f
-#  undef HAS_FMA4
ce426f
-#  define HAS_FMA4 0
ce426f
+#  undef HAS_ARCH_FEATURE
ce426f
+#  define HAS_ARCH_FEATURE(feature) 0
ce426f
 #  define __ieee754_atan2_fma4 ((void *) 0)
ce426f
 # endif
ce426f
 
ce426f
 libm_ifunc (__ieee754_atan2,
ce426f
-	    HAS_FMA4 ? __ieee754_atan2_fma4
ce426f
-	    : (HAS_AVX ? __ieee754_atan2_avx : __ieee754_atan2_sse2));
ce426f
+	    HAS_ARCH_FEATURE (FMA4_Usable) ? __ieee754_atan2_fma4
ce426f
+	    : (HAS_ARCH_FEATURE (AVX_Usable)
ce426f
+	       ? __ieee754_atan2_avx : __ieee754_atan2_sse2));
ce426f
 strong_alias (__ieee754_atan2, __atan2_finite)
ce426f
 
ce426f
 # define __ieee754_atan2 __ieee754_atan2_sse2
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/e_exp.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/e_exp.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/e_exp.c
ce426f
@@ -7,14 +7,15 @@ extern double __ieee754_exp_avx (double)
ce426f
 # ifdef HAVE_FMA4_SUPPORT
ce426f
 extern double __ieee754_exp_fma4 (double);
ce426f
 # else
ce426f
-#  undef HAS_FMA4
ce426f
-#  define HAS_FMA4 0
ce426f
+#  undef HAS_ARCH_FEATURE
ce426f
+#  define HAS_ARCH_FEATURE(feature) 0
ce426f
 #  define __ieee754_exp_fma4 ((void *) 0)
ce426f
 # endif
ce426f
 
ce426f
 libm_ifunc (__ieee754_exp,
ce426f
-	    HAS_FMA4 ? __ieee754_exp_fma4
ce426f
-	    : (HAS_AVX ? __ieee754_exp_avx : __ieee754_exp_sse2));
ce426f
+	    HAS_ARCH_FEATURE (FMA4_Usable) ? __ieee754_exp_fma4
ce426f
+	    : (HAS_ARCH_FEATURE (AVX_Usable)
ce426f
+	       ? __ieee754_exp_avx : __ieee754_exp_sse2));
ce426f
 strong_alias (__ieee754_exp, __exp_finite)
ce426f
 
ce426f
 # define __ieee754_exp __ieee754_exp_sse2
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/e_log.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/e_log.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/e_log.c
ce426f
@@ -7,14 +7,15 @@ extern double __ieee754_log_avx (double)
ce426f
 # ifdef HAVE_FMA4_SUPPORT
ce426f
 extern double __ieee754_log_fma4 (double);
ce426f
 # else
ce426f
-#  undef HAS_FMA4
ce426f
-#  define HAS_FMA4 0
ce426f
+#  undef HAS_ARCH_FEATURE
ce426f
+#  define HAS_ARCH_FEATURE(feature) 0
ce426f
 #  define __ieee754_log_fma4 ((void *) 0)
ce426f
 # endif
ce426f
 
ce426f
 libm_ifunc (__ieee754_log,
ce426f
-	    HAS_FMA4 ? __ieee754_log_fma4
ce426f
-	    : (HAS_AVX ? __ieee754_log_avx : __ieee754_log_sse2));
ce426f
+	    HAS_ARCH_FEATURE (FMA4_Usable) ? __ieee754_log_fma4
ce426f
+	    : (HAS_ARCH_FEATURE (AVX_Usable)
ce426f
+	       ? __ieee754_log_avx : __ieee754_log_sse2));
ce426f
 strong_alias (__ieee754_log, __log_finite)
ce426f
 
ce426f
 # define __ieee754_log __ieee754_log_sse2
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/e_pow.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/e_pow.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/e_pow.c
ce426f
@@ -5,7 +5,10 @@
ce426f
 extern double __ieee754_pow_sse2 (double, double);
ce426f
 extern double __ieee754_pow_fma4 (double, double);
ce426f
 
ce426f
-libm_ifunc (__ieee754_pow, HAS_FMA4 ? __ieee754_pow_fma4 : __ieee754_pow_sse2);
ce426f
+libm_ifunc (__ieee754_pow,
ce426f
+	    HAS_ARCH_FEATURE (FMA4_Usable)
ce426f
+	    ? __ieee754_pow_fma4
ce426f
+	    : __ieee754_pow_sse2);
ce426f
 strong_alias (__ieee754_pow, __pow_finite)
ce426f
 
ce426f
 # define __ieee754_pow __ieee754_pow_sse2
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_atan.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/s_atan.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_atan.c
ce426f
@@ -7,13 +7,14 @@ extern double __atan_avx (double);
ce426f
 # ifdef HAVE_FMA4_SUPPORT
ce426f
 extern double __atan_fma4 (double);
ce426f
 # else
ce426f
-#  undef HAS_FMA4
ce426f
-#  define HAS_FMA4 0
ce426f
+#  undef HAS_ARCH_FEATURE
ce426f
+#  define HAS_ARCH_FEATURE(feature) 0
ce426f
 #  define __atan_fma4 ((void *) 0)
ce426f
 # endif
ce426f
 
ce426f
-libm_ifunc (atan, (HAS_FMA4 ? __atan_fma4 :
ce426f
-		   HAS_AVX ? __atan_avx : __atan_sse2));
ce426f
+libm_ifunc (atan, (HAS_ARCH_FEATURE (FMA4_Usable) ? __atan_fma4 :
ce426f
+		   HAS_ARCH_FEATURE (AVX_Usable)
ce426f
+		   ? __atan_avx : __atan_sse2));
ce426f
 
ce426f
 # define atan __atan_sse2
ce426f
 #endif
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_ceil.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/s_ceil.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_ceil.S
ce426f
@@ -22,10 +22,9 @@
ce426f
 
ce426f
 ENTRY(__ceil)
ce426f
 	.type	__ceil, @gnu_indirect_function
ce426f
-	call	__get_cpu_features@plt
ce426f
-	movq	%rax, %rdx
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
 	leaq	__ceil_sse41(%rip), %rax
ce426f
-	testl	$bit_SSE4_1, CPUID_OFFSET+index_SSE4_1(%rdx)
ce426f
+	HAS_CPU_FEATURE (SSE4_1)
ce426f
 	jnz	2f
ce426f
 	leaq	__ceil_c(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_ceilf.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/s_ceilf.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_ceilf.S
ce426f
@@ -22,10 +22,9 @@
ce426f
 
ce426f
 ENTRY(__ceilf)
ce426f
 	.type	__ceilf, @gnu_indirect_function
ce426f
-	call	__get_cpu_features@plt
ce426f
-	movq	%rax, %rdx
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
 	leaq	__ceilf_sse41(%rip), %rax
ce426f
-	testl	$bit_SSE4_1, CPUID_OFFSET+index_SSE4_1(%rdx)
ce426f
+	HAS_CPU_FEATURE (SSE4_1)
ce426f
 	jnz	2f
ce426f
 	leaq	__ceilf_c(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_floor.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/s_floor.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_floor.S
ce426f
@@ -22,10 +22,9 @@
ce426f
 
ce426f
 ENTRY(__floor)
ce426f
 	.type	__floor, @gnu_indirect_function
ce426f
-	call	__get_cpu_features@plt
ce426f
-	movq	%rax, %rdx
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
 	leaq	__floor_sse41(%rip), %rax
ce426f
-	testl	$bit_SSE4_1, CPUID_OFFSET+index_SSE4_1(%rdx)
ce426f
+	HAS_CPU_FEATURE (SSE4_1)
ce426f
 	jnz	2f
ce426f
 	leaq	__floor_c(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_floorf.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/s_floorf.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_floorf.S
ce426f
@@ -22,10 +22,10 @@
ce426f
 
ce426f
 ENTRY(__floorf)
ce426f
 	.type	__floorf, @gnu_indirect_function
ce426f
-	call	__get_cpu_features@plt
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
 	movq	%rax, %rdx
ce426f
 	leaq	__floorf_sse41(%rip), %rax
ce426f
-	testl	$bit_SSE4_1, CPUID_OFFSET+index_SSE4_1(%rdx)
ce426f
+	HAS_CPU_FEATURE (SSE4_1)
ce426f
 	jnz	2f
ce426f
 	leaq	__floorf_c(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_fma.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/s_fma.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_fma.c
ce426f
@@ -42,14 +42,15 @@ __fma_fma4 (double x, double y, double z
ce426f
   return x;
ce426f
 }
ce426f
 # else
ce426f
-#  undef HAS_FMA4
ce426f
-#  define HAS_FMA4 0
ce426f
+#  undef HAS_ARCH_FEATURE
ce426f
+#  define HAS_ARCH_FEATURE(feature) 0
ce426f
 #  define __fma_fma4 ((void *) 0)
ce426f
 # endif
ce426f
 
ce426f
 
ce426f
-libm_ifunc (__fma, HAS_FMA
ce426f
-	    ? __fma_fma3 : (HAS_FMA4 ? __fma_fma4 : __fma_sse2));
ce426f
+libm_ifunc (__fma, HAS_ARCH_FEATURE (FMA_Usable)
ce426f
+	    ? __fma_fma3 : (HAS_ARCH_FEATURE (FMA4_Usable)
ce426f
+			    ? __fma_fma4 : __fma_sse2));
ce426f
 weak_alias (__fma, fma)
ce426f
 
ce426f
 # define __fma __fma_sse2
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_fmaf.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/s_fmaf.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_fmaf.c
ce426f
@@ -41,14 +41,15 @@ __fmaf_fma4 (float x, float y, float z)
ce426f
   return x;
ce426f
 }
ce426f
 # else
ce426f
-#  undef HAS_FMA4
ce426f
-#  define HAS_FMA4 0
ce426f
+#  undef HAS_ARCH_FEATURE
ce426f
+#  define HAS_ARCH_FEATURE(feature) 0
ce426f
 #  define __fmaf_fma4 ((void *) 0)
ce426f
 # endif
ce426f
 
ce426f
 
ce426f
-libm_ifunc (__fmaf, HAS_FMA
ce426f
-	    ? __fmaf_fma3 : (HAS_FMA4 ? __fmaf_fma4 : __fmaf_sse2));
ce426f
+libm_ifunc (__fmaf, HAS_ARCH_FEATURE (FMA_Usable)
ce426f
+	    ? __fmaf_fma3 : (HAS_ARCH_FEATURE (FMA4_Usable)
ce426f
+			     ? __fmaf_fma4 : __fmaf_sse2));
ce426f
 weak_alias (__fmaf, fmaf)
ce426f
 
ce426f
 # define __fmaf __fmaf_sse2
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_nearbyint.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/s_nearbyint.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_nearbyint.S
ce426f
@@ -22,10 +22,10 @@
ce426f
 
ce426f
 ENTRY(__nearbyint)
ce426f
 	.type	__nearbyint, @gnu_indirect_function
ce426f
-	call	__get_cpu_features@plt
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
 	movq	%rax, %rdx
ce426f
 	leaq	__nearbyint_sse41(%rip), %rax
ce426f
-	testl	$bit_SSE4_1, CPUID_OFFSET+index_SSE4_1(%rdx)
ce426f
+	HAS_CPU_FEATURE (SSE4_1)
ce426f
 	jnz	2f
ce426f
 	leaq	__nearbyint_c(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_nearbyintf.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/s_nearbyintf.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_nearbyintf.S
ce426f
@@ -22,10 +22,9 @@
ce426f
 
ce426f
 ENTRY(__nearbyintf)
ce426f
 	.type	__nearbyintf, @gnu_indirect_function
ce426f
-	call	__get_cpu_features@plt
ce426f
-	movq	%rax, %rdx
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
 	leaq	__nearbyintf_sse41(%rip), %rax
ce426f
-	testl	$bit_SSE4_1, CPUID_OFFSET+index_SSE4_1(%rdx)
ce426f
+	HAS_CPU_FEATURE (SSE4_1)
ce426f
 	jnz	2f
ce426f
 	leaq	__nearbyintf_c(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_rint.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/s_rint.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_rint.S
ce426f
@@ -22,10 +22,9 @@
ce426f
 
ce426f
 ENTRY(__rint)
ce426f
 	.type	__rint, @gnu_indirect_function
ce426f
-	call	__get_cpu_features@plt
ce426f
-	movq	%rax, %rdx
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
 	leaq	__rint_sse41(%rip), %rax
ce426f
-	testl	$bit_SSE4_1, CPUID_OFFSET+index_SSE4_1(%rdx)
ce426f
+	HAS_CPU_FEATURE (SSE4_1)
ce426f
 	jnz	2f
ce426f
 	leaq	__rint_c(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_rintf.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/s_rintf.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_rintf.S
ce426f
@@ -22,10 +22,9 @@
ce426f
 
ce426f
 ENTRY(__rintf)
ce426f
 	.type	__rintf, @gnu_indirect_function
ce426f
-	call	__get_cpu_features@plt
ce426f
-	movq	%rax, %rdx
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
 	leaq	__rintf_sse41(%rip), %rax
ce426f
-	testl	$bit_SSE4_1, CPUID_OFFSET+index_SSE4_1(%rdx)
ce426f
+	HAS_CPU_FEATURE (SSE4_1)
ce426f
 	jnz	2f
ce426f
 	leaq	__rintf_c(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_sin.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/s_sin.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_sin.c
ce426f
@@ -11,18 +11,20 @@ extern double __sin_avx (double);
ce426f
 extern double __cos_fma4 (double);
ce426f
 extern double __sin_fma4 (double);
ce426f
 # else
ce426f
-#  undef HAS_FMA4
ce426f
-#  define HAS_FMA4 0
ce426f
+#  undef HAS_ARCH_FEATURE
ce426f
+#  define HAS_ARCH_FEATURE(feature) 0
ce426f
 #  define __cos_fma4 ((void *) 0)
ce426f
 #  define __sin_fma4 ((void *) 0)
ce426f
 # endif
ce426f
 
ce426f
-libm_ifunc (__cos, (HAS_FMA4 ? __cos_fma4 :
ce426f
-		    HAS_AVX ? __cos_avx : __cos_sse2));
ce426f
+libm_ifunc (__cos, (HAS_ARCH_FEATURE (FMA4_Usable) ? __cos_fma4 :
ce426f
+		    HAS_ARCH_FEATURE (AVX_Usable)
ce426f
+		    ? __cos_avx : __cos_sse2));
ce426f
 weak_alias (__cos, cos)
ce426f
 
ce426f
-libm_ifunc (__sin, (HAS_FMA4 ? __sin_fma4 :
ce426f
-		    HAS_AVX ? __sin_avx : __sin_sse2));
ce426f
+libm_ifunc (__sin, (HAS_ARCH_FEATURE (FMA4_Usable) ? __sin_fma4 :
ce426f
+		    HAS_ARCH_FEATURE (AVX_Usable)
ce426f
+		    ? __sin_avx : __sin_sse2));
ce426f
 weak_alias (__sin, sin)
ce426f
 
ce426f
 # define __cos __cos_sse2
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_tan.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/fpu/multiarch/s_tan.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/multiarch/s_tan.c
ce426f
@@ -7,13 +7,14 @@ extern double __tan_avx (double);
ce426f
 # ifdef HAVE_FMA4_SUPPORT
ce426f
 extern double __tan_fma4 (double);
ce426f
 # else
ce426f
-#  undef HAS_FMA4
ce426f
-#  define HAS_FMA4 0
ce426f
+#  undef HAS_ARCH_FEATURE
ce426f
+#  define HAS_ARCH_FEATURE(feature) 0
ce426f
 #  define __tan_fma4 ((void *) 0)
ce426f
 # endif
ce426f
 
ce426f
-libm_ifunc (tan, (HAS_FMA4 ? __tan_fma4 :
ce426f
-		  HAS_AVX ? __tan_avx : __tan_sse2));
ce426f
+libm_ifunc (tan, (HAS_ARCH_FEATURE (FMA4_Usable) ? __tan_fma4 :
ce426f
+		  HAS_ARCH_FEATURE (AVX_Usable)
ce426f
+		  ? __tan_avx : __tan_sse2));
ce426f
 
ce426f
 # define tan __tan_sse2
ce426f
 #endif
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/ifunc-impl-list.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/ifunc-impl-list.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/ifunc-impl-list.c
ce426f
@@ -39,25 +39,26 @@ __libc_ifunc_impl_list (const char *name
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/memcmp.S.  */
ce426f
   IFUNC_IMPL (i, name, memcmp,
ce426f
-	      IFUNC_IMPL_ADD (array, i, memcmp, HAS_SSE4_1,
ce426f
+	      IFUNC_IMPL_ADD (array, i, memcmp, HAS_CPU_FEATURE (SSE4_1),
ce426f
 			      __memcmp_sse4_1)
ce426f
-	      IFUNC_IMPL_ADD (array, i, memcmp, HAS_SSSE3, __memcmp_ssse3)
ce426f
+	      IFUNC_IMPL_ADD (array, i, memcmp, HAS_CPU_FEATURE (SSSE3),
ce426f
+			      __memcmp_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/memmove_chk.S.  */
ce426f
   IFUNC_IMPL (i, name, __memmove_chk,
ce426f
-	      IFUNC_IMPL_ADD (array, i, __memmove_chk, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, __memmove_chk, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __memmove_chk_ssse3_back)
ce426f
-	      IFUNC_IMPL_ADD (array, i, __memmove_chk, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, __memmove_chk, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __memmove_chk_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, __memmove_chk, 1,
ce426f
 			      __memmove_chk_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/memmove.S.  */
ce426f
   IFUNC_IMPL (i, name, memmove,
ce426f
-	      IFUNC_IMPL_ADD (array, i, memmove, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, memmove, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __memmove_ssse3_back)
ce426f
-	      IFUNC_IMPL_ADD (array, i, memmove, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, memmove, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __memmove_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_sse2))
ce426f
 
ce426f
@@ -74,13 +75,13 @@ __libc_ifunc_impl_list (const char *name
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/rawmemchr.S.  */
ce426f
   IFUNC_IMPL (i, name, rawmemchr,
ce426f
-	      IFUNC_IMPL_ADD (array, i, rawmemchr, HAS_SSE4_2,
ce426f
+	      IFUNC_IMPL_ADD (array, i, rawmemchr, HAS_CPU_FEATURE (SSE4_2),
ce426f
 			      __rawmemchr_sse42)
ce426f
 	      IFUNC_IMPL_ADD (array, i, rawmemchr, 1, __rawmemchr_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/stpncpy.S.  */
ce426f
   IFUNC_IMPL (i, name, stpncpy,
ce426f
-	      IFUNC_IMPL_ADD (array, i, stpncpy, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, stpncpy, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __stpncpy_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, stpncpy, 1,
ce426f
 			      __stpncpy_sse2_unaligned)
ce426f
@@ -88,92 +89,105 @@ __libc_ifunc_impl_list (const char *name
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/stpcpy.S.  */
ce426f
   IFUNC_IMPL (i, name, stpcpy,
ce426f
-	      IFUNC_IMPL_ADD (array, i, stpcpy, HAS_SSSE3, __stpcpy_ssse3)
ce426f
+	      IFUNC_IMPL_ADD (array, i, stpcpy, HAS_CPU_FEATURE (SSSE3),
ce426f
+			      __stpcpy_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, stpcpy, 1, __stpcpy_sse2_unaligned)
ce426f
 	      IFUNC_IMPL_ADD (array, i, stpcpy, 1, __stpcpy_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strcasecmp_l.S.  */
ce426f
   IFUNC_IMPL (i, name, strcasecmp,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strcasecmp, HAS_AVX,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strcasecmp,
ce426f
+			      HAS_ARCH_FEATURE (AVX_Usable),
ce426f
 			      __strcasecmp_avx)
ce426f
-	      IFUNC_IMPL_ADD (array, i, strcasecmp, HAS_SSE4_2,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strcasecmp,
ce426f
+			      HAS_CPU_FEATURE (SSE4_2),
ce426f
 			      __strcasecmp_sse42)
ce426f
-	      IFUNC_IMPL_ADD (array, i, strcasecmp, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strcasecmp,
ce426f
+			      HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __strcasecmp_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strcasecmp_l.S.  */
ce426f
   IFUNC_IMPL (i, name, strcasecmp_l,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strcasecmp_l, HAS_AVX,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strcasecmp_l,
ce426f
+			      HAS_ARCH_FEATURE (AVX_Usable),
ce426f
 			      __strcasecmp_l_avx)
ce426f
-	      IFUNC_IMPL_ADD (array, i, strcasecmp_l, HAS_SSE4_2,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strcasecmp_l,
ce426f
+			      HAS_CPU_FEATURE (SSE4_2),
ce426f
 			      __strcasecmp_l_sse42)
ce426f
-	      IFUNC_IMPL_ADD (array, i, strcasecmp_l, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strcasecmp_l,
ce426f
+			      HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __strcasecmp_l_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
ce426f
 			      __strcasecmp_l_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strcasestr.c.  */
ce426f
   IFUNC_IMPL (i, name, strcasestr,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strcasestr, HAS_SSE4_2,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strcasestr, HAS_CPU_FEATURE (SSE4_2),
ce426f
 			      __strcasestr_sse42)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strcasestr, 1, __strcasestr_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strcat.S.  */
ce426f
   IFUNC_IMPL (i, name, strcat,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strcat, HAS_SSSE3, __strcat_ssse3)
ce426f
+	      IFUNC_IMPL_ADD (array, i, strcat, HAS_CPU_FEATURE (SSSE3),
ce426f
+			      __strcat_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strcat, 1, __strcat_sse2_unaligned)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strcat, 1, __strcat_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strchr.S.  */
ce426f
   IFUNC_IMPL (i, name, strchr,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strchr, HAS_SSE4_2, __strchr_sse42)
ce426f
+	      IFUNC_IMPL_ADD (array, i, strchr, HAS_CPU_FEATURE (SSE4_2),
ce426f
+			      __strchr_sse42)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_sse2_no_bsf)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strcmp.S.  */
ce426f
   IFUNC_IMPL (i, name, strcmp,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strcmp, HAS_SSE4_2, __strcmp_sse42)
ce426f
-	      IFUNC_IMPL_ADD (array, i, strcmp, HAS_SSSE3, __strcmp_ssse3)
ce426f
+	      IFUNC_IMPL_ADD (array, i, strcmp, HAS_CPU_FEATURE (SSE4_2),
ce426f
+			      __strcmp_sse42)
ce426f
+	      IFUNC_IMPL_ADD (array, i, strcmp, HAS_CPU_FEATURE (SSSE3),
ce426f
+			      __strcmp_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strcmp, 1, __strcmp_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strcpy.S.  */
ce426f
   IFUNC_IMPL (i, name, strcpy,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strcpy, HAS_SSSE3, __strcpy_ssse3)
ce426f
+	      IFUNC_IMPL_ADD (array, i, strcpy, HAS_CPU_FEATURE (SSSE3),
ce426f
+			      __strcpy_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strcpy, 1, __strcpy_sse2_unaligned)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strcpy, 1, __strcpy_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strcspn.S.  */
ce426f
   IFUNC_IMPL (i, name, strcspn,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strcspn, HAS_SSE4_2,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strcspn, HAS_CPU_FEATURE (SSE4_2),
ce426f
 			      __strcspn_sse42)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strcspn, 1, __strcspn_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strncase_l.S.  */
ce426f
   IFUNC_IMPL (i, name, strncasecmp,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strncasecmp, HAS_AVX,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strncasecmp, HAS_ARCH_FEATURE (AVX_Usable),
ce426f
 			      __strncasecmp_avx)
ce426f
-	      IFUNC_IMPL_ADD (array, i, strncasecmp, HAS_SSE4_2,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strncasecmp, HAS_CPU_FEATURE (SSE4_2),
ce426f
 			      __strncasecmp_sse42)
ce426f
-	      IFUNC_IMPL_ADD (array, i, strncasecmp, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strncasecmp, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __strncasecmp_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strncasecmp, 1,
ce426f
 			      __strncasecmp_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strncase_l.S.  */
ce426f
   IFUNC_IMPL (i, name, strncasecmp_l,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strncasecmp_l, HAS_AVX,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strncasecmp_l,
ce426f
+			      HAS_ARCH_FEATURE (AVX_Usable),
ce426f
 			      __strncasecmp_l_avx)
ce426f
-	      IFUNC_IMPL_ADD (array, i, strncasecmp_l, HAS_SSE4_2,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strncasecmp_l, HAS_CPU_FEATURE (SSE4_2),
ce426f
 			      __strncasecmp_l_sse42)
ce426f
-	      IFUNC_IMPL_ADD (array, i, strncasecmp_l, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strncasecmp_l, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __strncasecmp_l_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1,
ce426f
 			      __strncasecmp_l_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strncat.S.  */
ce426f
   IFUNC_IMPL (i, name, strncat,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strncat, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strncat, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __strncat_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strncat, 1,
ce426f
 			      __strncat_sse2_unaligned)
ce426f
@@ -181,7 +195,7 @@ __libc_ifunc_impl_list (const char *name
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strncpy.S.  */
ce426f
   IFUNC_IMPL (i, name, strncpy,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strncpy, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strncpy, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __strncpy_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strncpy, 1,
ce426f
 			      __strncpy_sse2_unaligned)
ce426f
@@ -194,79 +208,83 @@ __libc_ifunc_impl_list (const char *name
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strpbrk.S.  */
ce426f
   IFUNC_IMPL (i, name, strpbrk,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strpbrk, HAS_SSE4_2,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strpbrk, HAS_CPU_FEATURE (SSE4_2),
ce426f
 			      __strpbrk_sse42)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strpbrk, 1, __strpbrk_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strrchr.S.  */
ce426f
   IFUNC_IMPL (i, name, strrchr,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strrchr, HAS_SSE4_2,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strrchr, HAS_CPU_FEATURE (SSE4_2),
ce426f
 			      __strrchr_sse42)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strrchr, 1, __strrchr_sse2_no_bsf)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strrchr, 1, __strrchr_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strspn.S.  */
ce426f
   IFUNC_IMPL (i, name, strspn,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strspn, HAS_SSE4_2, __strspn_sse42)
ce426f
+	      IFUNC_IMPL_ADD (array, i, strspn, HAS_CPU_FEATURE (SSE4_2),
ce426f
+			      __strspn_sse42)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strspn, 1, __strspn_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strstr-c.c.  */
ce426f
   IFUNC_IMPL (i, name, strstr,
ce426f
 	      IFUNC_IMPL_ADD (array, i, strstr, use_unaligned_strstr (),
ce426f
 			      __strstr_sse2_unaligned)
ce426f
-	      IFUNC_IMPL_ADD (array, i, strstr, HAS_SSE4_2, __strstr_sse42)
ce426f
+	      IFUNC_IMPL_ADD (array, i, strstr, HAS_CPU_FEATURE (SSE4_2),
ce426f
+			      __strstr_sse42)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strstr, 1, __strstr_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/wcscpy.S.  */
ce426f
   IFUNC_IMPL (i, name, wcscpy,
ce426f
-	      IFUNC_IMPL_ADD (array, i, wcscpy, HAS_SSSE3, __wcscpy_ssse3)
ce426f
+	      IFUNC_IMPL_ADD (array, i, wcscpy, HAS_CPU_FEATURE (SSSE3),
ce426f
+			      __wcscpy_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, wcscpy, 1, __wcscpy_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/wmemcmp.S.  */
ce426f
   IFUNC_IMPL (i, name, wmemcmp,
ce426f
-	      IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_SSE4_1,
ce426f
+	      IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_CPU_FEATURE (SSE4_1),
ce426f
 			      __wmemcmp_sse4_1)
ce426f
-	      IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __wmemcmp_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, wmemcmp, 1, __wmemcmp_sse2))
ce426f
 
ce426f
 #ifdef SHARED
ce426f
   /* Support sysdeps/x86_64/multiarch/memcpy_chk.S.  */
ce426f
   IFUNC_IMPL (i, name, __memcpy_chk,
ce426f
-	      IFUNC_IMPL_ADD (array, i, __memcpy_chk, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, __memcpy_chk, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __memcpy_chk_ssse3_back)
ce426f
-	      IFUNC_IMPL_ADD (array, i, __memcpy_chk, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, __memcpy_chk, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __memcpy_chk_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, __memcpy_chk, 1,
ce426f
 			      __memcpy_chk_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/memcpy.S.  */
ce426f
   IFUNC_IMPL (i, name, memcpy,
ce426f
-	      IFUNC_IMPL_ADD (array, i, memcpy, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, memcpy, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __memcpy_ssse3_back)
ce426f
-	      IFUNC_IMPL_ADD (array, i, memcpy, HAS_SSSE3, __memcpy_ssse3)
ce426f
+	      IFUNC_IMPL_ADD (array, i, memcpy, HAS_CPU_FEATURE (SSSE3), __memcpy_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/mempcpy_chk.S.  */
ce426f
   IFUNC_IMPL (i, name, __mempcpy_chk,
ce426f
-	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __mempcpy_chk_ssse3_back)
ce426f
-	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __mempcpy_chk_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk, 1,
ce426f
 			      __mempcpy_chk_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/mempcpy.S.  */
ce426f
   IFUNC_IMPL (i, name, mempcpy,
ce426f
-	      IFUNC_IMPL_ADD (array, i, mempcpy, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, mempcpy, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __mempcpy_ssse3_back)
ce426f
-	      IFUNC_IMPL_ADD (array, i, mempcpy, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, mempcpy, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __mempcpy_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, mempcpy, 1, __mempcpy_sse2))
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strlen.S.  */
ce426f
   IFUNC_IMPL (i, name, strlen,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strlen, HAS_SSE4_2, __strlen_sse42)
ce426f
+	      IFUNC_IMPL_ADD (array, i, strlen, HAS_CPU_FEATURE (SSE4_2),
ce426f
+			      __strlen_sse42)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_sse2_pminub)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_sse2_no_bsf)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_sse2)
ce426f
@@ -274,9 +292,9 @@ __libc_ifunc_impl_list (const char *name
ce426f
 
ce426f
   /* Support sysdeps/x86_64/multiarch/strncmp.S.  */
ce426f
   IFUNC_IMPL (i, name, strncmp,
ce426f
-	      IFUNC_IMPL_ADD (array, i, strncmp, HAS_SSE4_2,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strncmp, HAS_CPU_FEATURE (SSE4_2),
ce426f
 			      __strncmp_sse42)
ce426f
-	      IFUNC_IMPL_ADD (array, i, strncmp, HAS_SSSE3,
ce426f
+	      IFUNC_IMPL_ADD (array, i, strncmp, HAS_CPU_FEATURE (SSSE3),
ce426f
 			      __strncmp_ssse3)
ce426f
 	      IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_sse2))
ce426f
 #endif
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/memcmp.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/memcmp.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/memcmp.S
ce426f
@@ -26,16 +26,13 @@
ce426f
 	.text
ce426f
 ENTRY(memcmp)
ce426f
 	.type	memcmp, @gnu_indirect_function
ce426f
-	cmpl	$0, KIND_OFFSET+__cpu_features(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-
ce426f
-1:	testl	$bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	HAS_CPU_FEATURE (SSSE3)
ce426f
 	jnz	2f
ce426f
 	leaq	__memcmp_sse2(%rip), %rax
ce426f
 	ret
ce426f
 
ce426f
-2:	testl	$bit_SSE4_1, __cpu_features+CPUID_OFFSET+index_SSE4_1(%rip)
ce426f
+2:	HAS_CPU_FEATURE (SSE4_1)
ce426f
 	jz	3f
ce426f
 	leaq	__memcmp_sse4_1(%rip), %rax
ce426f
 	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/memcpy.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/memcpy.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/memcpy.S
ce426f
@@ -29,14 +29,12 @@
ce426f
 	.text
ce426f
 ENTRY(__new_memcpy)
ce426f
 	.type	__new_memcpy, @gnu_indirect_function
ce426f
-	cmpl	$0, KIND_OFFSET+__cpu_features(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	leaq	__memcpy_sse2(%rip), %rax
ce426f
-	testl	$bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	leaq	__memcpy_sse2(%rip), %rax
ce426f
+	HAS_CPU_FEATURE (SSSE3)
ce426f
 	jz	2f
ce426f
 	leaq	__memcpy_ssse3(%rip), %rax
ce426f
-	testl	$bit_Fast_Copy_Backward, __cpu_features+FEATURE_OFFSET+index_Fast_Copy_Backward(%rip)
ce426f
+	HAS_ARCH_FEATURE (Fast_Copy_Backward)
ce426f
 	jz	2f
ce426f
 	leaq	__memcpy_ssse3_back(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/memcpy_chk.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/memcpy_chk.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/memcpy_chk.S
ce426f
@@ -29,14 +29,12 @@
ce426f
 	.text
ce426f
 ENTRY(__memcpy_chk)
ce426f
 	.type	__memcpy_chk, @gnu_indirect_function
ce426f
-	cmpl	$0, KIND_OFFSET+__cpu_features(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	leaq	__memcpy_chk_sse2(%rip), %rax
ce426f
-	testl	$bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	leaq	__memcpy_chk_sse2(%rip), %rax
ce426f
+	HAS_CPU_FEATURE (SSSE3)
ce426f
 	jz	2f
ce426f
 	leaq	__memcpy_chk_ssse3(%rip), %rax
ce426f
-	testl	$bit_Fast_Copy_Backward, __cpu_features+FEATURE_OFFSET+index_Fast_Copy_Backward(%rip)
ce426f
+	HAS_ARCH_FEATURE (Fast_Copy_Backward)
ce426f
 	jz	2f
ce426f
 	leaq	__memcpy_chk_ssse3_back(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/memmove.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/memmove.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/memmove.c
ce426f
@@ -47,8 +47,8 @@ extern __typeof (__redirect_memmove) __m
ce426f
    ifunc symbol properly.  */
ce426f
 extern __typeof (__redirect_memmove) __libc_memmove;
ce426f
 libc_ifunc (__libc_memmove,
ce426f
-	    HAS_SSSE3
ce426f
-	    ? (HAS_FAST_COPY_BACKWARD
ce426f
+	    HAS_CPU_FEATURE (SSSE3)
ce426f
+	    ? (HAS_ARCH_FEATURE (Fast_Copy_Backward)
ce426f
 	       ? __memmove_ssse3_back : __memmove_ssse3)
ce426f
 	    : __memmove_sse2)
ce426f
 
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/memmove_chk.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/memmove_chk.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/memmove_chk.c
ce426f
@@ -29,7 +29,7 @@ extern __typeof (__memmove_chk) __memmov
ce426f
 #include "debug/memmove_chk.c"
ce426f
 
ce426f
 libc_ifunc (__memmove_chk,
ce426f
-	    HAS_SSSE3
ce426f
-	    ? (HAS_FAST_COPY_BACKWARD
ce426f
+	    HAS_CPU_FEATURE (SSSE3)
ce426f
+	    ? (HAS_ARCH_FEATURE (Fast_Copy_Backward)
ce426f
 	       ? __memmove_chk_ssse3_back : __memmove_chk_ssse3)
ce426f
 	    : __memmove_chk_sse2);
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/mempcpy.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/mempcpy.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/mempcpy.S
ce426f
@@ -27,14 +27,12 @@
ce426f
 #if defined SHARED && IS_IN (libc)
ce426f
 ENTRY(__mempcpy)
ce426f
 	.type	__mempcpy, @gnu_indirect_function
ce426f
-	cmpl	$0, KIND_OFFSET+__cpu_features(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	leaq	__mempcpy_sse2(%rip), %rax
ce426f
-	testl	$bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	leaq	__mempcpy_sse2(%rip), %rax
ce426f
+	HAS_CPU_FEATURE (SSSE3)
ce426f
 	jz	2f
ce426f
 	leaq	__mempcpy_ssse3(%rip), %rax
ce426f
-	testl	$bit_Fast_Copy_Backward, __cpu_features+FEATURE_OFFSET+index_Fast_Copy_Backward(%rip)
ce426f
+	HAS_ARCH_FEATURE (Fast_Copy_Backward)
ce426f
 	jz	2f
ce426f
 	leaq	__mempcpy_ssse3_back(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/mempcpy_chk.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/mempcpy_chk.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/mempcpy_chk.S
ce426f
@@ -29,14 +29,12 @@
ce426f
 	.text
ce426f
 ENTRY(__mempcpy_chk)
ce426f
 	.type	__mempcpy_chk, @gnu_indirect_function
ce426f
-	cmpl	$0, KIND_OFFSET+__cpu_features(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	leaq	__mempcpy_chk_sse2(%rip), %rax
ce426f
-	testl	$bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	leaq	__mempcpy_chk_sse2(%rip), %rax
ce426f
+	HAS_CPU_FEATURE (SSSE3)
ce426f
 	jz	2f
ce426f
 	leaq	__mempcpy_chk_ssse3(%rip), %rax
ce426f
-	testl	$bit_Fast_Copy_Backward, __cpu_features+FEATURE_OFFSET+index_Fast_Copy_Backward(%rip)
ce426f
+	HAS_ARCH_FEATURE (Fast_Copy_Backward)
ce426f
 	jz	2f
ce426f
 	leaq	__mempcpy_chk_ssse3_back(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/memset.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/memset.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/memset.S
ce426f
@@ -24,11 +24,9 @@
ce426f
 #if IS_IN (libc)
ce426f
 ENTRY(memset)
ce426f
 	.type	memset, @gnu_indirect_function
ce426f
-	cmpl	$0, __cpu_features+KIND_OFFSET(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	leaq	__memset_x86_64(%rip), %rax
ce426f
-	testl	$bit_Prefer_SSE_for_memop, __cpu_features+FEATURE_OFFSET+index_Prefer_SSE_for_memop(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	leaq	__memset_x86_64(%rip), %rax
ce426f
+	HAS_ARCH_FEATURE (Prefer_SSE_for_memop)
ce426f
 	jz	2f
ce426f
 	leaq	__memset_sse2(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/memset_chk.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/memset_chk.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/memset_chk.S
ce426f
@@ -25,11 +25,9 @@
ce426f
 # ifdef SHARED
ce426f
 ENTRY(__memset_chk)
ce426f
 	.type	__memset_chk, @gnu_indirect_function
ce426f
-	cmpl	$0, __cpu_features+KIND_OFFSET(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	leaq	__memset_chk_x86_64(%rip), %rax
ce426f
-	testl	$bit_Prefer_SSE_for_memop, __cpu_features+FEATURE_OFFSET+index_Prefer_SSE_for_memop(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	leaq	__memset_chk_x86_64(%rip), %rax
ce426f
+	HAS_ARCH_FEATURE (Prefer_SSE_for_memop)
ce426f
 	jz	2f
ce426f
 	leaq	__memset_chk_sse2(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/sched_cpucount.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/sched_cpucount.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/sched_cpucount.c
ce426f
@@ -33,4 +33,4 @@
ce426f
 #undef __sched_cpucount
ce426f
 
ce426f
 libc_ifunc (__sched_cpucount,
ce426f
-	    HAS_POPCOUNT ? popcount_cpucount : generic_cpucount);
ce426f
+	    HAS_CPU_FEATURE (POPCOUNT) ? popcount_cpucount : generic_cpucount);
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strcat.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/strcat.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strcat.S
ce426f
@@ -47,14 +47,12 @@
ce426f
 	.text
ce426f
 ENTRY(STRCAT)
ce426f
 	.type	STRCAT, @gnu_indirect_function
ce426f
-	cmpl	$0, __cpu_features+KIND_OFFSET(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	leaq	STRCAT_SSE2_UNALIGNED(%rip), %rax
ce426f
-	testl	$bit_Fast_Unaligned_Load, __cpu_features+FEATURE_OFFSET+index_Fast_Unaligned_Load(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	leaq	STRCAT_SSE2_UNALIGNED(%rip), %rax
ce426f
+	HAS_ARCH_FEATURE (Fast_Unaligned_Load)
ce426f
 	jnz	2f
ce426f
 	leaq	STRCAT_SSE2(%rip), %rax
ce426f
-	testl	$bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
ce426f
+	HAS_CPU_FEATURE (SSSE3)
ce426f
 	jz	2f
ce426f
 	leaq	STRCAT_SSSE3(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strchr.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/strchr.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strchr.S
ce426f
@@ -25,15 +25,13 @@
ce426f
 	.text
ce426f
 ENTRY(strchr)
ce426f
 	.type	strchr, @gnu_indirect_function
ce426f
-	cmpl	$0, __cpu_features+KIND_OFFSET(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	leaq	__strchr_sse2(%rip), %rax
ce426f
-	testl	$bit_SSE4_2, __cpu_features+CPUID_OFFSET+index_SSE4_2(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	leaq	__strchr_sse2(%rip), %rax
ce426f
+	HAS_CPU_FEATURE (SSE4_2)
ce426f
 	jz	2f
ce426f
 	leaq	__strchr_sse42(%rip), %rax
ce426f
 	ret
ce426f
-2:	testl	$bit_Slow_BSF, __cpu_features+FEATURE_OFFSET+index_Slow_BSF(%rip)
ce426f
+2:	HAS_ARCH_FEATURE (Slow_BSF)
ce426f
 	jz	3f
ce426f
 	leaq    __strchr_sse2_no_bsf(%rip), %rax
ce426f
 3:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strcmp.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/strcmp.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strcmp.S
ce426f
@@ -83,16 +83,12 @@
ce426f
 	.text
ce426f
 ENTRY(STRCMP)
ce426f
 	.type	STRCMP, @gnu_indirect_function
ce426f
-	/* Manually inlined call to __get_cpu_features.  */
ce426f
-	cmpl	$0, __cpu_features+KIND_OFFSET(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
 	leaq	STRCMP_SSE42(%rip), %rax
ce426f
-	testl	$bit_SSE4_2, __cpu_features+CPUID_OFFSET+index_SSE4_2(%rip)
ce426f
+	HAS_CPU_FEATURE (SSE4_2)
ce426f
 	jnz	2f
ce426f
 	leaq	STRCMP_SSSE3(%rip), %rax
ce426f
-	testl	$bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
ce426f
+	HAS_CPU_FEATURE (SSSE3)
ce426f
 	jnz	2f
ce426f
 	leaq	STRCMP_SSE2(%rip), %rax
ce426f
 2:	ret
ce426f
@@ -101,21 +97,17 @@ END(STRCMP)
ce426f
 # ifdef USE_AS_STRCASECMP_L
ce426f
 ENTRY(__strcasecmp)
ce426f
 	.type	__strcasecmp, @gnu_indirect_function
ce426f
-	/* Manually inlined call to __get_cpu_features.  */
ce426f
-	cmpl	$0, __cpu_features+KIND_OFFSET(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
 #  ifdef HAVE_AVX_SUPPORT
ce426f
 	leaq	__strcasecmp_avx(%rip), %rax
ce426f
-	testl	$bit_AVX_Usable, __cpu_features+FEATURE_OFFSET+index_AVX_Usable(%rip)
ce426f
+	HAS_ARCH_FEATURE (AVX_Usable)
ce426f
 	jnz	2f
ce426f
 #  endif
ce426f
 	leaq	__strcasecmp_sse42(%rip), %rax
ce426f
-	testl	$bit_SSE4_2, __cpu_features+CPUID_OFFSET+index_SSE4_2(%rip)
ce426f
+	HAS_CPU_FEATURE (SSE4_2)
ce426f
 	jnz	2f
ce426f
 	leaq	__strcasecmp_ssse3(%rip), %rax
ce426f
-	testl	$bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
ce426f
+	HAS_CPU_FEATURE (SSSE3)
ce426f
 	jnz	2f
ce426f
 	leaq	__strcasecmp_sse2(%rip), %rax
ce426f
 2:	ret
ce426f
@@ -125,21 +117,17 @@ weak_alias (__strcasecmp, strcasecmp)
ce426f
 # ifdef USE_AS_STRNCASECMP_L
ce426f
 ENTRY(__strncasecmp)
ce426f
 	.type	__strncasecmp, @gnu_indirect_function
ce426f
-	/* Manually inlined call to __get_cpu_features.  */
ce426f
-	cmpl	$0, __cpu_features+KIND_OFFSET(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
 #  ifdef HAVE_AVX_SUPPORT
ce426f
 	leaq	__strncasecmp_avx(%rip), %rax
ce426f
-	testl	$bit_AVX_Usable, __cpu_features+FEATURE_OFFSET+index_AVX_Usable(%rip)
ce426f
+	HAS_ARCH_FEATURE (AVX_Usable)
ce426f
 	jnz	2f
ce426f
 #  endif
ce426f
 	leaq	__strncasecmp_sse42(%rip), %rax
ce426f
-	testl	$bit_SSE4_2, __cpu_features+CPUID_OFFSET+index_SSE4_2(%rip)
ce426f
+	HAS_CPU_FEATURE (SSE4_2)
ce426f
 	jnz	2f
ce426f
 	leaq	__strncasecmp_ssse3(%rip), %rax
ce426f
-	testl	$bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
ce426f
+	HAS_CPU_FEATURE (SSSE3)
ce426f
 	jnz	2f
ce426f
 	leaq	__strncasecmp_sse2(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strcpy.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/strcpy.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strcpy.S
ce426f
@@ -61,14 +61,12 @@
ce426f
 	.text
ce426f
 ENTRY(STRCPY)
ce426f
 	.type	STRCPY, @gnu_indirect_function
ce426f
-	cmpl	$0, __cpu_features+KIND_OFFSET(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	leaq	STRCPY_SSE2_UNALIGNED(%rip), %rax
ce426f
-	testl	$bit_Fast_Unaligned_Load, __cpu_features+FEATURE_OFFSET+index_Fast_Unaligned_Load(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	leaq	STRCPY_SSE2_UNALIGNED(%rip), %rax
ce426f
+	HAS_ARCH_FEATURE (Fast_Unaligned_Load)
ce426f
 	jnz	2f
ce426f
 	leaq	STRCPY_SSE2(%rip), %rax
ce426f
-	testl	$bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
ce426f
+	HAS_CPU_FEATURE (SSSE3)
ce426f
 	jz	2f
ce426f
 	leaq	STRCPY_SSSE3(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strcspn.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/strcspn.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strcspn.S
ce426f
@@ -45,11 +45,9 @@
ce426f
 	.text
ce426f
 ENTRY(STRCSPN)
ce426f
 	.type	STRCSPN, @gnu_indirect_function
ce426f
-	cmpl	$0, __cpu_features+KIND_OFFSET(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	leaq	STRCSPN_SSE2(%rip), %rax
ce426f
-	testl	$bit_SSE4_2, __cpu_features+CPUID_OFFSET+index_SSE4_2(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	leaq	STRCSPN_SSE2(%rip), %rax
ce426f
+	HAS_CPU_FEATURE (SSE4_2)
ce426f
 	jz	2f
ce426f
 	leaq	STRCSPN_SSE42(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strspn.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/strspn.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strspn.S
ce426f
@@ -30,11 +30,9 @@
ce426f
 	.text
ce426f
 ENTRY(strspn)
ce426f
 	.type	strspn, @gnu_indirect_function
ce426f
-	cmpl	$0, __cpu_features+KIND_OFFSET(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	leaq	__strspn_sse2(%rip), %rax
ce426f
-	testl	$bit_SSE4_2, __cpu_features+CPUID_OFFSET+index_SSE4_2(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	leaq	__strspn_sse2(%rip), %rax
ce426f
+	HAS_CPU_FEATURE (SSE4_2)
ce426f
 	jz	2f
ce426f
 	leaq	__strspn_sse42(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/test-multiarch.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/test-multiarch.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/test-multiarch.c
ce426f
@@ -75,12 +75,18 @@ do_test (int argc, char **argv)
ce426f
   int fails;
ce426f
 
ce426f
   get_cpuinfo ();
ce426f
-  fails = check_proc ("avx", HAS_AVX, "HAS_AVX");
ce426f
-  fails += check_proc ("fma4", HAS_FMA4, "HAS_FMA4");
ce426f
-  fails += check_proc ("sse4_2", HAS_SSE4_2, "HAS_SSE4_2");
ce426f
-  fails += check_proc ("sse4_1", HAS_SSE4_1, "HAS_SSE4_1");
ce426f
-  fails += check_proc ("ssse3", HAS_SSSE3, "HAS_SSSE3");
ce426f
-  fails += check_proc ("popcnt", HAS_POPCOUNT, "HAS_POPCOUNT");
ce426f
+  fails = check_proc ("avx", HAS_ARCH_FEATURE (AVX_Usable),
ce426f
+		      "HAS_ARCH_FEATURE (AVX_Usable)");
ce426f
+  fails += check_proc ("fma4", HAS_ARCH_FEATURE (FMA4_Usable),
ce426f
+		       "HAS_ARCH_FEATURE (FMA4_Usable)");
ce426f
+  fails += check_proc ("sse4_2", HAS_CPU_FEATURE (SSE4_2),
ce426f
+		       "HAS_CPU_FEATURE (SSE4_2)");
ce426f
+  fails += check_proc ("sse4_1", HAS_CPU_FEATURE (SSE4_1)
ce426f
+		       , "HAS_CPU_FEATURE (SSE4_1)");
ce426f
+  fails += check_proc ("ssse3", HAS_CPU_FEATURE (SSSE3),
ce426f
+		       "HAS_CPU_FEATURE (SSSE3)");
ce426f
+  fails += check_proc ("popcnt", HAS_CPU_FEATURE (POPCOUNT),
ce426f
+		       "HAS_CPU_FEATURE (POPCOUNT)");
ce426f
 
ce426f
   printf ("%d differences between /proc/cpuinfo and glibc code.\n", fails);
ce426f
 
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/wcscpy.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/wcscpy.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/wcscpy.S
ce426f
@@ -27,11 +27,8 @@
ce426f
 	.text
ce426f
 ENTRY(wcscpy)
ce426f
 	.type	wcscpy, @gnu_indirect_function
ce426f
-	cmpl	$0, KIND_OFFSET+__cpu_features(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-
ce426f
-1:	testl	$bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	HAS_CPU_FEATURE (SSSE3)
ce426f
 	jnz	2f
ce426f
 	leaq	__wcscpy_sse2(%rip), %rax
ce426f
 	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/wmemcmp.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/wmemcmp.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/wmemcmp.S
ce426f
@@ -26,16 +26,13 @@
ce426f
 	.text
ce426f
 ENTRY(wmemcmp)
ce426f
 	.type	wmemcmp, @gnu_indirect_function
ce426f
-	cmpl	$0, KIND_OFFSET+__cpu_features(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-
ce426f
-1:	testl	$bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	HAS_CPU_FEATURE (SSSE3)
ce426f
 	jnz	2f
ce426f
 	leaq	__wmemcmp_sse2(%rip), %rax
ce426f
 	ret
ce426f
 
ce426f
-2:	testl	$bit_SSE4_1, __cpu_features+CPUID_OFFSET+index_SSE4_1(%rip)
ce426f
+2:	HAS_CPU_FEATURE (SSE4_1)
ce426f
 	jz	3f
ce426f
 	leaq	__wmemcmp_sse4_1(%rip), %rax
ce426f
 	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/rawmemchr.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/rawmemchr.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/rawmemchr.S
ce426f
@@ -27,12 +27,10 @@
ce426f
 	.text
ce426f
 ENTRY(rawmemchr)
ce426f
 	.type	rawmemchr, @gnu_indirect_function
ce426f
-	cmpl	$0, __cpu_features+KIND_OFFSET(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	testl	$bit_Prefer_PMINUB_for_stringop, __cpu_features+FEATURE_OFFSET+index_Prefer_PMINUB_for_stringop(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	HAS_ARCH_FEATURE (Prefer_PMINUB_for_stringop)
ce426f
 	jnz	2f
ce426f
-	testl	$bit_SSE4_2, __cpu_features+CPUID_OFFSET+index_SSE4_2(%rip)
ce426f
+	HAS_CPU_FEATURE (SSE4_2)
ce426f
 	jz	2f
ce426f
 	leaq	__rawmemchr_sse42(%rip), %rax
ce426f
 	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strlen.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/strlen.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strlen.S
ce426f
@@ -29,18 +29,16 @@
ce426f
 	.text
ce426f
 ENTRY(strlen)
ce426f
 	.type	strlen, @gnu_indirect_function
ce426f
-	cmpl	$0, __cpu_features+KIND_OFFSET(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	leaq	__strlen_sse2_pminub(%rip), %rax
ce426f
-	testl	$bit_Prefer_PMINUB_for_stringop, __cpu_features+FEATURE_OFFSET+index_Prefer_PMINUB_for_stringop(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	leaq	__strlen_sse2_pminub(%rip), %rax
ce426f
+	HAS_ARCH_FEATURE (Prefer_PMINUB_for_stringop)
ce426f
 	jnz	2f
ce426f
 	leaq	__strlen_sse2(%rip), %rax
ce426f
-	testl	$bit_SSE4_2, __cpu_features+CPUID_OFFSET+index_SSE4_2(%rip)
ce426f
+	HAS_CPU_FEATURE (SSE4_2)
ce426f
 	jz	2f
ce426f
 	leaq	__strlen_sse42(%rip), %rax
ce426f
 	ret
ce426f
-2:	testl	$bit_Slow_BSF, __cpu_features+FEATURE_OFFSET+index_Slow_BSF(%rip)
ce426f
+2:	HAS_ARCH_FEATURE (Slow_BSF)
ce426f
 	jz	3f
ce426f
 	leaq    __strlen_sse2_no_bsf(%rip), %rax
ce426f
 3:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strnlen.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/strnlen.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strnlen.S
ce426f
@@ -27,11 +27,9 @@
ce426f
 	.text
ce426f
 ENTRY(__strnlen)
ce426f
 	.type	__strnlen, @gnu_indirect_function
ce426f
-	cmpl	$0, __cpu_features+KIND_OFFSET(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	leaq	__strnlen_sse2(%rip), %rax
ce426f
-	testl	$bit_Slow_BSF, __cpu_features+FEATURE_OFFSET+index_Slow_BSF(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	leaq	__strnlen_sse2(%rip), %rax
ce426f
+	HAS_ARCH_FEATURE (Slow_BSF)
ce426f
 	jz	2f
ce426f
 	leaq	__strnlen_sse2_no_bsf(%rip), %rax
ce426f
 2:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strrchr.S
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/strrchr.S
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strrchr.S
ce426f
@@ -28,15 +28,13 @@
ce426f
 	.text
ce426f
 ENTRY(strrchr)
ce426f
 	.type	strrchr, @gnu_indirect_function
ce426f
-	cmpl	$0, __cpu_features+KIND_OFFSET(%rip)
ce426f
-	jne	1f
ce426f
-	call	__init_cpu_features
ce426f
-1:	leaq	__strrchr_sse2(%rip), %rax
ce426f
-	testl	$bit_SSE4_2, __cpu_features+CPUID_OFFSET+index_SSE4_2(%rip)
ce426f
+	LOAD_RTLD_GLOBAL_RO_RDX
ce426f
+	leaq	__strrchr_sse2(%rip), %rax
ce426f
+	HAS_CPU_FEATURE (SSE4_2)
ce426f
 	jz	2f
ce426f
 	leaq	__strrchr_sse42(%rip), %rax
ce426f
 	ret
ce426f
-2:	testl	$bit_Slow_BSF, __cpu_features+FEATURE_OFFSET+index_Slow_BSF(%rip)
ce426f
+2:	HAS_ARCH_FEATURE (Slow_BSF)
ce426f
 	jz	3f
ce426f
 	leaq    __strrchr_sse2_no_bsf(%rip), %rax
ce426f
 3:	ret
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strcasestr-c.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/strcasestr-c.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strcasestr-c.c
ce426f
@@ -12,8 +12,8 @@ extern __typeof (__strcasestr_sse2) __st
ce426f
 
ce426f
 #if 1
ce426f
 libc_ifunc (__strcasestr,
ce426f
-	    HAS_SSE4_2 && !use_unaligned_strstr () ? __strcasestr_sse42 :
ce426f
-	    __strcasestr_sse2);
ce426f
+	    HAS_CPU_FEATURE (SSE4_2) && !use_unaligned_strstr ()
ce426f
+	    ? __strcasestr_sse42 : __strcasestr_sse2);
ce426f
 #else
ce426f
 libc_ifunc (__strcasestr,
ce426f
 	    0 ? __strcasestr_sse42 : __strcasestr_sse2);
ce426f
Index: glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strstr-c.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/sysdeps/x86_64/multiarch/strstr-c.c
ce426f
+++ glibc-2.17-c758a686/sysdeps/x86_64/multiarch/strstr-c.c
ce426f
@@ -42,7 +42,7 @@ extern __typeof (__redirect_strstr) __st
ce426f
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
ce426f
    ifunc symbol properly.  */
ce426f
 extern __typeof (__redirect_strstr) __libc_strstr;
ce426f
-libc_ifunc (__libc_strstr, HAS_SSE4_2 ? (use_unaligned_strstr () ?
ce426f
+libc_ifunc (__libc_strstr, HAS_CPU_FEATURE (SSE4_2) ? (use_unaligned_strstr () ?
ce426f
 					 __strstr_sse2_unaligned :
ce426f
 					 __strstr_sse42) : __strstr_sse2)
ce426f