From patchwork Fri Apr 22 13:22:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 613604 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 3qrxBy49QNz9sDk for ; Fri, 22 Apr 2016 23:23: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=eIX1c6/T; 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=OWyH3AIpGrMjOtkw yc+71c8PdLvEJbPl82NzUlkWL9VEA6tIVT0aEqWRG4hZUnu3HX9nFHCWlC1bSLjl 5Ymm+WDPsX0czdlxvKZHg2onqO+b/7tLOq8rbJ+e9qY99oc0piZzGiCZ65u9v8Mf kYKhY9IYI5738HzIzlOzeba8Wrk= 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=r/D6et9ZcTFOPL/OiYPEvd +TXkQ=; b=eIX1c6/Tb68wTn/k3A1EaBRekek43wWT0IQ5+OJsB04JFxMf5/7Fzc LrMFYFOCwiiI6zPN2e5v3e/DAZ4bRvRSKcGO0NWOqmZepD48H6E8SO032c5QzyAS SzX9aE23nuDGO8P1hfYpALF+AiSF3q04wqskEGlbTP/m1WCEULcPM= Received: (qmail 437 invoked by alias); 22 Apr 2016 13:23: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 423 invoked by uid 89); 22 Apr 2016 13:23:10 -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=MODES_TIEABLE_P, modes_tieable_p, tieable, orr 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; Fri, 22 Apr 2016 13:23:00 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01lp0183.outbound.protection.outlook.com [213.199.154.183]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-67--Vhfog6zTim35O0x-YSOtQ-1; Fri, 22 Apr 2016 14:22:53 +0100 Received: from AM3PR08MB0088.eurprd08.prod.outlook.com (2a01:111:e400:8847::18) by AM3PR08MB0088.eurprd08.prod.outlook.com (2a01:111:e400:8847::18) with Microsoft SMTP Server (TLS) id 15.1.466.19; Fri, 22 Apr 2016 13:22:51 +0000 Received: from AM3PR08MB0088.eurprd08.prod.outlook.com ([fe80::d0af:2d98:cf1b:e43e]) by AM3PR08MB0088.eurprd08.prod.outlook.com ([fe80::d0af:2d98:cf1b:e43e%17]) with mapi id 15.01.0466.023; Fri, 22 Apr 2016 13:22:51 +0000 From: Wilco Dijkstra To: "gcc-patches@gcc.gnu.org" CC: nd Subject: [PATCH][AArch64] Improve aarch64_modes_tieable_p Date: Fri, 22 Apr 2016 13:22:51 +0000 Message-ID: x-ms-office365-filtering-correlation-id: 0791a96f-c14f-4095-c828-08d36ab134a9 x-microsoft-exchange-diagnostics: 1; AM3PR08MB0088; 5:YC1b2jdnwGKSUWqcEqcM0NZV+4I1NQL3chFLsYkaQlN539E1HIjyN4RvT7OkbmQgUcP87yucxc69VSRBni3yMZvUCKOsIN+pkVFWv0iMJZ4IabbkRGh11E1glNukeNxAFXa1deHpfo3T/GJkcOYMdSH3aUhos0xLzd3Gocv6qVYP9Ooe97hKE6tZtapxTBDA; 24:ei5LNPla+HGw+vLtNs2YjunANV0fafzs20aXg7o3Ll1xIPHzHetFnNqX+pDtk3d2Dc2DJYCgQXXPvePozWZ5FxivFTpEf4stW3JnEyBc2to=; 7:AOUmMAOcqeGeFjc8RTo3fh5J3nuBsYAH8OZYHF94krGJ2YA9uBbVRGvnixM0wQ/qn+Yo+phx1q+47LeBfWGGK7gfTnwa3Z2F8QrREEl2ijxwVAGJdqi3/te7mQ+vfOIPZscBuN+dQMcJU3P6HWwhA28uo64HSRaXX0qC42bwbneW+4FDtZZOnk+vFa7E/m45yzN/lnqkyILvFAuZxXKeuAqlxMkZXHYldieRHyED50s=; 20:sMkI3Y+jGNQGJS3Q8MEoKD6QpEEaaAePYe1S039VYOnzaOq2jqdrFChqAOT/xyXqrvGgcjFVvBvpJMfl664Qfs2o9QvupbaPnU9oTgT5M2g7PwU6XUwUT93GuqoBh/l6suXIYZrV3xK2xh5xIMDY13OTaiVgdzlQ7JWImBXDoY8= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM3PR08MB0088; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(9101521026)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001); SRVR:AM3PR08MB0088; BCL:0; PCL:0; RULEID:; SRVR:AM3PR08MB0088; x-forefront-prvs: 0920602B08 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(377424004)(5250100002)(2501003)(87936001)(3280700002)(92566002)(66066001)(19580395003)(19580405001)(5003600100002)(450100001)(5002640100001)(33656002)(86362001)(106116001)(5008740100001)(54356999)(9686002)(1220700001)(6116002)(2906002)(11100500001)(1096002)(102836003)(74316001)(586003)(2900100001)(3846002)(110136002)(81166005)(3660700001)(189998001)(50986999)(4326007)(2351001)(5004730100002)(229853001)(15760500001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR08MB0088; H:AM3PR08MB0088.eurprd08.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Apr 2016 13:22:51.3107 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR08MB0088 X-MC-Unique: -Vhfog6zTim35O0x-YSOtQ-1 Improve modes_tieable by returning true in more cases: allow scalar access within vectors without requiring an extra move. Removing these moves helps the register allocator in deciding whether to use integer or FP registers on operations that can be done on both. This saves about 100 instructions in the gcc.target/aarch64 tests. A typical example: orr v1.8b, v0.8b, v1.8b fmov x0, d0 fmov x1, d1 add x0, x1, x0 ins v0.d[0], x0 orr v0.8b, v1.8b, v0.8b after: orr v1.8b, v0.8b, v1.8b add d0, d1, d0 orr v0.8b, v1.8b, v0.8b OK for trunk? ChangeLog: 2016-04-22 Wilco Dijkstra * gcc/config/aarch64/aarch64.c (aarch64_modes_tieable_p): Allow scalar/single vector modes to be tieable. --- gcc/config/aarch64/aarch64.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index abc864c..6e921f0 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -12294,7 +12294,14 @@ aarch64_reverse_mask (enum machine_mode mode) return force_reg (V16QImode, mask); } -/* Implement MODES_TIEABLE_P. */ +/* Implement MODES_TIEABLE_P. In principle we should always return true. + However due to issues with register allocation it is preferable to avoid + tieing integer scalar and FP scalar modes. Executing integer operations + in general registers is better than treating them as scalar vector + operations. This reduces latency and avoids redundant int<->FP moves. + So tie modes if they are either the same class, or vector modes with + other vector modes, vector structs or any scalar mode. +*/ bool aarch64_modes_tieable_p (machine_mode mode1, machine_mode mode2) @@ -12305,9 +12312,12 @@ aarch64_modes_tieable_p (machine_mode mode1, machine_mode mode2) /* We specifically want to allow elements of "structure" modes to be tieable to the structure. This more general condition allows other rarer situations too. */ - if (TARGET_SIMD - && aarch64_vector_mode_p (mode1) - && aarch64_vector_mode_p (mode2)) + if (aarch64_vector_mode_p (mode1) && aarch64_vector_mode_p (mode2)) + return true; + + /* Also allow any scalar modes with vectors. */ + if (aarch64_vector_mode_supported_p (mode1) + || aarch64_vector_mode_supported_p (mode2)) return true; return false;