PATCH: Properly check AVX support in _dl_runtime_profile
H.J. Lu
hongjiu.lu@intel.com
Fri Jul 22 13:59:00 GMT 2011
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)
More information about the Libc-alpha
mailing list