From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12870 invoked by alias); 21 Jul 2011 14:04:55 -0000 Received: (qmail 12848 invoked by uid 22791); 21 Jul 2011 14:04:54 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_OV,TW_RB,TW_TB X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Jul 2011 14:04:41 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6LE4ebT005800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 21 Jul 2011 10:04:40 -0400 Received: from hase.home (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6LE4ccv026978 for ; Thu, 21 Jul 2011 10:04:40 -0400 From: Andreas Schwab To: libc-hacker@sourceware.org Subject: [PATCH] Fix AVX check X-Yow: I'm having an emotional outburst!! Date: Thu, 21 Jul 2011 14:04:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2011-07/txt/msg00012.txt.bz2 2011-07-21 Andreas Schwab * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix last change. (_dl_x86_64_save_sse): Use correct AVX check. --- sysdeps/x86_64/dl-trampoline.S | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S index 1b97929..ad7479f 100644 --- a/sysdeps/x86_64/dl-trampoline.S +++ b/sysdeps/x86_64/dl-trampoline.S @@ -150,7 +150,8 @@ L(have_avx): cmpl $0x6, %eax // Nonzero if SSE and AVX state saving is enabled. sete %al -2: movl %eax, L(have_avx)(%rip) +2: leal -1(%eax,%eax), %eax + movl %eax, L(have_avx)(%rip) cmpl $0, %eax 1: js L(no_avx) @@ -183,11 +184,19 @@ _dl_x86_64_save_sse: movl $1, %eax cpuid movq %r11,%rbx # Restore rbx - movl $1, %eax - testl $(1 << 28), %ecx - jne 2f - negl %eax -2: movl %eax, L(have_avx)(%rip) + xorl %eax, %eax + // AVX and XSAVE supported? + testl $((1 << 28) | (1 << 27)), %ecx + je 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: leal -1(%eax,%eax), %eax + movl %eax, L(have_avx)(%rip) cmpl $0, %eax 1: js L(no_avx5) -- 1.7.6 -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different."