This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: Simplify AVX check
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Sat, 23 Jul 2011 10:15:55 -0700
- Subject: PATCH: Simplify AVX check
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
The only possible values in EAX are 0 or 6. We can just subtract it by
-1 to get the possible/negative value.
H.J.
----
2011-07-23 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Simplify
AVX check.
diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S
index 45a2dc2..829a617 100644
--- a/sysdeps/x86_64/dl-trampoline.S
+++ b/sysdeps/x86_64/dl-trampoline.S
@@ -148,10 +148,8 @@ L(have_avx):
// Get XFEATURE_ENABLED_MASK
xgetbv
andl $0x6, %eax
- cmpl $0x6, %eax
- // Nonzero if SSE and AVX state saving is enabled.
- sete %al
-2: leal -1(%eax,%eax), %eax
+ // EAX is 6 if SSE and AVX state saving is enabled.
+2: dec %eax
movl %eax, L(have_avx)(%rip)
cmpl $0, %eax
@@ -194,10 +192,8 @@ _dl_x86_64_save_sse:
// Get XFEATURE_ENABLED_MASK
xgetbv
andl $0x6, %eax
- cmpl $0x6, %eax
- // Nonzero if SSE and AVX state saving is enabled.
- sete %al
-2: leal -1(%eax,%eax), %eax
+ // EAX is 6 if SSE and AVX state saving is enabled.
+2: dec %eax
movl %eax, L(have_avx)(%rip)
cmpl $0, %eax