From patchwork Mon Dec 28 13:36:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1420865 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=8.43.85.97; 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=ypiE3WaW; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 4D4JVw2Dzlz9sX7 for ; Tue, 29 Dec 2020 00:36:56 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DB1B23870924; Mon, 28 Dec 2020 13:36:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB1B23870924 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1609162613; bh=kQY8QgFcLgOVIxqG5+hMUtHvNCHS/IVbMdi+vLZEbI4=; 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=ypiE3WaWkjdk5jwWAXaZDiSpeUHfX8YB3OJxyKAwZ+UFCYwdLMTRxz6dwM8Bnwjcz RmB1Kd9tbWMu5JF6UlzPtz7KbMAVD9YJLNMNZBCtnwCtTdTsUbiKqwdO3FfD77CCHc lTa+QZuOWDARv1adqnaCxSJb+Ug0L/Vut+/9bITM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2071.outbound.protection.outlook.com [40.107.21.71]) by sourceware.org (Postfix) with ESMTPS id 19BF438708EF for ; Mon, 28 Dec 2020 13:36:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 19BF438708EF Received: from AM6PR02CA0024.eurprd02.prod.outlook.com (2603:10a6:20b:6e::37) by VI1PR08MB4382.eurprd08.prod.outlook.com (2603:10a6:803:f5::14) 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:36:48 +0000 Received: from AM5EUR03FT052.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:6e:cafe::d0) by AM6PR02CA0024.outlook.office365.com (2603:10a6:20b:6e::37) 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:36:48 +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 AM5EUR03FT052.mail.protection.outlook.com (10.152.17.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:36:45 +0000 Received: ("Tessian outbound 6af064f543d4:v71"); Mon, 28 Dec 2020 13:36:45 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 53f94b47df34f73d X-CR-MTA-TID: 64aa7808 Received: from ae506d74ffc2.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0BA02BD7-FE18-4045-A772-7F4DC001D17C.1; Mon, 28 Dec 2020 13:36:29 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ae506d74ffc2.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 28 Dec 2020 13:36:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fpt7XqCEWDiWRuxhJn2d0C7pSct2U5lkuSe6G/QnKAJTJs95mry4sqv5CcIYJCjACoE/LpZUfSWYjDfzrkoxNid59wwZdvtVOSiFt1wnYz0/h+wtLXSWyNFlSv4490M9msD2O1T5xalOqwv+fxC54YDhY9801tU9ddKWyHbqA6mo2sKGcJjyFPHHMYQGBIdgBIWVlekqg4AGpGicR73J9pd2L4rpcv60Y3b3Sqpas5rJ3X0SCsY705nlrvaZVJR0Zybpj/P0WpGnvd7yECFczMCZBpW1aLxXvaWuhGe1/hbUkixxzHPRB1qfo4e6fWjTtdwgzO6+lExUQumLML93ng== 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=kQY8QgFcLgOVIxqG5+hMUtHvNCHS/IVbMdi+vLZEbI4=; b=KiOPesj/NVGQc5KZOMuWTSx9TalWGA/k4nRSpI4lFi7rOE7ZCdv4wC44CINppc4CNOsyZJlvycJxOsuPc/Mx3kgo6W6RYOmkLqsdvZ/LHA2v0iQ6SDuTCI0viSqYqhjnLRNNY1a4cxrbRUsyjSlLoDbfX/23BEnqwVTfZ2yDS2uJZpl2a2v48s82S2Z9ayVYr2XXmqb/8anJlQhs/QhgWejragF07Iw+eC8pzD7p9FYW4qq7uvyKKwiYbGq9nVJUlADQQwjHeIsaJ9tgtc/8kHx+/kVXM0wJ7ev/DrjxGazV6TCF6xpylMOUxviY/4xORE91RY96zvxIPBfLOIZRjg== 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:36:27 +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:36:27 +0000 Date: Mon, 28 Dec 2020 13:36:19 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/8 v9]middle-end slp: fix is_linear_load_p to prevent multiple answers Message-ID: <20201228133615.GA19375@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: SN4PR0501CA0104.namprd05.prod.outlook.com (2603:10b6:803:42::21) 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 SN4PR0501CA0104.namprd05.prod.outlook.com (2603:10b6:803:42::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.11 via Frontend Transport; Mon, 28 Dec 2020 13:36:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 625c36e5-e6e7-43c4-3298-08d8ab359ed5 X-MS-TrafficTypeDiagnostic: VE1PR08MB5135:|VI1PR08MB4382: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: KwyrUTyMJ+XEItDDmiTBQEdfiw0MVhpq7ZH5mXY+ff9sdlInScq/GRcAXndSm9znIUrEYz3OvnSa7ApOe+hAEOyo/0cL0siZBtonLnDqUNs+xXj+Q3RJZxXmPVUm+iRXA664gjli+249gcPNp/58vYFr3WMN3KNjPoaS8bHfeytXWBhh9GhDgbRNVTshnq7eGRNNsB+tUzv5MUghFkeUs4Vt9pRMH5zzhllKQWcBB80suz1OoVrBCNXOFUq3x1daZBW23wDvBj6P9uKxxVgR/EVB0WsrFbBmsbRPtRp/R4rvP6mwssgd31ISNZ3sID8zZn8NbqQZYljBOczM3qy/qvK7VPykR3hHQepjOWdsBUuWWLESI7m4eHrVJ2MpB0TQqvSLLp4b8klTZ2AuTlAqibQr5bSXt8/CnA6PungjTzgK5LNtxFcofBqqyirONYJl 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)(396003)(136003)(39860400002)(366004)(346002)(376002)(478600001)(44144004)(956004)(16526019)(186003)(5660300002)(8936002)(6666004)(6916009)(66476007)(66556008)(55016002)(33964004)(66946007)(66616009)(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?wUy0d2Ffm1MBYvuRDYu3Frv7xhUw92?= =?utf-8?q?1JZEUmnRyCSmaquyrqbQxdX/mdADGchsfdGsugaPVRhdQMSj1AtSMMCat9H/yhEtA?= =?utf-8?q?Hjdu0a2FPc4FZYAavhLJikZ+ep/5axJZagLCfOkxOcOWbULDpc6Mt7C1UCuTK5mJU?= =?utf-8?q?3hLpyDH0+wMicpK21eyYsjCMEvauCv7BMX+KjP8AjpCq7BWqWoJBoiEP3RZJTLsn0?= =?utf-8?q?infJg1p9obPMKFYJDinOl1XkLvMyd6I5U8Iwt179YvQni3iSfbZ7PbL3jRP8ksYDm?= =?utf-8?q?1KXdI97n5KZo6kFPFckAP8CHre+lsiUP+baG9pOfV4FX7eRPw4cwIGO9Rxjvdj3xd?= =?utf-8?q?M4NNDC2tnmvYf65znvesq9cquXrKmMlrEUoTe/vTuKMD9wuM4Hx4wAW7IZEjGVIID?= =?utf-8?q?WKaiobZ8P+RQBmtUMzWmOhRDd9LNNIa82R5QVS51OxVsifzHaWJiWGR5dqKVvreYf?= =?utf-8?q?HgAz6TDuQQq9uu4NXF3nI1iTIgcEQ+OgZ9r8n5okHFswNCRWnO3L/CVA5GcJDaE1z?= =?utf-8?q?E6lHeau+1mfMAFk+24bxTFc8F0tslgI0iuxLZR7V/Hke6HTVSaw2Ph2ANvUA7GTY/?= =?utf-8?q?L3bUpiMwcjYZ9e8xvzbg1on9/IkWMdJXUUnS29mYycxkRqlFabchn2ZQfH/8vB45o?= =?utf-8?q?hb4tT+uCZP/hPmag3CpmAsaY0iUQBXT9bcYiFKHaGdmO8/AxO0BJBOVCtiPX1zFdp?= =?utf-8?q?YeNX3Yp2qCvZs4hqhyz2nMBntgrnnyCtL/TvMp1k4/UknjWOBfo84jexMX2AtNsNJ?= =?utf-8?q?zS6WfPanQ6w7NhFj4MQsKrSopWG4cP4C7NPxrwG2qt/m5DG2iWe1pXfBlDje0czpg?= =?utf-8?q?ECI4ullNF4dbLxG12JnTtKTrNPKbTSPmAqtVUKyI3kFk0S433u8keg2C+RlfYcRN4?= =?utf-8?q?yR5rTwxzqgakFNe6emWjb3LNXsFOciWVuo4AuMI9lwq0QWY0hYA0u61epqH01Z1WP?= =?utf-8?q?2D2wr6n1n7BBoNWr4Pf?= 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: AM5EUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 4333c6a7-e5bb-4fca-59d5-08d8ab3593c5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iaxb0E41n+sfGW90CkQ15Ey/6p5l3i6Vo8XaaPc6yw1h9gqhg03UdKla+QfGUoPz/4SnMnYP2SdiDT39dCG62l+ViB+e8uHxEyuqXmlWztiuPKAhOFziOSDbpM7hdG9U1I1CHTV0q4zmvyh01e+at+OE1WVLmCJzuGqd+xK8WQpr4mCSoyyLGqX+4gmCvMd2AeAarP53+dI2J1hR4Cg+qFJRZCfaEEzsw8OtfUEf59eRv5KnYj4QS6KBARA7H8dRhb1+iAD3AlpsO4JHLKWc4ssw/OMHhh9PR6zrGAeN3FhLe57KHbZhDu+OwCEzXwa3NnUarveXUN2irBPuCtUaobKsJd9sxmA38jOqYVQiMHaNkYaW7xxe2NpUUvBznXYAX+Uocw91wTUfpywaZrWzqjzL3BGN4FwMUVrnUtbfnD1W4+Y2kXhWaawuW7Bdf+lpYLIJ/gVTFVGHg2x6mWCn9uBHgcHA6WSh7ZL+zk9aNVA2iOaER7QD7E54v5aAw1Ya 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)(376002)(136003)(39860400002)(346002)(46966006)(186003)(55016002)(82740400003)(16526019)(478600001)(4743002)(86362001)(235185007)(33656002)(36756003)(81166007)(6916009)(8886007)(4326008)(44832011)(6666004)(70206006)(8936002)(47076005)(70586007)(82310400003)(7696005)(66616009)(956004)(2906002)(5660300002)(8676002)(26005)(33964004)(2616005)(44144004)(336012)(316002)(1076003)(356005)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2020 13:36:45.8704 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 625c36e5-e6e7-43c4-3298-08d8ab359ed5 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: AM5EUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4382 X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, 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 fixes an issue where is_linear_load_p could return the incorrect permutation kind because it is singe pass. This arranges the candidates in such a way that there won't be any ambiguity so that the function can still be linear but give correct values. 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 (is_linear_load_p): Fix ambiguity. --- inline copy of patch -- diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c index fede88923af8521ee4954c8ae27b0e589f975610..7fd79d91c6ba4ccdbf361307a6105fb7e46aa961 100644 diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c index fede88923af8521ee4954c8ae27b0e589f975610..7fd79d91c6ba4ccdbf361307a6105fb7e46aa961 100644 --- a/gcc/tree-vect-slp-patterns.c +++ b/gcc/tree-vect-slp-patterns.c @@ -140,32 +140,32 @@ is_linear_load_p (load_permutation_t loads) unsigned load, i; complex_perm_kinds_t candidates[4] - = { PERM_EVENODD - , PERM_ODDEVEN - , PERM_ODDODD + = { PERM_ODDODD , PERM_EVENEVEN + , PERM_EVENODD + , PERM_ODDEVEN }; int valid_patterns = 4; - FOR_EACH_VEC_ELT_FROM (loads, i, load, 1) + FOR_EACH_VEC_ELT (loads, i, load) { - if (candidates[0] != PERM_UNKNOWN && load != i) + if (candidates[0] != PERM_UNKNOWN && load != 1) { candidates[0] = PERM_UNKNOWN; valid_patterns--; } - if (candidates[1] != PERM_UNKNOWN - && load != (i % 2 == 0 ? i + 1 : i - 1)) + if (candidates[1] != PERM_UNKNOWN && load != 0) { candidates[1] = PERM_UNKNOWN; valid_patterns--; } - if (candidates[2] != PERM_UNKNOWN && load != 1) + if (candidates[2] != PERM_UNKNOWN && load != i) { candidates[2] = PERM_UNKNOWN; valid_patterns--; } - if (candidates[3] != PERM_UNKNOWN && load != 0) + if (candidates[3] != PERM_UNKNOWN + && load != (i % 2 == 0 ? i + 1 : i - 1)) { candidates[3] = PERM_UNKNOWN; valid_patterns--;