From patchwork Mon Dec 28 13:38:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1420872 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=H9auq7pt; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D4JYK3gH4zB3t1 for ; Tue, 29 Dec 2020 00:39:01 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 61FDD3840C3C; Mon, 28 Dec 2020 13:38:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 61FDD3840C3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1609162739; bh=EwFJSrKKvU6RNupfD/GfXcWN12+DDm+5xEaQbooE3dA=; h=Date:To:Subject:In-Reply-To:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=H9auq7ptL6mLQPfrkzjg7uTQrc1PQAhdLiBAu+/XddWtTjbrf9qpG19NEw8T8UGTa 4bKp4i2+ecUJbOMsTyrO7s/cC2yaS0RQiy1sNe7b1F0OdZbvL5L8MH23XBsRTQ27zC txkHm8Y+uMEtql1Be96qXatFLlzJ46hAsIRQsevA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130080.outbound.protection.outlook.com [40.107.13.80]) by sourceware.org (Postfix) with ESMTPS id 0CE9438708EF for ; Mon, 28 Dec 2020 13:38:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0CE9438708EF Received: from AM6PR10CA0057.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:80::34) by VI1PR0802MB2429.eurprd08.prod.outlook.com (2603:10a6:800:ba::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3700.27; Mon, 28 Dec 2020 13:38:52 +0000 Received: from AM5EUR03FT012.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:80:cafe::87) by AM6PR10CA0057.outlook.office365.com (2603:10a6:209:80::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3700.27 via Frontend Transport; Mon, 28 Dec 2020 13:38:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;gcc.gnu.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT012.mail.protection.outlook.com (10.152.16.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3700.27 via Frontend Transport; Mon, 28 Dec 2020 13:38:51 +0000 Received: ("Tessian outbound 8b6e0bb22f1c:v71"); Mon, 28 Dec 2020 13:38:49 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e8f070a1a666b0b3 X-CR-MTA-TID: 64aa7808 Received: from 0c3cfc369ff4.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id EE41FC34-3F09-4B35-A908-D05A3D2826F6.1; Mon, 28 Dec 2020 13:38:34 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0c3cfc369ff4.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 28 Dec 2020 13:38:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Au0XbLshaHErI4ZKmEK2m4ThAlgleoIxdjEfxtZLFI0H2svqhygo9j2UJHVHyILGw2J02qRoOBiL4eyWLNLtrefpaF2lCGGRyu+HuOxAwH8UEo5l3x7FKyynmP/AXo7ZGmJwPTpVA30jLTs28xmismrssvQ9/voJPOlae56e/5FyLYb8iU+uVwKj2Ha4MqdwDbp1f30isuOaaAHNgdAB862Zo2jMaFEGzmt3uzs0q3mtOkckD4Px9C9J6vCvqoF2ucAiuwGe6sDmTbWNm8aUSImPCDXpamh4InyZTz2jpcdn5txPHfCnQWro8mZbMR3YKWJE2qIa8+/8MjtMo6HlPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EwFJSrKKvU6RNupfD/GfXcWN12+DDm+5xEaQbooE3dA=; b=dh1Hs6ly74wOTCJPyM60cDLi4zEu066piMAX2D+vkf1ND3G1qeR3afDawf9G5ECfA78hyyM8BA63ybkS+YuFQ6NaymYHlorgRCigwi2aF0hORnfwZUMqcI6LyllCOaResdcpKZugh64/1ewk/Zsm/sdzXjdPJjuxkBkEFQ/X/NGdpMjeGUEgFTFsa6QsBG66F3mwftOCo+q3VHqm3OKeQXcyAfYYe6FakO9YtTBg8Zolan2PioOCKiZQ1sERYm0Zau2UuEWfJ4WpA2Q/aIP4WCSSCYRThMZkubtysuZYAezeHElwesvmf/77FWWnlIeT24jw3XVaSMbDilJUmBY4PQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by VE1PR08MB5135.eurprd08.prod.outlook.com (2603:10a6:803:108::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3700.27; Mon, 28 Dec 2020 13:38:31 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::f937:5b3:12e1:8297]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::f937:5b3:12e1:8297%7]) with mapi id 15.20.3700.031; Mon, 28 Dec 2020 13:38:31 +0000 Date: Mon, 28 Dec 2020 13:38:23 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH 8/8 v9]middle-end slp: Add complex operations class to share first match among all matchers Message-ID: <20201228133821.GA2847@arm.com> Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [217.140.106.53] X-ClientProxiedBy: DM5PR07CA0025.namprd07.prod.outlook.com (2603:10b6:3:16::11) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.53) by DM5PR07CA0025.namprd07.prod.outlook.com (2603:10b6:3:16::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3700.27 via Frontend Transport; Mon, 28 Dec 2020 13:38:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2cbf745e-d85e-4828-9d38-08d8ab35e9a9 X-MS-TrafficTypeDiagnostic: VE1PR08MB5135:|VI1PR0802MB2429: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: jHwe2zXvtPbHIB6qlS53f4/QF7xmqJ59KiHC3iAc1Y3xzRwBD3M3AJI8Sc0okutJGQfre0kN1xn6o7VNowrkVTShYoPmAhphIqEpjIu38315NBlUSHYgHqseRA/9bNOC9DufUDdIGYppGSbw+HvlKEYscRIFNYyt7BdnCengY89Wz6PmW2e3Rq2Xm1SeXpd3ii60dYeqIgphHPrEx3FnT+FqG7bFHsVr67itkxQR/zWXr0Iyh71fU9Wd0XOjCw5ARKdQSuOaQLrIALjLDOis55BIditpIjSgs/4OL52Y+K9xKqpAqwVFuZPcLZSgeX/bK116G5q3i8WOelz36i+bfxEdpvfkoQ3GEFAsOZbxyr19sfHB0eFU7dBWJF44v6eMuHSqZJ6dpzojUyV1YTFmKvdQoTYltltOulrB6SuQZby3Mp9cgEjjaXct1zThBf8f X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB5325.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39850400004)(396003)(136003)(366004)(346002)(376002)(478600001)(44144004)(956004)(16526019)(186003)(5660300002)(8936002)(6666004)(6916009)(66476007)(66556008)(55016002)(33964004)(66946007)(66616009)(83380400001)(33656002)(2616005)(36756003)(8676002)(4743002)(52116002)(7696005)(235185007)(2906002)(86362001)(26005)(4326008)(316002)(44832011)(8886007)(1076003)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?dI8WvKIAfQmKcKJVgnz07kdihry73z?= =?utf-8?q?omxohlPuK2S/f/qVZkXau9nOETvMZDY+oRrDYvVwtFDfLWr/p2Moy7/vR44iUXbhx?= =?utf-8?q?RadTeP2+u7ydZtKh5M+aV18Pl1fpq5dfEqnPOpXC04WNJtGgVrBHKU44VFbQ/WxwG?= =?utf-8?q?SLctmIgjKVk7/PsYLQ+XjX9sLaYvBzh2KmGsg1tEpY3/iFPMbtzETH6U0k50onNss?= =?utf-8?q?BUOwpodlnpDRoCL7c2yvkr456qCaZP4joEehWWTQTFf9eHbO5Nx3Tu91B/l19jY0K?= =?utf-8?q?Xaa9NA/4f5U7HblC9mvEzETUm9Hxk1HoiMUkrqFeD5sx0b51xLCx0e7jSJBNqvxKC?= =?utf-8?q?ihDu5lizuDYIZU3zlT/xwXpGSJ+z55xbtG8mBmN4GNMvuNtQx75AODJFHjePFOVk9?= =?utf-8?q?DoEj94CN5cJ5zV6qVji7Jj2+C5o+aLOewM9z6aR9103pxo9OIEjfhKlwk6fW4IXKz?= =?utf-8?q?rtjx2FMXfl1rKTtuxo3kOzARfl/c0eF5v+AN96nUxqS8TVknA9D+aQ4H84dm06hY/?= =?utf-8?q?4LXRCK7HEW43bVlvG0dBXR/vjT/hgopmBalQmUL7F3BS3Lgt4nnot7AZv03/G3USS?= =?utf-8?q?DYJtQaBxGa4lrtt2rDyx3fmCfYbtEWid+0uR7PvLOh/HXftgq5f9z07vM6S7HzJNi?= =?utf-8?q?WoayJCpxG3Gv6SS3w2uNVU4zuDrYV6eEFTAcCSPjWZ7ZYk9C6/YDazXyJb1ToUxho?= =?utf-8?q?cPlYxw84/lHXasyWC0K/vuSmw9NJazmDjWeKsMaQ/ycQvfAP0jozfiFBpvKP9l/IO?= =?utf-8?q?t8I3LXRnha1ZclUWqz4mHxQoiQzdwdxTfQrLpX50qtd4NPBUBuBZYQQSmlFbpE4/W?= =?utf-8?q?nohaUFlLp1KwGcgDptULnsXKtcs/fD00B/Mdwhf3SkBSvgKVJgocHdrTHnI/1Z1XC?= =?utf-8?q?EjqLJF/U82AOzmPAdJI2odd3dIr9INzuryTMM2cjNFcycFz3WtNPL0vCzK6MsFdHw?= =?utf-8?q?V2XsI3RaWoMw/ZMy4To?= X-MS-Exchange-Transport-Forked: True X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5135 Original-Authentication-Results: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT012.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 187e527c-3a80-49f8-8517-08d8ab35ddbf X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P+Wpwe10Ixorn63Z+0w29oyAxmMJchK9AB4wwkWwmp72laWO3vkCGv7quQhwoJlZ5yFa0HKl7SlCKuSsB7qml3Z65Gi5EiTrKQUlrkHIBJ57YLj8ai90x6IsBqcR0/M9j8mLUfqKLE7Pvh3UiCUaEX/Ixi7jViLDrUplkN5Do0jf9ZJRAOIRI5RYtVMn3ukVEkAde3w9gQmoMlmtp8ggtC/qCHO3zW8xkYjQgemRgHd4huUmpJ9xehW7dPEuH/DF0iTEtKMJr8D1S0qnTiyEDcv7hfanWNsf2F9aHmNA2S6UC+VgkTQgN5wtSs3CboDVCkCGSuhxfqH+A8yHftLimY5YUC2IOTzWbz13zVwTg5IlXMRaZFKQnpODDfbLs4Qtey3/1xvHiSCbRNia0mHUlXQdhmxKcGHKGIaZuWRbJlrZxj+fnEKRBZTTAFnAFGsEA3QS8hEGgTZOSGKnytFHlyG1YxVd2yZTF1kitPPEjSiloDnr9PUk7PM6YE+X+7v9 X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(396003)(136003)(376002)(346002)(39850400004)(46966006)(44832011)(44144004)(26005)(70206006)(1076003)(81166007)(478600001)(8936002)(33964004)(956004)(2616005)(82310400003)(36756003)(5660300002)(235185007)(83380400001)(8676002)(82740400003)(6916009)(47076005)(55016002)(8886007)(316002)(16526019)(186003)(2906002)(336012)(356005)(4743002)(6666004)(33656002)(4326008)(66616009)(7696005)(86362001)(70586007)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2020 13:38:51.4159 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2cbf745e-d85e-4828-9d38-08d8ab35e9a9 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT012.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2429 X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tamar Christina via Gcc-patches From: Tamar Christina Reply-To: Tamar Christina Cc: nd@arm.com, rguenther@suse.de, ook@ucw.cz Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi All, This introduces a common class complex_operations_pattern which encapsulates the complex add, mul, fma and fms pattern in such a way so that the first match is shared. Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: * tree-vect-slp-patterns.c (class complex_operations_pattern, complex_operations_pattern::matches, complex_operations_pattern::recognize, complex_operations_pattern::build): New. (slp_patterns): Use it. --- inline copy of patch -- diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c index ab6587f0b8522ec5f916f74e7e7401b1f7a35bbb..33d22e657ebf1d0454a134bab4febb2b65581822 100644 diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c index ab6587f0b8522ec5f916f74e7e7401b1f7a35bbb..33d22e657ebf1d0454a134bab4febb2b65581822 100644 --- a/gcc/tree-vect-slp-patterns.c +++ b/gcc/tree-vect-slp-patterns.c @@ -1429,6 +1429,83 @@ complex_fms_pattern::build (vec_info *vinfo) complex_pattern::build (vinfo); } +/******************************************************************************* + * complex_operations_pattern class + ******************************************************************************/ + +/* This function combines all the existing pattern matchers above into one class + that shares the functionality between them. The initial match is shared + between all complex operations. */ + +class complex_operations_pattern : public complex_pattern +{ + protected: + complex_operations_pattern (slp_tree *node, vec *m_ops, + internal_fn ifn) + : complex_pattern (node, m_ops, ifn) + { + this->m_num_args = 0; + } + + public: + void build (vec_info *); + static internal_fn + matches (complex_operation_t op, slp_tree_to_load_perm_map_t *, slp_tree *, + vec *); + + static vect_pattern* + recognize (slp_tree_to_load_perm_map_t *, slp_tree *); +}; + +/* Dummy matches implementation for proxy object. */ + +internal_fn +complex_operations_pattern:: +matches (complex_operation_t /* op */, + slp_tree_to_load_perm_map_t * /* perm_cache */, + slp_tree * /* ref_node */, vec * /* ops */) +{ + return IFN_LAST; +} + +/* Attempt to recognize a complex mul pattern. */ + +vect_pattern* +complex_operations_pattern::recognize (slp_tree_to_load_perm_map_t *perm_cache, + slp_tree *node) +{ + auto_vec ops; + complex_operation_t op + = vect_detect_pair_op (*node, true, &ops); + internal_fn ifn = IFN_LAST; + + ifn = complex_fms_pattern::matches (op, perm_cache, node, &ops); + if (ifn != IFN_LAST) + return complex_fms_pattern::mkInstance (node, &ops, ifn); + + ifn = complex_mul_pattern::matches (op, perm_cache, node, &ops); + if (ifn != IFN_LAST) + return complex_mul_pattern::mkInstance (node, &ops, ifn); + + ifn = complex_fma_pattern::matches (op, perm_cache, node, &ops); + if (ifn != IFN_LAST) + return complex_fma_pattern::mkInstance (node, &ops, ifn); + + ifn = complex_add_pattern::matches (op, perm_cache, node, &ops); + if (ifn != IFN_LAST) + return complex_add_pattern::mkInstance (node, &ops, ifn); + + return NULL; +} + +/* Dummy implementation of build. */ + +void +complex_operations_pattern::build (vec_info * /* vinfo */) +{ + gcc_unreachable (); +} + /******************************************************************************* * Pattern matching definitions ******************************************************************************/ @@ -1440,7 +1517,7 @@ vect_pattern_decl_t slp_patterns[] order patterns from the largest to the smallest. Especially if they overlap in what they can detect. */ - SLP_PATTERN (complex_add_pattern), + SLP_PATTERN (complex_operations_pattern), }; #undef SLP_PATTERN