From patchwork Thu Dec 8 21:44:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 704243 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tZTRT1KyMz9t9x for ; Fri, 9 Dec 2016 08:44:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="XzddBTY0"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:cc:content-type; q=dns; s=default; b=roXZl0OsNRUJpwibb4rElyVcWu6VdMPyRfwZNamUox7 XydqFNYI4r9E7/9/GdtqrwOd5MMWhfrB0TnUoThHktQt3TgJwWa2Op2769k6MQG+ rgcUB0uLDe2+uUEv4YyCifXyK3kpN1tdHBIrTM7ADAV/VcbErN+5WtyiWmKUYizM = 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 :mime-version:from:date:message-id:subject:to:cc:content-type; s=default; bh=NkcP71t157Mr/t/g7n4Y3lVyOmY=; b=XzddBTY05HQEjgGYr +GMweP1mqaP0dYEwM+rAQP94b0ZDp2z10ZBqKBFaoMk/yS9dj/dXz8xZAxi8PDBX bPis7f2tclYjxI0XHzvIOq1Ue9TJFb/ggWm+1UH591edQe5covMAeQjpN6fcfLaO oDpfR32gOYgmnI1bW8YWKQlPR4= Received: (qmail 27794 invoked by alias); 8 Dec 2016 21:44:43 -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 27696 invoked by uid 89); 8 Dec 2016 21:44:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=no version=3.3.2 spammy=Hx-languages-length:1699, H*MI:sk:CAFULd4, hello! X-HELO: mail-vk0-f48.google.com Received: from mail-vk0-f48.google.com (HELO mail-vk0-f48.google.com) (209.85.213.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Dec 2016 21:44:41 +0000 Received: by mail-vk0-f48.google.com with SMTP id 137so236334929vkl.0 for ; Thu, 08 Dec 2016 13:44:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=Hp7LmvpLAbWtHnLQxWhWe6XCzcJ9Al8mXtkKBY/EhRM=; b=WRyXjSxmqk8mLpPybSAaO1wfJ9jNuWOKod/8iFrWI2gYTt31hLicqMmLsmt8WVgk7L 8ZQtNq4eNg4fJq2I4b7lQ0CYzQqResTebOEArIfVlorvLFqBjvS+cWO+Feo3FxZiFxtv U2DMFXdJVXLJHg5asPYVJq+hUsNFLKZHX4NpcYHJKW8vcsROr+M5DuSBJG73Yp170t+I esXIfDB1i2sA8i8FnXYy7fAKP29zdnzO05n8FKE8fCtS1RNe+6A3e9RfwMmQMbh551nd cdgpBZJpUI3i5H5tl2OidjYsSSFe0WmTZ0ZNQSNENi0k2v6UzvJRBHUiVDPhMRqiDhgG OYgA== X-Gm-Message-State: AKaTC03xpTVTEhZkNKMp6Xm3lyBhkJFvRgkhOAYkKzNh2sqzj3AejnhXqxMRQT+h87wLbb+PxwBO8YIT2IJuNw== X-Received: by 10.31.48.85 with SMTP id w82mr20001623vkw.69.1481233479108; Thu, 08 Dec 2016 13:44:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.103.135.215 with HTTP; Thu, 8 Dec 2016 13:44:38 -0800 (PST) From: Uros Bizjak Date: Thu, 8 Dec 2016 22:44:38 +0100 Message-ID: Subject: [PATCH, middle-end]: Fix PR78738, unrecognized insn with -ffast-math To: "gcc-patches@gcc.gnu.org" Cc: James Greenhalgh Hello! Attached patch fixes fall-out from excess-precision improvements patch. As shown in the PR, the code throughout the compiler assumes FLAG_PRECISION_FAST when flag_unsafe_math_optimizations flag is in effect. The patch puts back two lines, removed by excess-precision improvements patch. 2016-12-08 Uros Bizjak PR middle-end/78738 * toplev.c (init_excess_precision): Initialize flag_excess_precision to EXCESS_PRECISION_FAST for flag_unsafe_math_optimizations. testsuite/ChangeLog: 2016-12-08 Uros Bizjak PR middle-end/78738 * gcc.target/i386/pr78738.c: New test. Patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. OK for mainline? Uros. Index: testsuite/gcc.target/i386/pr78738.c =================================================================== --- testsuite/gcc.target/i386/pr78738.c (nonexistent) +++ testsuite/gcc.target/i386/pr78738.c (working copy) @@ -0,0 +1,10 @@ +/* PR middle-end/78738 */ +/* { dg-do compile } */ +/* { dg-options "-O -std=c99 -ffast-math -mfpmath=387" } */ + +double round (double); + +int foo (double a) +{ + return round (a); +} Index: toplev.c =================================================================== --- toplev.c (revision 243456) +++ toplev.c (working copy) @@ -1691,6 +1691,8 @@ init_excess_precision (void) { gcc_assert (flag_excess_precision_cmdline != EXCESS_PRECISION_DEFAULT); flag_excess_precision = flag_excess_precision_cmdline; + if (flag_unsafe_math_optimizations) + flag_excess_precision = EXCESS_PRECISION_FAST; } /* Initialize things that are both lang-dependent and target-dependent.