From patchwork Mon Nov 11 14:32:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 290310 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 91DA92C0096 for ; Tue, 12 Nov 2013 01:34:54 +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 :message-id:subject:to:date:from:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=LPWCoycbEDJvEpaX UsKG6fd8lxzn0mLKhYd2K9JKgjC0cLDTTW6ZHfmBFdapg/B6EccqBRcLD9rx0qI8 DoBCzwp3NX2Uou1t7z6SK5qrg31Y3Q0k00wbK2MAM/ynHzF+1G3uaSTk1xBiFBFa mudlaQodi9gYp5qwjhi5fJX/eOE= 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:mime-version:content-type :content-transfer-encoding; s=default; bh=5nqp8T6B0JYMA9UM5pT8tm Yf8xE=; b=CqU85VdzGmyr97lBqrCPhtXkMBY0Kw9tNlson/ynNnO45r2Yg5uMjI +YwVdpTB9AchVIcE8zbbOok5IrPU2pzj4PXnmhq9acgiiUvVdHSJOdOZ7osKwpBq WyedennyjRSWJrSY+uA3BRgq1VJ9uxdX5Zm08ak5S+GegH2NytGmY= Received: (qmail 19164 invoked by alias); 11 Nov 2013 14:34:46 -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 19151 invoked by uid 89); 11 Nov 2013 14:34:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL, BAYES_05, MSGID_FROM_MTA_HEADER, RDNS_NONE, SPF_PASS autolearn=no version=3.3.2 X-HELO: e06smtp11.uk.ibm.com Received: from Unknown (HELO e06smtp11.uk.ibm.com) (195.75.94.107) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 11 Nov 2013 14:33:04 +0000 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 11 Nov 2013 14:32:54 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 11 Nov 2013 14:32:53 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id DD82A17D8059 for ; Mon, 11 Nov 2013 14:32:32 +0000 (GMT) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rABEWe8l59572292 for ; Mon, 11 Nov 2013 14:32:40 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 rABEWqri016187 for ; Mon, 11 Nov 2013 07:32:52 -0700 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 rABEWoQ7016136 for ; Mon, 11 Nov 2013 07:32:50 -0700 Message-Id: <201311111432.rABEWoQ7016136@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 11 Nov 2013 15:32:50 +0100 Subject: [PATCH] Fix failing assertion in calls.c:store_unaligned_arguments_into_pseudos To: gcc-patches@gcc.gnu.org Date: Mon, 11 Nov 2013 15:32:50 +0100 (CET) From: "Ulrich Weigand" MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13111114-5024-0000-0000-000007C800EE Hello, when implementing the new ABI for powerpc64le-linux, I ran into an assertion failure in store_unaligned_arguments_into_pseudos: gcc_assert (args[i].partial % UNITS_PER_WORD == 0); This can happen in the new ABI since we pass "homogeneous structures" consisting of soleley floating point elements of the same type in floating-point registers until they run out, and the rest of the structure in memory. If the structure member type is a 4-byte float, and we only have an odd number of floating point registers available, then args[i].partial can legitimately end up not being a multiple of UNITS_PER_WORD (i.e. 8 on the platform). Now, there are a number of similar checks that args[i].partial is aligned elsewhere in calls.c and functions.c. But for all of those the logic is: if args[i].reg is a REG, then args[i].partial must be a multiple of the word size; but if args[i].regs is a PARALLEL, then args[i].partial can be any arbitrary value. In the powerpc64le-linux use case, the back-end always generates PARALLEL in this situation, so it seemed the middle-end ought to support this -- and it does, except for this one case. However, looking more closely, it seems store_unaligned_arguments_into_pseudos is not really useful for PARALLEL arguments in the first place. What this routine does is load arguments into args[i].aligned_regs. But if we have an argument where args[i].reg is a PARALLEL, args[i].aligned_regs will in fact never be used later on at all! Instead, PARALLEL will always be handled directly via emit_group_move (in load_register_parameters), so the code generated by store_unaligned_arguments_into_pseudos for such cases is simply dead anyway. Thus, I'd suggest to simply have store_unaligned_arguments_into_pseudos skip PARALLEL arguments. Tested on powerpc64-linux and powerpc64le-linux. OK for mainline? Bye, Ulrich ChangeLog: 2013-11-11 Ulrich Weigand * calls.c (store_unaligned_arguments_into_pseudos): Skip PARALLEL arguments. Index: gcc/gcc/calls.c =================================================================== --- gcc.orig/gcc/calls.c +++ gcc/gcc/calls.c @@ -981,6 +981,7 @@ store_unaligned_arguments_into_pseudos ( for (i = 0; i < num_actuals; i++) if (args[i].reg != 0 && ! args[i].pass_on_stack + && GET_CODE (args[i].reg) != PARALLEL && args[i].mode == BLKmode && MEM_P (args[i].value) && (MEM_ALIGN (args[i].value)