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