From patchwork Thu Sep 8 13:35:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 667587 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 3sVLtr2twRz9s2Q for ; Thu, 8 Sep 2016 23:35:30 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=e7CAzAhV; 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:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=xEqQbpsQjAZFixxR rV3YuRMs28lsrN2B/IEUxeTKt3yQo2hmkcjAKVlPkV0LUUYi422p0VbxbneOOH+b 5L+qUB+Z3uViu7msoeVL684Fp+5r9iIvT/bYO0Mx95aosWHUoCqpgEJoD/BTbwEi 6LBOZtv4WTmMrn5+vkjW9UcxtEU= 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 :content-transfer-encoding; s=default; bh=I6kxYRsaI4OdifiSllW96Q bMOyU=; b=e7CAzAhVqdxLz95hty0pChbj2kYa0+bDRAzptaPk+cT5PTMXHjcHAt NVbSSpgBFXx2SLn7wtUKA1cnjeoJWl4vORo7Zz9wma0Er6wvaQjyTrfs6PtZaJbS MZ+8ywzshddA31YwIUTdSlspl7go2O02kpCYJVif5vbO+oZuMIjc8= Received: (qmail 128673 invoked by alias); 8 Sep 2016 13:35:22 -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 128642 invoked by uid 89); 8 Sep 2016 13:35:22 -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, SPF_PASS autolearn=ham version=3.3.2 spammy=BITS_PER_UNIT, bits_per_unit, H*MI:outlook X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Sep 2016 13:35:12 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03lp0079.outbound.protection.outlook.com [94.245.120.79]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-83-KZoqly_2MUy5G-GOkyqjZQ-1; Thu, 08 Sep 2016 14:35:08 +0100 Received: from AM5PR0802MB2610.eurprd08.prod.outlook.com (10.175.46.18) by AM5PR0802MB2611.eurprd08.prod.outlook.com (10.175.46.19) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9; Thu, 8 Sep 2016 13:35:06 +0000 Received: from AM5PR0802MB2610.eurprd08.prod.outlook.com ([10.175.46.18]) by AM5PR0802MB2610.eurprd08.prod.outlook.com ([10.175.46.18]) with mapi id 15.01.0609.013; Thu, 8 Sep 2016 13:35:06 +0000 From: Wilco Dijkstra To: GCC Patches CC: nd Subject: [PATCH][AArch64] Align FP callee-saves Date: Thu, 8 Sep 2016 13:35:06 +0000 Message-ID: x-ms-office365-filtering-correlation-id: 76e5dda4-16e8-4f26-5e7a-08d3d7ecf24e x-microsoft-exchange-diagnostics: 1; AM5PR0802MB2611; 20:uC5hwFKju0jbVVGXLOL0XCCrB7FVvRiYyGfcvwtkLJemnm+bnutbP2+BnMaqnd1mN7XcaSnEyeVNDCV4x4capj6CfRfy5wV9quporqu+g8+m/Lp3tHNgXdMImH1e4Mp+PUz0cM3GwEnvxljDeMHLU78FyGT/cSvj5Oe7uvKORWA= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0802MB2611; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:AM5PR0802MB2611; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2611; x-forefront-prvs: 00594E8DBA x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(377424004)(199003)(189002)(54534003)(76576001)(77096005)(11100500001)(586003)(3280700002)(4326007)(5002640100001)(74316002)(3846002)(305945005)(102836003)(2906002)(10400500002)(6116002)(189998001)(7736002)(7696003)(2900100001)(87936001)(92566002)(7846002)(101416001)(19580405001)(450100001)(106116001)(106356001)(122556002)(105586002)(97736004)(33656002)(86362001)(19580395003)(50986999)(8936002)(5660300001)(81166006)(54356999)(229853001)(81156014)(8676002)(66066001)(3660700001)(9686002)(68736007)(110136002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2611; H:AM5PR0802MB2610.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Sep 2016 13:35:06.4185 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2611 X-MC-Unique: KZoqly_2MUy5G-GOkyqjZQ-1 If the number of integer callee-saves is odd, the FP callee-saves use 8-byte aligned LDP/STP. Since 16-byte alignment may be faster on some CPUs, align the FP callee-saves to 16 bytes and use the alignment gap for the last FP callee-save when possible. Besides slightly different offsets for FP callee-saves, the generated code doesn't change. Bootstrap and regression pass, OK for commit? ChangeLog: 2016-09-08 Wilco Dijkstra * config/aarch64/aarch64.c (aarch64_layout_frame): Align FP callee-saves. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index fed3b6e803821392194dc34a6c3df5f653d2e33e..075b3802c72a68f63b47574e19186e7ce3440b28 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -2735,7 +2735,7 @@ static void aarch64_layout_frame (void) { HOST_WIDE_INT offset = 0; - int regno; + int regno, last_fp_reg = INVALID_REGNUM; if (reload_completed && cfun->machine->frame.laid_out) return; @@ -2781,7 +2781,10 @@ aarch64_layout_frame (void) for (regno = V0_REGNUM; regno <= V31_REGNUM; regno++) if (df_regs_ever_live_p (regno) && !call_used_regs[regno]) - cfun->machine->frame.reg_offset[regno] = SLOT_REQUIRED; + { + cfun->machine->frame.reg_offset[regno] = SLOT_REQUIRED; + last_fp_reg = regno; + } if (cfun->machine->frame.emit_frame_chain) { @@ -2805,9 +2808,21 @@ aarch64_layout_frame (void) offset += UNITS_PER_WORD; } + HOST_WIDE_INT max_int_offset = offset; + offset = ROUND_UP (offset, STACK_BOUNDARY / BITS_PER_UNIT); + bool has_align_gap = offset != max_int_offset; + for (regno = V0_REGNUM; regno <= V31_REGNUM; regno++) if (cfun->machine->frame.reg_offset[regno] == SLOT_REQUIRED) { + /* If there is an alignment gap between integer and fp callee-saves, + allocate the last fp register to it if possible. */ + if (regno == last_fp_reg && has_align_gap && (offset & 8) == 0) + { + cfun->machine->frame.reg_offset[regno] = max_int_offset; + break; + } + cfun->machine->frame.reg_offset[regno] = offset; if (cfun->machine->frame.wb_candidate1 == INVALID_REGNUM) cfun->machine->frame.wb_candidate1 = regno;