This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Properly check AVX support in _dl_runtime_profile


Hi Ulrich,

This patch fixes the AVX support in _dl_runtime_profile.  Tested on
Fedora 15/x86-64 with and without AVX.


H.J.
---
2011-07-22  H.J. Lu  <hongjiu.lu@intel.com>

	* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Properly
	check AVX support.

diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S
index 1b97929..1707c05 100644
--- a/sysdeps/x86_64/dl-trampoline.S
+++ b/sysdeps/x86_64/dl-trampoline.S
@@ -139,19 +139,20 @@ L(have_avx):
 	movl	$1, %eax
 	cpuid
 	movq	%r11,%rbx		# Restore rbx
-	xorl	%eax, %eax
+	movl	$-1, %edi
 	// AVX and XSAVE supported?
-	testl	$((1 << 28) | (1 << 27)), %ecx
-	je	2f
+	andl	$((1 << 28) | (1 << 27)), %ecx
+	cmpl	$((1 << 28) | (1 << 27)), %ecx
+	jne	2f
 	xorl	%ecx, %ecx
 	// Get XFEATURE_ENABLED_MASK
 	xgetbv
 	andl	$0x6, %eax
 	cmpl	$0x6, %eax
 	// Nonzero if SSE and AVX state saving is enabled.
-	sete	%al
-2:	movl	%eax, L(have_avx)(%rip)
-	cmpl	$0, %eax
+	cmove	%eax, %edi
+2:	movl	%edi, L(have_avx)(%rip)
+	cmpl	$0, %edi
 
 1:	js	L(no_avx)
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]