From patchwork Wed Oct 16 14:28:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcus Shawcroft X-Patchwork-Id: 283961 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 01E672C0082 for ; Thu, 17 Oct 2013 01:28:56 +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:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=GNj1TnAaUNaN+niCITjAUnGS/vZeA7HG1b5s22Q6A4Xpm9 vvPVvAER6qvMvwxgdpDisQcVp32Tn2xa90Huz1la0zyUR/yW57SAy01yO/ehRL+J L/ltoXGOhEhiMeefE7m1nDu6WGgQtD9s7z6o0VSxozi0MJIDWzDsVEtv24C6k= 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:subject:content-type; s= default; bh=JS3BJ77uNj20DUixYkun4Hvu4L4=; b=TIda/UmfgGJsOjFxlY7z R1gGu3ng0D68c6hdB4XEBGR9lQQTzdyJ0Xllv7+cnw13ZLtQnJtvpJqKfTqSDPhx 7BY5BmdOUQpUA8WRX229VZ68JhSWw6xayfubcbFUayuKIZuHNowWoWooALYGFANr VvwmtvrsuK0WvpEOynv9SO0= Received: (qmail 2304 invoked by alias); 16 Oct 2013 14:28:50 -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 2290 invoked by uid 89); 16 Oct 2013 14:28:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Oct 2013 14:28:49 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 16 Oct 2013 15:28:46 +0100 Received: from [10.1.207.140] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Wed, 16 Oct 2013 15:28:44 +0100 Message-ID: <525EA29D.406@arm.com> Date: Wed, 16 Oct 2013 15:28:45 +0100 From: Marcus Shawcroft User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" Subject: [AArch64] Fix preferred_reload_class for regclass STACK_REG. X-MC-Unique: 113101615284600601 The existing AArch64 implementation of preferred_reload_class when called with a destination regclass STACK_REG returns the wider register class GENERAL_REG. This patch changes the behavior such that we only return a narrower class (or NO_REGS) and never return a wider class. I'll leave this on the list 24h before committing. /Marcus 2013-10-16 Marcus Shawcroft * config/aarch64/aarch64.c (aarch64_preferred_reload_class): Adjust handling of STACK_REG. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index da3962f..7fce7a0 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -4219,9 +4219,18 @@ aarch64_class_max_nregs (reg_class_t regclass, enum machine_mode mode) static reg_class_t aarch64_preferred_reload_class (rtx x, reg_class_t regclass) { - if (regclass == POINTER_REGS || regclass == STACK_REG) + if (regclass == POINTER_REGS) return GENERAL_REGS; + if (regclass == STACK_REG) + { + if (REG_P(x) + && reg_class_subset_p (REGNO_REG_CLASS (REGNO (x)), POINTER_REGS)) + return regclass; + + return NO_REGS; + } + /* If it's an integer immediate that MOVI can't handle, then FP_REGS is not an option, so we return NO_REGS instead. */ if (CONST_INT_P (x) && reg_class_subset_p (regclass, FP_REGS)