From patchwork Fri Apr 15 14:10:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrill Tkachov X-Patchwork-Id: 610989 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 3qmfbY0RQXz9t60 for ; Sat, 16 Apr 2016 00:11:20 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=nHkKV6pz; 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 :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=EMiOgo6ZP1kme6MYbjhIHs2SshB1JNs4J7pkptlPibK HQaoUTEdg0KzGnfC6S7WUrynhzbpFDjARuXs8Z5LFvy3Zn0BIcFDtyHdSmoDzpgf lepYHfUed1hq7xCHnnwgnxxeXiD8JUc6T+APtF3y7CWIOYri6RFDyAHUvcYRSMHk = 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:date:from:mime-version:to:cc:subject:content-type; s=default; bh=AoGf36nUpnl67KQ2Rck3g9zLE3o=; b=nHkKV6pz6SOU8dcXt CqGwVlCVn24wqcOiudRRbFYPo/XcT/ZLByj4nYenPOFx+KkgZh+KFJvMpVx3wd69 mlvq8cs9fToG548FimeG43KlQItAjoruCfD1IKZerNgkQyxLcUS1RcbeQzVktYKW XYYBjLN+WEVyUAgSsrzWRF5Sjw= Received: (qmail 115906 invoked by alias); 15 Apr 2016 14:11: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 115890 invoked by uid 89); 15 Apr 2016 14:11:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=SImode, simode, remind, DImode X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Apr 2016 14:11:00 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9E1083C; Fri, 15 Apr 2016 07:09:44 -0700 (PDT) Received: from [10.2.206.200] (e100706-lin.cambridge.arm.com [10.2.206.200]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 29B943F21A; Fri, 15 Apr 2016 07:10:58 -0700 (PDT) Message-ID: <5710F670.3010605@foss.arm.com> Date: Fri, 15 Apr 2016 15:10:56 +0100 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: GCC Patches CC: James Greenhalgh , Marcus Shawcroft , Richard Earnshaw , Andrew Pinski , "rth@redhat.com" Subject: [PATCH][AArch64] Work around PR target/64971 Hi all, This is a repost of Andrew's fix for PR target/64971 that was originally posted at: https://gcc.gnu.org/ml/gcc-patches/2015-02/msg00502.html The only change is that I substituted DImode for Pmode and added a FIXME comment to remind us to revisit this (see the PR in bugzilla for more info). Bootstrapped and tested on aarch64-none-linux-gnu (LP64, I don't have access to a full ILP32 system) This patch affects only ILP32 codegen so I've run a make check on aarch64-none-elf with /-mabi=ilp32 and nothing regressed. I think at this stage it's the least risky band-aid. Is this ok for trunk at this stage? Thanks, Kyrill 2016-04-15 Andrew Pinski Kyrylo Tkachov PR target/65971 * config/aarch64/aarch64.md (sibcall): Force call address to be DImode for ILP32. (sibcall_value): Likewise. 2016-04-15 Andrew Pinski * gcc.c-torture/compile/pr37433-1.c: New testcase. commit ff99b9cb21a195fb2b2c0e4d580db2b1e806ec97 Author: Kyrylo Tkachov Date: Thu Apr 14 10:52:45 2016 +0100 [AArch64] From Andrew Pinski: Work around PR target/64971 diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index da85a7f..a9e811e 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -855,6 +855,13 @@ (define_expand "sibcall" || aarch64_is_noplt_call_p (callee))) XEXP (operands[0], 0) = force_reg (Pmode, callee); + /* FIXME: This is a band-aid. Need to analyze why expand_expr_addr_expr + is generating an SImode symbol reference. See PR 64971. */ + if (TARGET_ILP32 + && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF + && GET_MODE (XEXP (operands[0], 0)) == SImode) + XEXP (operands[0], 0) = convert_memory_address (Pmode, + XEXP (operands[0], 0)); if (operands[2] == NULL_RTX) operands[2] = const0_rtx; @@ -886,6 +893,14 @@ (define_expand "sibcall_value" || aarch64_is_noplt_call_p (callee))) XEXP (operands[1], 0) = force_reg (Pmode, callee); + /* FIXME: This is a band-aid. Need to analyze why expand_expr_addr_expr + is generating an SImode symbol reference. See PR 64971. */ + if (TARGET_ILP32 + && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF + && GET_MODE (XEXP (operands[1], 0)) == SImode) + XEXP (operands[1], 0) = convert_memory_address (Pmode, + XEXP (operands[1], 0)); + if (operands[3] == NULL_RTX) operands[3] = const0_rtx; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c b/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c new file mode 100644 index 0000000..322c167 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c @@ -0,0 +1,11 @@ +void regex_subst(void) +{ + const void *subst = ""; + (*(void (*)(int))subst) (0); +} + +void foobar (void) +{ + int x; + (*(void (*)(void))&x) (); +}