From patchwork Thu Feb 22 11:38:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 876603 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-473703-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="QQ3RUG62"; dkim-atps=neutral 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 3znC604jmkz9sVw for ; Thu, 22 Feb 2018 22:38:15 +1100 (AEDT) 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:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=tL6 L5ctLd+Kqn0GyVgQhD+K66X8FjRtA+G4hCGIZAiPK9laxYosG/eOae6rTiudLy5+ U4Bz8nhEVExlelFfrYOshgnkWk8gp6kHGfL5o1C8Tb/Q4axbBe70vyJuMLZSBKEe WuwMiYB4psiEL+/pxVkfAZ5leH1wKOXdFoaafJ6o= 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:content-type :content-transfer-encoding:mime-version; s=default; bh=gO2+fU+d0 d2yVy2wlcUAjKN55aI=; b=QQ3RUG62PRIuGJrMiA/gT4N1l645aIIrHD2a2v+pL G5/kXn6q0FCe/spB0BixvtU7FBbkWJG58Nc5cO6YoQ/KdbnmzAT7BtYkbabMxyw0 mXMZy7VmBxBmGDYwxijPMeMYLcXZUYMyYnQ+YXNZ9hUqAjKoWtzSafqTZe4TJo5U Hg= Received: (qmail 122616 invoked by alias); 22 Feb 2018 11:38:08 -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 122601 invoked by uid 89); 22 Feb 2018 11:38:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: EUR01-VE1-obe.outbound.protection.outlook.com Received: from mail-ve1eur01on0040.outbound.protection.outlook.com (HELO EUR01-VE1-obe.outbound.protection.outlook.com) (104.47.1.40) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Feb 2018 11:38:06 +0000 Received: from DB6PR0801MB2053.eurprd08.prod.outlook.com (10.168.86.22) by DB6PR0801MB2117.eurprd08.prod.outlook.com (10.169.220.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.506.18; Thu, 22 Feb 2018 11:38:03 +0000 Received: from DB6PR0801MB2053.eurprd08.prod.outlook.com ([fe80::ac2f:91c:c9da:ec56]) by DB6PR0801MB2053.eurprd08.prod.outlook.com ([fe80::ac2f:91c:c9da:ec56%17]) with mapi id 15.20.0506.023; Thu, 22 Feb 2018 11:38:03 +0000 From: Wilco Dijkstra To: GCC Patches CC: nd , "sje@gcc.gnu.org" Subject: [PATCH][AArch64] PR84114: Avoid reassociating FMA Date: Thu, 22 Feb 2018 11:38:03 +0000 Message-ID: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Wilco.Dijkstra@arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0801MB2117; 6:6C7WhTzXYVI3wrl0wyI+70HpJiehMsMFdI06IlI5Gmw0H6FCrlBHqe/VXmzpZCn5zhISDDIgowGRoiEKy/R3ON4V71Ezn4EnLSP0StVbOGcGvE8/L5B59+PD0nUUkPI9nmRa+WMhd0rxCv/Nwe4bF9yIiS38292hRNp1juDCM1B+I8ClUChC593ujjzbooW5RHkkYkgdUe9VCHQQD+vilVsFUTCKKjivn4QvoIMoUY94jJEdTpDfTj1Nw0NC6IZcDqfEq+d54mGkXR/0XHEmjvzYbTzSOsJkJQkfNl1YM/l2rT9656UUWINDx7Kp+exlvjcSJl/vPgx/eOuEIjj5DIgH878CIg9PL/HeTuGGgbcjDTETFgORdZp7EWlRKD6+; 5:JYXKg7aq3IUahtslGy/6bJW+pCDXixtgAL2D/X1rgK8ADl4EnFDtBuSZyLuYFeuEFSH4PiPCs8ZftbxYfvx2RKphKGq2gfOZP/HPNfR9hN1t8l19IUUGJz4YYBQopZ7ZZiuec5UDMzOhjpCg1YUdMuPpgon+WCIYf36ED7S1SsQ=; 24:9bkaHD1LpwAVXwD9lUKmrFuCPSMMyHKAmYhJ7XenlPsUuefhT0qsgv0mztUSaeBu9Mb5WlTgrAobEofXKzC5Y4q9oE580kJto2Gabcc4nZ4=; 7:mL40mW/sUgW2FnXVEvIUTnOqTrsLqUQrUHyLoMDhNj3a9r5jx2mYOoGWGNTEIrVQvRhoTQBHALW0IkYYL5dQedc0Uw/i0yRkWrqEqPzSMhqdGY4QoWzrnwvf9JaCo6R1sSq3KDJGREgri4Y88SxdTSnc7aLMIeum2ea9nx0dfzhH/UMU9nNtkqyWNjy5RZBY4rMMskFs8IqmYdVwPEjDANS7xrOsGI5eB4Bq0S6GdaCc+w6311/hAW7SUN9b6eDb x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 04978c8b-5711-4fda-6194-08d579e8bbd3 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:DB6PR0801MB2117; x-ms-traffictypediagnostic: DB6PR0801MB2117: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001078)(6040501)(2401047)(5005006)(8121501046)(3002001)(3231101)(944501161)(10201501046)(93006095)(93001095)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:DB6PR0801MB2117; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0801MB2117; x-forefront-prvs: 059185FE08 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39380400002)(366004)(39860400002)(376002)(346002)(199004)(189003)(54534003)(377424004)(478600001)(97736004)(55016002)(8936002)(9686003)(3660700001)(105586002)(7736002)(74316002)(2900100001)(86362001)(305945005)(6436002)(53936002)(14454004)(106356001)(33656002)(99286004)(5250100002)(1857600001)(81156014)(81166006)(8676002)(7696005)(102836004)(5660300001)(316002)(26005)(6506007)(3280700002)(66066001)(6916009)(72206003)(4326008)(68736007)(3846002)(54906003)(25786009)(450100002)(6116002)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB2117; H:DB6PR0801MB2053.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: RaCW9av/fYJJuAaCGmA64QjALRqxj9CCzMO+cbBzdyiIoVZQkduzvxbHakoRxfLdlbrmthmljstTtJSHrh8zTgLV/Ms9Bmn5RtBeE6L0bd6DnIUZaNHm6Z/CmNGclO3ofzDH6aUZ918gYTdhatibx9SROKDNriRVF/MBjlHbBEU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04978c8b-5711-4fda-6194-08d579e8bbd3 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Feb 2018 11:38:03.2421 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2117 As discussed in the PR, the reassociation phase runs before FMAs are formed and so can significantly reduce FMA opportunities. Although reassociation could be switched off, it helps in many cases, so a better alternative is to only avoid reassociation of floating point additions. This fixes the testcase and gives 1% speedup on SPECFP2017, fixing the performance regression. OK for commit? ChangeLog: 2018-02-23 Wilco Dijkstra PR tree-optimization/84114 * config/aarch64/aarch64.c (aarch64_reassociation_width) Avoid reassociation of FLOAT_MODE addition. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index b3d5fde171920e5759046a4bd61cfcf9eb78d7dd..5f9541cf700aaf18c1f1ac73054614e2932781e4 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1109,15 +1109,16 @@ aarch64_min_divisions_for_recip_mul (machine_mode mode) return aarch64_tune_params.min_div_recip_mul_df; } +/* Return the reassociation width of treeop OPC with mode MODE. */ static int -aarch64_reassociation_width (unsigned opc ATTRIBUTE_UNUSED, - machine_mode mode) +aarch64_reassociation_width (unsigned opc, machine_mode mode) { if (VECTOR_MODE_P (mode)) return aarch64_tune_params.vec_reassoc_width; if (INTEGRAL_MODE_P (mode)) return aarch64_tune_params.int_reassoc_width; - if (FLOAT_MODE_P (mode)) + /* Avoid reassociating floating point addition so we emit more FMAs. */ + if (FLOAT_MODE_P (mode) && opc != PLUS_EXPR) return aarch64_tune_params.fp_reassoc_width; return 1; }