This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: 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: Sun, 24 Jul 2011 12:57:43 -0700
- Subject: Re: PATCH: Simplify AVX check
- References: <20110723171555.GA23128@intel.com>
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
On Sat, Jul 23, 2011 at 10:15:55AM -0700, H.J. Lu wrote:
> Hi,
>
> The only possible values in EAX are 0 or 6. We can just subtract it by
> -1 to get the possible/negative value.
>
>
4 is also possible. We just need to subtract it by 5 so that if EAX
is 0 or 4, we get a negative value and otherwise, we get 1.
H.J.
---
2011-07-24 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..f07df18 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: subl $5, %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: subl $5, %eax
movl %eax, L(have_avx)(%rip)
cmpl $0, %eax