From patchwork Thu Feb 8 15:49:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Clifton X-Patchwork-Id: 870916 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-472864-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="yRDP6sWF"; dkim-atps=neutral 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 3zcjM128xxz9ryr for ; Fri, 9 Feb 2018 02:50:03 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=QOuGk6redZPiEqfOCjYWpEeUl2I0xpA6L6eEMvtv+OFZDMq1rs uVPFuVZPiD2gcdXt2jwQ/htY9SkNwnCEKLYHpPEzS6CO3PexBai07LZVkNYSoHbI BiyMJHlszd5rEHzdmyjPei7DxIn536VnzAIPEZJaYv4YdYC6ETRWSTHgs= 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:from :to:cc:subject:date:message-id:mime-version:content-type; s= default; bh=5OAJ6k1ze98ZM8CMtkzhT4aT0rU=; b=yRDP6sWFHYuAHICaYysw 93uWy89lQ6DdJ/RBSV5wTfEpfBMs7vSPSz8+cPr41C67oCC3hfcPkpcULvlZJRoR cjNOgOowV18YTRYbkINBrFUqVBIIPUrIl+QtKUmO25hbd7gqJVsq5NkP2rbtBkWK uE2gsMv2/jo/8DYQ+2s07fI= Received: (qmail 78982 invoked by alias); 8 Feb 2018 15:49:56 -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 78971 invoked by uid 89); 8 Feb 2018 15:49:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Feb 2018 15:49:51 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DAC337D679; Thu, 8 Feb 2018 15:49:39 +0000 (UTC) Received: from snowball.redhat.com (ovpn-117-131.ams2.redhat.com [10.36.117.131]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4765E2166BB6; Thu, 8 Feb 2018 15:49:39 +0000 (UTC) From: Nick Clifton To: segher@kernel.crashing.org Cc: gcc-patches@gcc.gnu.org Subject: RFA: Fix PR 68028: LTO error when compiling PowerPC binaries with single precision floating point Date: Thu, 08 Feb 2018 15:49:38 +0000 Message-ID: <877ernpjl9.fsf@redhat.com> MIME-Version: 1.0 X-IsSubscribed: yes Hi Segher, OK, here is an official submission of my patch to fix PR 68028. I should note that Richard Guenther feels that there is a better way to solve the problem - by only initializing the values once - but I still like my solution, so I am offering it here. OK to apply ? Cheers Nick gcc/ChangeLog 2018-02-08 Nick Clifton * config/rs6000/rs6000.c (rs6000_option_override_internal): In LTO mode prefer function attributes over command line -mcpu setting. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 257282) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -4834,12 +4834,25 @@ if (main_target_opt) { - if (main_target_opt->x_rs6000_single_float != rs6000_single_float) - error ("target attribute or pragma changes single precision floating " - "point"); - if (main_target_opt->x_rs6000_double_float != rs6000_double_float) - error ("target attribute or pragma changes double precision floating " - "point"); + /* PR 68028: In LTO mode the -mcpu value is passed in as a function + attribute rather than on the command line. So instead of checking + for discrepancioes, we enforce the choice determined by the + attributes. */ + if (in_lto_p) + { + rs6000_single_float = main_target_opt->x_rs6000_single_float; + rs6000_double_float = main_target_opt->x_rs6000_double_float; + } + /* There could be an 'else' statement here but it is hardly worth + it as the compiler will make the optimization anyway, and this + way we avoid indenting the code unnecessarily. */ + + if (main_target_opt->x_rs6000_single_float != rs6000_single_float) + error ("target attribute or pragma changes single precision floating " + "point"); + if (main_target_opt->x_rs6000_double_float != rs6000_double_float) + error ("target attribute or pragma changes double precision floating " + "point"); } rs6000_always_hint = (rs6000_tune != PROCESSOR_POWER4