From patchwork Wed Jun 13 15:27:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 164706 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 AB8B8B6FAC for ; Thu, 14 Jun 2012 01:27:21 +1000 (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=1340206042; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:Date:Message-ID:Subject:From:To: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=lP4vwQU Nkr2qj/ZKaWNMv4Yq7Qc=; b=yotUxqC1eunfUO0qt2QfoM1tagPwqrwmmjoHGin jrrmJWHmYJViOKXKVjtCq+n804U5xfBdPDJl4cRFzuGW/hlIAQujw0p+bssMuBB/ U+lpEFsL5DshQ+yFwvwFK+JlXbvi0NpYzJ5nbD4yNW9vUQVg2vKOjPk8RHgkXI+4 kFAk= 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:MIME-Version:Received:Received:Date:Message-ID:Subject:From:To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=GwKmrPVznIUAJEiXS20fxpEdTMvp7uGUOw3oJYzZOljCz3BSxqfTcOgOSX/7Kx FRIfoVFtsCi+6keDOwta8PbG0DBcFL65iT40zk0QARgqKj8NJ+szdCRGdEWefiSD MYSXVpC4tSP7ZlHG0Au1hvncgArk8r6n05LA0UjITxngs=; Received: (qmail 10519 invoked by alias); 13 Jun 2012 15:27:15 -0000 Received: (qmail 10506 invoked by uid 22791); 13 Jun 2012 15:27:14 -0000 X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_FN, TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Jun 2012 15:27:01 +0000 Received: by yenl13 with SMTP id l13so628353yen.20 for ; Wed, 13 Jun 2012 08:27:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.115.163 with SMTP id e23mr33886688yhh.95.1339601220222; Wed, 13 Jun 2012 08:27:00 -0700 (PDT) Received: by 10.147.111.19 with HTTP; Wed, 13 Jun 2012 08:27:00 -0700 (PDT) Date: Wed, 13 Jun 2012 17:27:00 +0200 Message-ID: Subject: [PATCH, i386]: Some more soft-fp cleanups From: Uros Bizjak To: gcc-patches@gcc.gnu.org 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 Hello! A couple of #defines can be moved to shared header, no need to mask _fex with exception mask and fnstsw should be marked volatile, since it depends on hidden FP status register. 2012-06-13 Uros Bizjak * config/i386/32/sfp-machine.h (_FP_NANSIGN_S, _FP_NANSIGN_D, _FP_NANSIGN_E, _FP_NANSIGN_Q): Move ... * config/i386/64/sfp-machine: ... (delete here) ... * config/i386/sfp-machine.h: ... to here. (FP_EX_MASK): Remove. (FP_RND_MASK): New. (FP_INIT_ROUNDMODE): Declare asm as volatile. Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN. Uros. Index: config/i386/sfp-machine.h =================================================================== --- config/i386/sfp-machine.h (revision 188515) +++ config/i386/sfp-machine.h (working copy) @@ -14,8 +14,13 @@ #include "config/i386/32/sfp-machine.h" #endif -#define _FP_KEEPNANFRACP 1 +#define _FP_KEEPNANFRACP 1 +#define _FP_NANSIGN_S 1 +#define _FP_NANSIGN_D 1 +#define _FP_NANSIGN_E 1 +#define _FP_NANSIGN_Q 1 + /* Here is something Intel misdesigned: the specs don't define the case where we have two NaNs with same mantissas, but different sign. Different operations pick up different NaNs. */ @@ -42,13 +47,11 @@ #define FP_EX_UNDERFLOW 0x10 #define FP_EX_INEXACT 0x20 -#define FP_EX_MASK 0x3f - void __sfp_handle_exceptions (int); #define FP_HANDLE_EXCEPTIONS \ do { \ - if (_fex & FP_EX_MASK) \ + if (_fex) \ __sfp_handle_exceptions (_fex); \ } while (0); @@ -57,15 +60,17 @@ #define FP_RND_PINF 0x800 #define FP_RND_MINF 0x400 +#define FP_RND_MASK 0xc00 + #define _FP_DECL_EX \ unsigned short _fcw __attribute__ ((unused)) = FP_RND_NEAREST -#define FP_INIT_ROUNDMODE \ - do { \ - __asm__ ("fnstcw %0" : "=m" (_fcw)); \ +#define FP_INIT_ROUNDMODE \ + do { \ + __asm__ __volatile__ ("fnstcw\t%0" : "=m" (_fcw)); \ } while (0) -#define FP_ROUNDMODE (_fcw & 0xc00) +#define FP_ROUNDMODE (_fcw & FP_RND_MASK) #define __LITTLE_ENDIAN 1234 #define __BIG_ENDIAN 4321 Index: config/i386/32/sfp-machine.h =================================================================== --- config/i386/32/sfp-machine.h (revision 188515) +++ config/i386/32/sfp-machine.h (working copy) @@ -76,7 +76,3 @@ 16byte since soft-fp emulation is done in 16byte. */ #define _FP_NANFRAC_E _FP_QNANBIT_E, 0, 0, 0 #define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0, 0, 0 -#define _FP_NANSIGN_S 1 -#define _FP_NANSIGN_D 1 -#define _FP_NANSIGN_E 1 -#define _FP_NANSIGN_Q 1 Index: config/i386/64/sfp-machine.h =================================================================== --- config/i386/64/sfp-machine.h (revision 188515) +++ config/i386/64/sfp-machine.h (working copy) @@ -17,7 +17,3 @@ #define _FP_NANFRAC_D _FP_QNANBIT_D #define _FP_NANFRAC_E _FP_QNANBIT_E, 0 #define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0 -#define _FP_NANSIGN_S 1 -#define _FP_NANSIGN_D 1 -#define _FP_NANSIGN_E 1 -#define _FP_NANSIGN_Q 1