From patchwork Tue Nov 5 01:14:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 288352 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E59D82C0040 for ; Tue, 5 Nov 2013 12:15:21 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=Vhy4DlXeXJOy3l8HFWa03SnNe1Nzi79AMW30SHUaK0YZuH3xT0 WshKxi+xbkUAgsuvWUoxWvOsMxTqmubRlk342zTOG2N2G9yF+xWHC/mbHUMr1EAY F0maWBYTNaNJhz5pKInaHKXFNOgxXaXtokCSqd+n22yH+5uhHaXH7Truk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=hyf4lw0SHaFv/CecX28+qPBSGUs=; b=enLLBD/DBau6JMYaGT4d qTfLK5+qxzPTfXqj2axfV3D2lNiCmWRlllPOfqwoFFcBTnG1U696vWTvrKDyo+I5 8XIaZAwQTHkKanr3gM3kGTqMrG8JXKODUlg9RM4z+pj//ADN53g+a6gduy4b0Q1r Tho2PKC+s3i2WkB+qV1izig= Received: (qmail 26507 invoked by alias); 5 Nov 2013 01:15:11 -0000 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 Received: (qmail 26472 invoked by uid 89); 5 Nov 2013 01:15:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_20, RDNS_NONE, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 05 Nov 2013 01:15:05 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1VdVEH-0006TG-2o from joseph_myers@mentor.com ; Mon, 04 Nov 2013 17:14:49 -0800 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 4 Nov 2013 17:14:49 -0800 Received: from digraph.polyomino.org.uk (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.2.247.3; Tue, 5 Nov 2013 01:14:47 +0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.76) (envelope-from ) id 1VdVEE-0003YR-0z; Tue, 05 Nov 2013 01:14:46 +0000 Date: Tue, 5 Nov 2013 01:14:46 +0000 From: "Joseph S. Myers" To: CC: Subject: Fix __GCC_IEC_559 determination for 32-bit x86 Message-ID: MIME-Version: 1.0 HJ's regression tester shows the new test gcc.dg/iec-559-macros-9.c failing for 32-bit x86. It turns out the excess precision handling for determining the value of __GCC_IEC_559 has two problems: flag_excess_precision hasn't been initialized at the point it's tested, so flag_excess_precision_cmdline (which *has* been updated based on flag_iso) needs testing instead, and on x86 with standard excess precision enabled there is no adddf3 pattern (because all x87 arithmetic is in XFmode) so the default hook wrongly thinks it's a soft-float target. This can be fixed by adding an x86-specific hook implementation; the issue doesn't affect any other target defining TARGET_FLT_EVAL_METHOD, because only x86 makes sure to disable the problematic insn patterns for -fexcess-precision=standard. Bootstrapped with no regressions on x86_64-unknown-linux-gnu. OK to commit (the x86 target hook addition)? 2013-11-05 Joseph Myers * config/i386/i386.c (ix86_float_exceptions_rounding_supported_p): New function. (TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P): Define. c-family: 2013-11-05 Joseph Myers * c-cppbuiltin.c (cpp_iec_559_value): Test flag_excess_precision_cmdline not flag_excess_precision. Index: gcc/config/i386/i386.c =================================================================== --- gcc/config/i386/i386.c (revision 204351) +++ gcc/config/i386/i386.c (working copy) @@ -43375,6 +43375,18 @@ ix86_memmodel_check (unsigned HOST_WIDE_INT val) return val; } +/* Implement TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P. */ + +static bool +ix86_float_exceptions_rounding_supported_p (void) +{ + /* For x87 floating point with standard excess precision handling, + there is no adddf3 pattern (since x87 floating point only has + XFmode operations) so the default hook implementation gets this + wrong. */ + return TARGET_80387 || TARGET_SSE_MATH; +} + /* Initialize the GCC target structure. */ #undef TARGET_RETURN_IN_MEMORY #define TARGET_RETURN_IN_MEMORY ix86_return_in_memory @@ -43747,6 +43759,10 @@ ix86_memmodel_check (unsigned HOST_WIDE_INT val) #undef TARGET_SPILL_CLASS #define TARGET_SPILL_CLASS ix86_spill_class +#undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P +#define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \ + ix86_float_exceptions_rounding_supported_p + struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-i386.h" Index: gcc/c-family/c-cppbuiltin.c =================================================================== --- gcc/c-family/c-cppbuiltin.c (revision 204351) +++ gcc/c-family/c-cppbuiltin.c (working copy) @@ -734,7 +734,7 @@ cpp_iec_559_value (void) if (flag_iso && !c_dialect_cxx () && TARGET_FLT_EVAL_METHOD != 0 - && flag_excess_precision != EXCESS_PRECISION_STANDARD) + && flag_excess_precision_cmdline != EXCESS_PRECISION_STANDARD) ret = 0; /* Various options are contrary to IEEE 754 semantics. */