From patchwork Thu Jul 17 00:37:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 370923 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 E3672140078 for ; Thu, 17 Jul 2014 10:38:05 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:to:date:from:cc:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=Bbgmsjkndxz4KG9T AzuM02o0ZnZzO7mzH8KwP8GwMhkF2sMyZo3bfh8IssDe7nd53zKKiBjukwN7AZaQ 1WdUrSjDnNgcgDaLaBbC3FUxNGdvb6AWb3sCmV/0f/NEWXlBUh90bSRR4i/I86dg N45al79mMv3UPZRu7xYhUF832S4= 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 :message-id:subject:to:date:from:cc:mime-version:content-type :content-transfer-encoding; s=default; bh=zJXafl/fNXK/u/wmU0uReB mlL3E=; b=lMLDK/DD1Dn/jGsv/Mheb0lnhnCtrnonI98gcBlSwqW7BBjScV4rB/ ICfXf4vCeEdX4MyWtIjLGMtQNBZK4MhK5vhlMeY22gUAnJeefJPemtk8g/PH8M8L wX+/UDGMV5eVhc6jsWHoW3VBE0Yz84EyWeDNYJJ5kKLfia0FYd1q8= Received: (qmail 28754 invoked by alias); 17 Jul 2014 00:37:58 -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 28732 invoked by uid 89); 17 Jul 2014 00:37:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, MSGID_FROM_MTA_HEADER, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: e06smtp14.uk.ibm.com Received: from e06smtp14.uk.ibm.com (HELO e06smtp14.uk.ibm.com) (195.75.94.110) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 17 Jul 2014 00:37:55 +0000 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 17 Jul 2014 01:37:52 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 17 Jul 2014 01:37:49 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 770B317D8045 for ; Thu, 17 Jul 2014 01:39:26 +0100 (BST) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s6H0bn7R33095860 for ; Thu, 17 Jul 2014 00:37:49 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s6H0bnU7022490 for ; Wed, 16 Jul 2014 18:37:49 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with SMTP id s6H0blC4022458; Wed, 16 Jul 2014 18:37:47 -0600 Message-Id: <201407170037.s6H0blC4022458@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 17 Jul 2014 02:37:47 +0200 Subject: [PATCH, rs6000, 4.8/4.9] Fix ELFv2 homogeneous float aggregate ABI bug To: gcc-patches@gcc.gnu.org Date: Thu, 17 Jul 2014 02:37:47 +0200 (CEST) From: "Ulrich Weigand" Cc: dje.gcc@gmail.com MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14071700-1948-0000-0000-0000008BFB2F Hello, this is the variant intended for the 4.8/4.9 branches of the patch: https://gcc.gnu.org/ml/gcc-patches/2014-07/msg00994.html As discussed, it does *not* actually change ABI, but only warn when encountering a situation where the ABI will change in a future GCC. (Avoiding the specific term "GCC 4.10" here since I'm not certain whether the next GCC release will in fact be called that ...) Tested on powerpc64-linux and powerpc64le-linux; also verified using the ABI compat suite (against an unpatched GCC) that this patch does not change the ABI. OK for 4.8/4.9 once the mainline patch is in? Bye, Ulrich gcc/ChangeLog: * config/rs6000/rs6000.c (rs6000_function_arg): If a float argument does not fit fully into floating-point registers, and there is still space in the register parameter area, issue -Wpsabi note that the ABI will change in a future GCC release. gcc/testsuite/ChangeLog: * gcc.target/powerpc/ppc64-abi-warn-1.c: New test. Index: gcc-4_9-branch/gcc/config/rs6000/rs6000.c =================================================================== --- gcc-4_9-branch.orig/gcc/config/rs6000/rs6000.c +++ gcc-4_9-branch/gcc/config/rs6000/rs6000.c @@ -10225,6 +10225,7 @@ rs6000_function_arg (cumulative_args_t c rtx r, off; int i, k = 0; unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3; + int fpr_words; /* Do we also need to pass this argument in the parameter save area? */ @@ -10253,6 +10254,37 @@ rs6000_function_arg (cumulative_args_t c rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off); } + /* If there were not enough FPRs to hold the argument, the rest + usually goes into memory. However, if the current position + is still within the register parameter area, a portion may + actually have to go into GPRs. + + Note that it may happen that the portion of the argument + passed in the first "half" of the first GPR was already + passed in the last FPR as well. + + For unnamed arguments, we already set up GPRs to cover the + whole argument in rs6000_psave_function_arg, so there is + nothing further to do at this point. + + GCC 4.8/4.9 Note: This was implemented incorrectly in earlier + GCC releases. To avoid any ABI change on the release branch, + we retain that original implementation here, but warn if we + encounter a case where the ABI will change in the future. */ + fpr_words = (i * GET_MODE_SIZE (elt_mode)) / (TARGET_32BIT ? 4 : 8); + if (i < n_elts && align_words + fpr_words < GP_ARG_NUM_REG + && cum->nargs_prototype > 0) + { + static bool warned; + if (!warned && warn_psabi) + { + warned = true; + inform (input_location, + "the ABI of passing homogeneous float aggregates" + " will change in a future GCC release"); + } + } + return rs6000_finish_function_arg (mode, rvec, k); } else if (align_words < GP_ARG_NUM_REG) Index: gcc-4_9-branch/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c =================================================================== --- /dev/null +++ gcc-4_9-branch/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ +/* { dg-options "-mabi=elfv2" } */ + +struct f8 + { + float x[8]; + }; + +void test (struct f8 a, struct f8 b) /* { dg-message "note: the ABI of passing homogeneous float aggregates will change" } */ +{ +} +