From patchwork Sun Jan 6 20:12:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 209798 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 79BA62C0080 for ; Mon, 7 Jan 2013 07:12:55 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1358107976; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:From:To:Cc:Subject:References:Date: In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=QTb+Qh7mLRAqlS6O4Tka jCI4R7Q=; b=aZS2wZAi6bNyhD2PIV5BvIsTD1HcKQ+VBALmHrx8tynYUyzWTTCl GMqXJia8Su7fKd64auC/0wOQw0Co46YEg/dj63ErWjSbsse0OQwZHNsDsKxpWC80 KV70WpjEpI2FN0gjJb1NZJk4/84tLhPgUHyOiupM3ArmUq6tjEHXEqY= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Received:From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=fvyrA6fgindArc8afXok9hbK7EplAKssnxugEImDCjd5MpH4edJ3Fgyw2UBOcu 1E8dD1SETbpGsBFAJ3v0EWr84aY9ve9Dj/dMRohtkq9aIsiStQUGXk3JOkJ+LzuT AA3PTovTBfYJvdXCLKA2Ui3Oe7ELea1mjdIRnYzVePUXs=; Received: (qmail 18519 invoked by alias); 6 Jan 2013 20:12:47 -0000 Received: (qmail 18497 invoked by uid 22791); 6 Jan 2013 20:12:44 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_IB, T_TVD_MIME_NO_HEADERS 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; Sun, 06 Jan 2013 20:12:37 +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 r06KCZ7x005820 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 6 Jan 2013 15:12:36 -0500 Received: from freie.oliva.athome.lsd.ic.unicamp.br (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 r06KCUOB005221 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 6 Jan 2013 15:12:34 -0500 Received: from livre.localdomain (livre-to-gw.oliva.athome.lsd.ic.unicamp.br [172.31.160.19]) by freie.oliva.athome.lsd.ic.unicamp.br (8.14.5/8.14.5) with ESMTP id r06KCL2Y010596; Sun, 6 Jan 2013 18:12:25 -0200 Received: from livre.localdomain (aoliva@localhost.localdomain [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id r06KCHkR026337; Sun, 6 Jan 2013 18:12:17 -0200 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id r06KCDj0026335; Sun, 6 Jan 2013 18:12:13 -0200 From: Alexandre Oliva To: Bruce Korb Cc: Paolo Bonzini , gcc-patches@gcc.gnu.org, Tobias Burnus Subject: Re: fixincludes for libquadmath build regression References: <50D86D47.2050907@gnu.org> <50E00C7D.7030701@gnu.org> <50E0BF99.9060807@gnu.org> Date: Sun, 06 Jan 2013 18:12:13 -0200 In-Reply-To: <50E0BF99.9060807@gnu.org> (Bruce Korb's message of "Sun, 30 Dec 2012 14:26:33 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Dec 30, 2012, Bruce Korb wrote: > On 12/30/12 01:42, Paolo Bonzini wrote: >> Not my territory anymore, but it looks much better! CCing Bruce. > Long time. It's no wonder you've forgotten this little world! :) Indeed! > Anyway, please make the expressions more readable and strip > out the generated text from the review message. Done. Ok? Fix mandatory SSE in 2.1[56]ish glibc's feraiseexcept From: Alexandre Oliva for fixincludes/ChangeLog * inclhack.def (feraiseexcept_nosse_invalid): New. (feraiseexcept_nosse_divbyzero): Likewise. * fixincl.x: Rebuilt. * tests/base/bits/fenv.h: New. --- fixincludes/fixincl.x | 130 ++++++++++++++++++++++++++++++++++-- fixincludes/inclhack.def | 49 ++++++++++++++ fixincludes/tests/base/bits/fenv.h | 29 ++++++++ 3 files changed, 200 insertions(+), 8 deletions(-) create mode 100644 fixincludes/tests/base/bits/fenv.h diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 09eac7c6..2406920 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -4815,4 +4815,53 @@ fix = { test_text = "extern char *\tsprintf();"; }; +/* + * Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64 + * that fails when compiling for SSE-less 32-bit x86. + */ +fix = { + hackname = feraiseexcept_nosse_invalid; + mach = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*'; + files = bits/fenv.h; + select = "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : " + ": \"x\" \\(__f\\)\\);$"; + bypass = "\"fdiv .*; fwait\""; + + c_fix = format; + c_fix_arg = <<- _EOText_ + # ifdef __SSE_MATH__ + %0 + # else + %1__asm__ __volatile__ ("fdiv %%%%st, %%%%st(0); fwait" + %1 : "=t" (__f) : "0" (__f)); + # endif + _EOText_; + + test_text = <<- _EOText_ + __asm__ __volatile__ ("divss %0, %0" : : "x" (__f)); + _EOText_; +}; +fix = { + hackname = feraiseexcept_nosse_divbyzero; + mach = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*'; + files = bits/fenv.h; + select = "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : " + ": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$"; + bypass = "\"fdivp .*; fwait\""; + + c_fix = format; + c_fix_arg = <<- _EOText_ + # ifdef __SSE_MATH__ + %0 + # else + %1__asm__ __volatile__ ("fdivp %%%%st, %%%%st(1); fwait" + %1 : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)"); + # endif + _EOText_; + + test_text = <<- _EOText_ + __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g)); + _EOText_; +}; + /*EOF*/ diff --git a/fixincludes/tests/base/bits/fenv.h b/fixincludes/tests/base/bits/fenv.h new file mode 100644 index 0000000..a82ec25 --- /dev/null +++ b/fixincludes/tests/base/bits/fenv.h @@ -0,0 +1,29 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/bits/fenv.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( FERAISEEXCEPT_NOSSE_INVALID_CHECK ) +# ifdef __SSE_MATH__ + __asm__ __volatile__ ("divss %0, %0" : : "x" (__f)); +# else + __asm__ __volatile__ ("fdiv %%st, %%st(0); fwait" + : "=t" (__f) : "0" (__f)); +# endif +#endif /* FERAISEEXCEPT_NOSSE_INVALID_CHECK */ + + +#if defined( FERAISEEXCEPT_NOSSE_DIVBYZERO_CHECK ) +# ifdef __SSE_MATH__ + __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g)); +# else + __asm__ __volatile__ ("fdivp %%st, %%st(1); fwait" + : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)"); +# endif +#endif /* FERAISEEXCEPT_NOSSE_DIVBYZERO_CHECK */