From patchwork Fri Mar 19 14:03:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1455877 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; 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=tQ9m+i6a; 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 4F25Jy53R3z9sVt for ; Sat, 20 Mar 2021 01:05:53 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 269EE385801A; Fri, 19 Mar 2021 14:05:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 269EE385801A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1616162750; bh=PuyZAGafeldp41j1xp+vnxp4TfHtvdA9H7vLyVCphkY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=tQ9m+i6avyKh7f1vpZijtkEQ3XE8uXsH8IbWLOdqfBww0FVo3mvd3bDgJMvekySyW lbtX2aWDcnaufAdVFZcaw37cpg+XxuwivwFIh4UORbrzG/XsEkWwJ8uinwzzwRL0Aq rZ0kz4BvRS1H9tZzJZUMc6ieHsIC7Nnxuo8bQ3Gk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80049.outbound.protection.outlook.com [40.107.8.49]) by sourceware.org (Postfix) with ESMTPS id 0A54B385801A for ; Fri, 19 Mar 2021 14:05:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0A54B385801A Received: from MR1P264CA0017.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:2e::22) by VI1PR08MB3805.eurprd08.prod.outlook.com (2603:10a6:803:ba::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Fri, 19 Mar 2021 14:05:39 +0000 Received: from VE1EUR03FT003.eop-EUR03.prod.protection.outlook.com (2603:10a6:501:2e:cafe::d) by MR1P264CA0017.outlook.office365.com (2603:10a6:501:2e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Fri, 19 Mar 2021 14:05:37 +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 VE1EUR03FT003.mail.protection.outlook.com (10.152.18.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Fri, 19 Mar 2021 14:05:37 +0000 Received: ("Tessian outbound 259fb7427a57:v87"); Fri, 19 Mar 2021 14:05:36 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0a6d2cd163cbb31b X-CR-MTA-TID: 64aa7808 Received: from b6985b62a0be.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 29B0BB15-953B-4BD4-BADF-444200E607B4.1; Fri, 19 Mar 2021 14:03:36 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b6985b62a0be.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 19 Mar 2021 14:03:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n76+yp0Ee1BaTNzUzBDUei3mXpfCY8n1p0q36MCjQi+H9mxT7MP/v3bTJ8uKjljtfvGrJ0W3y2Z4fC9ug/A1M91Cr4BuSykuPNAcuhCQ4grWm8Cen6ym2WZMbHsaiA7QvJQdnZfBW+KILqo9nApmpgjR35KkprRa7I1VON4Y38ii5S0dAtx1Kl/WPQGdfD3uCVwANH8GSHBlrhpieQtiiEN44OtUtDKw7NHo2eyOLKCTq8KQHkHD6P4jU0P0gCS+Idgg8klliaPvTeiyB0dY7OC1zlT41P5nPl1sPsAn4KAjaYwlt02KLGCchprFk1etOoAwHry1XjTM78O93FyVkQ== 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=PuyZAGafeldp41j1xp+vnxp4TfHtvdA9H7vLyVCphkY=; b=NnxPV4ugOZCMmmZ4KOWbhOR+694jNOZo33q1XMBM52kZ1xeTu+6+vxW3B75jCt9Cqf7FwZV+dzWdV7eWAZNWC3uDYfB9/vmf1YMYcV3cXEt9lnwuYB4B5TtZTJwH1QxV8abDfUuOs1hvqCRpBdBC6fEYN+2TyNRNBUJbZGtFVL5hKuDfwWVfQFGX9CJLF9TY70KZuc3glPkS3T+mltXOI7FDTiKiWciWiBYE/UmXs8vSwkkZbn6ewtBn4vuv4fxYakgk/7BVofyR5vJ1f0PIJakrqYOoqO+Gw2s8cM95TlonuBdO2qIV2hUfNz7LOYDFB04cw8QQrzTwiR3W6YT8GA== 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 VI1PR08MB2703.eurprd08.prod.outlook.com (2603:10a6:802:25::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Fri, 19 Mar 2021 14:03:34 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::ed1e:9499:4501:2118]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::ed1e:9499:4501:2118%9]) with mapi id 15.20.3933.032; Fri, 19 Mar 2021 14:03:34 +0000 Date: Fri, 19 Mar 2021 14:03:30 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH] slp: remove unneeded permute calculation (PR99656) Message-ID: Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: CWLP123CA0024.GBRP123.PROD.OUTLOOK.COM (2603:10a6:401:56::36) 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.51) by CWLP123CA0024.GBRP123.PROD.OUTLOOK.COM (2603:10a6:401:56::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32 via Frontend Transport; Fri, 19 Mar 2021 14:03:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0d0a2203-8cdc-46f9-1c1e-08d8eae01239 X-MS-TrafficTypeDiagnostic: VI1PR08MB2703:|VI1PR08MB3805: 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: BNDtUb7y8sCkPgC6T5AYGsPP6JeWZMYT1jiWJBPg+lAgAZs0bfhxmxuwi9gOB2T2kwSDdwpFqHYCN83F9MsTGZgKuqo6c0hvGte6bhpqmn/KpvAy1f7Ms3Y0JJM8Th2GjjT4FJiHq6aKVGfCyIWgsD3tCKBzeDEZcdcZG30R5hYR9AIu0C2fADhZycx9zb/NP5/cOEm7IF6ZDr1+3YKv0B+1iQsh6uRy4VvhGw7HqjND82kIk/GzHHmkyhZ2G7ikRQeramIETBeYtwdId6ckAAWIoGpoyVlBdXWTjA37Z8/knr9mpXBdXPYiDCLE3eNaqhEO0h4Q/JQPo4O66VoPZnkG34fpXCKgxf4qnEevlmhuTB95JzZuG/ZMWeBny9b4PQmoH9MCdtpvX22eNpNxy3YmA08p+tpxLfiDREBtF3J4pbjPsK17ytgAcWlhPAFzH0afdnrmJPSR38/rG8PyonZGfbpgoJWQNPPpDlwDjmDgziS7tZ/M7DFwMZ52OD0XkbX54I/KHyQl5jKpI/ERYS1+OkbiqenkLnjX7HSSvrvz+8P4XazBg/YiEIym31ZMBf9vaLZDcjD+djeVg1FSgqQ9H5sFyBWR09PffjeFE0arNIgSCeWJYl5sojQ1BFPuEBD4WMG23mWd0IL3GaFrC+1f5sg84MYlh8GmHohRMB55dlt8Usl8dvMa03bwzkpDPfXE1IcA9NQSiON/bnvcrA== 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)(346002)(39850400004)(136003)(376002)(366004)(5660300002)(36756003)(186003)(44144004)(16526019)(4743002)(956004)(2616005)(235185007)(2906002)(316002)(52116002)(33964004)(4326008)(83380400001)(66616009)(478600001)(66946007)(7696005)(8936002)(44832011)(8676002)(6916009)(26005)(66556008)(38100700001)(55016002)(66476007)(86362001)(8886007)(4216001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?oXG3JDSOaMmotNc4IhpSU/bJBW0q9z?= =?utf-8?q?TFFmFogJK4R6MejWa8/iUeH+hpviGPxZTl8J0kOWzTQPmpCtb9Zt06ehP098ST78w?= =?utf-8?q?2pbjJEOHDAYmTP8+fVuEWOPWC9BEHS0gMN8lgGx9fj0Adi9KYkYLRGsVFq+5IfsLF?= =?utf-8?q?U5o0zGSrql+kffdzIqEiu3Pkq7yakb46hxPqM7/HZ9QGGzLcOv4xe0uvrKnJthNcw?= =?utf-8?q?m8auzFcB7gYmNBYKn4BbAn4+Z2UwhdQkU0swWBa2vrodM3PHnKGeBeEzi+6fJ0qCn?= =?utf-8?q?wKNd+LxWmKroJMyjBUBTi3WDSm42UUVuOjwbwX9lbcQFfiNlHTctBV4ZFcnHg7Td7?= =?utf-8?q?GO4LtBmlKp4o/jGgJx3U3F9rrtTeg/3utNB31jUKynqcSh45dhnMbBIzStPdmxk/C?= =?utf-8?q?TPFis7sJEfiyTRgv2pLwk+qMJfhhS7mPfHYsFg2jKPwBc1ZRWHMu5E/GyqcffWrVM?= =?utf-8?q?5qq6xyP9CzvfkD/bf2jJUqg33BhE89Sokugjx4EvlVl703xph1xNTZzfBJbdkTOSW?= =?utf-8?q?ybqVwtdpDXoBP7jU+oquQLXEf0Pcd6PbwFFYlY885EAlOdcwzsaBcw+mD2RHNBkkV?= =?utf-8?q?pnXwZbfzpSpkt0acEe1AoN6dACqywCLQKwLnfK7Un+mWIvK8GhgqzSCtND+p8ZGcf?= =?utf-8?q?MSSeSizHKHczOXFZlKhb5lQEa5GtKibqBXj5QtaWt+xh5dUAL9ZK1gFQR47RE9/8p?= =?utf-8?q?EB+AkdWdGqdmBWC/o8FUly2YZP4DNEKbptCYQaQo6JSNjM9qjbvDNHGVDtcJoiELt?= =?utf-8?q?SnPm35fhY05Nf8B7Kp1kCHRKtn6S+DTWPk/WTjvC6ViOHab0YJU2FtEjsyAacoY2R?= =?utf-8?q?H1HR8rFCY22qFPFxwKoN62TpE83dOEUW16hYPalbNTi4FXtkqRpC1DGTGuJqLPZce?= =?utf-8?q?pYoyDoNRwFGqNQvHEOtZygZibN53ovUAI4z+aL2bYdQxOw896/oo3JJPIj76tGkP8?= =?utf-8?q?agfO2njnBilL1zXAWTHbVHk3jBwcZUp8n+iR5HwDD7WEgGquENgOmZBz1AIhLZAIY?= =?utf-8?q?BiT19Qea/e+ZjrMC1wR6jpPVoxl/vZWOzQrQ+d7UKwQUyd2/YtdGihGOOiseMF0pT?= =?utf-8?q?/wR4CdgWfGbF8UHIN8L0wfDEC/80bxpCC8U8czni6UJu9CnRnGtQZ7QMiM3q7YarM?= =?utf-8?q?f17wOU2FiacMwk3AUXfdsp0UvCiibr0n19sV9URYKBSUwSnI3mSGIZX9Gvg51dUov?= =?utf-8?q?k6NqmThAR35BaooKuMyOQPzLP5E6byxvZhEMkOhhNBQew/OFM/pfPWepqgm7Yh+45?= =?utf-8?q?rdOtAdwlB5z7zI?= X-MS-Exchange-Transport-Forked: True X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB2703 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: VE1EUR03FT003.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 577dc93f-e895-44d9-a690-08d8eadfc830 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QK/+Y/cJ7nKoqZCUbTxHfaRaKng5WhVDP/hM9ErAKhikypc9iaxSL96Xq2hUIwb6VoMs4NSTzFEGWVv1lUVhIKd/dLqgoqgymafo0byMtS0tLdmfuZInM8AcKspL54wb5DYDmnvGM+8JNc2YXvCF+1lZdKQ3hpi1aggh7ATDNl03eTBP++bvpIGjfc3ce8gpbJzcXub/DnItrt11YJtxsFszLCKjtgAxlz479alsyHah6Nq7PAe6WoWQ8rZd64KJGE95k6jMHyo7rDcTFatXj1vCe+12WP4daJH+BDqtsJHIGmDS5CnxgLsHKkt4IFD7uGaKjsG7LEr2nXvyCgi41N90s/FBrJ028D3urLXaEGVvTEQYhmKgd+4kHIeJ0STxlWPa2c7VzMIoz5pC9E/gqshBU5NohFt229A8djBq1x9+kdkbaCIbUx3ADRywPEWBPmbojK5QnQhP5AcBrJtIG5+pvZHmNhWdwPkarFaQ7Bll+q4gZ7PGjqB72yVUq8uBVuR8zXYP4zeTGakWckhLIkQiSYsQ1Aejoak3x4zI/MkH///J9zB8wbhIYnR6XQhcyWvqavhEVQIki4vrz6q/6NXoeGUHJFoQQ4EHPMA3/pAbGRHIV3Ka4vkpMskoT/9cnbUTmImuWI95SOXDQCwdd3ihduoujmHAYL8HpZUuHRU5sATy+P+Dj2pkLpZDjMnsAZ+dsdY56M4ykGgNwqJcdA== 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)(376002)(136003)(396003)(39850400004)(346002)(46966006)(36840700001)(44832011)(107886003)(7696005)(956004)(2616005)(478600001)(83380400001)(36860700001)(6916009)(55016002)(16526019)(316002)(82740400003)(4743002)(47076005)(26005)(235185007)(186003)(81166007)(70206006)(86362001)(5660300002)(8886007)(8676002)(66616009)(82310400003)(8936002)(36756003)(2906002)(336012)(33964004)(44144004)(356005)(4326008)(70586007)(4216001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2021 14:05:37.0469 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0d0a2203-8cdc-46f9-1c1e-08d8eae01239 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: VE1EUR03FT003.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3805 X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, 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 Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi Richi, The attach testcase ICEs because as you showed on the PR we have one child which is an internal with a PERM of EVENEVEN and one with TOP. The problem is while we can conceptually merge the permute itself into EVENEVEN, merging the lanes don't really make sense. That said, we no longer even require the merged lanes as we create the permutes based on the KIND directly. This patch just removes all of that code. Unfortunately it still won't vectorize with the cost model enabled due to the blend that's created combining the load and the external note: node 0x51f2ce8 (max_nunits=1, refcnt=1) note: op: VEC_PERM_EXPR note: { } note: lane permutation { 0[0] 1[1] } note: children 0x51f23e0 0x51f2578 note: node 0x51f23e0 (max_nunits=2, refcnt=1) note: op template: _16 = REALPART_EXPR <*t1_9(D)>; note: stmt 0 _16 = REALPART_EXPR <*t1_9(D)>; note: stmt 1 _16 = REALPART_EXPR <*t1_9(D)>; note: load permutation { 0 0 } note: node (external) 0x51f2578 (max_nunits=1, refcnt=1) note: { _18, _18 } which costs the cost for the load-and-split and the cost of the external splat, and the one for blending them while in reality it's just a scalar load and insert. The compiler (with the cost model disabled) generates ldr q1, [x19] dup v1.2d, v1.d[0] ldr d0, [x19, 8] fneg d0, d0 ins v1.d[1], v0.d[0] while really it should be ldp d1, d0, [x19] fneg d0, d0 ins v1.d[1], v0.d[0] but that's for another time. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: PR tree-optimization/99656 * tree-vect-slp-patterns.c (linear_loads_p, complex_add_pattern::matches, is_eq_or_top, vect_validate_multiplication, complex_mul_pattern::matches, complex_fms_pattern::matches): Remove complex_perm_kinds_t. * tree-vectorizer.h: (complex_load_perm_t): Removed. (slp_tree_to_load_perm_map_t): Use complex_perm_kinds_t instead of complex_load_perm_t. gcc/testsuite/ChangeLog: PR tree-optimization/99656 * gfortran.dg/vect/pr99656.f90: New test. --- inline copy of patch -- diff --git a/gcc/testsuite/gfortran.dg/vect/pr99656.f90 b/gcc/testsuite/gfortran.dg/vect/pr99656.f90 new file mode 100644 index 0000000000000000000000000000000000000000..59a28ee19e8f352d534e51558a7fce5c4d78100e diff --git a/gcc/testsuite/gfortran.dg/vect/pr99656.f90 b/gcc/testsuite/gfortran.dg/vect/pr99656.f90 new file mode 100644 index 0000000000000000000000000000000000000000..59a28ee19e8f352d534e51558a7fce5c4d78100e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr99656.f90 @@ -0,0 +1,24 @@ +! { dg-do compile { target { aarch64*-*-* } } } +! { dg-require-effective-target le } +! { dg-additional-options "-march=armv8.3-a -O1 -ftree-slp-vectorize" } + +SUBROUTINE ZLAHQR2(H, LDH, H22, T1) + + INTEGER LDH + COMPLEX*16 H(LDH, *) + + INTEGER NR + COMPLEX*16 H22, SUM, T1, V2 + + COMPLEX*16 V( 3 ) + + EXTERNAL ZLARFG + INTRINSIC DCONJG + + V2 = H22 + CALL ZLARFG(T1) + SUM = DCONJG(T1) * H(1, 1) + H(1, 1) = SUM * V2 + + RETURN +END diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c index 1e2769662a54229ab8e24390f97dfe206f17ab57..85f2d03754d3ed87e4e34befdca417f2dd4ea21d 100644 --- a/gcc/tree-vect-slp-patterns.c +++ b/gcc/tree-vect-slp-patterns.c @@ -203,68 +203,49 @@ vect_merge_perms (complex_perm_kinds_t a, complex_perm_kinds_t b) /* Check to see if all loads rooted in ROOT are linear. Linearity is defined as having no gaps between values loaded. */ -static complex_load_perm_t +static complex_perm_kinds_t linear_loads_p (slp_tree_to_load_perm_map_t *perm_cache, slp_tree root) { if (!root) - return std::make_pair (PERM_UNKNOWN, vNULL); + return PERM_UNKNOWN; unsigned i; - complex_load_perm_t *tmp; + complex_perm_kinds_t *tmp; if ((tmp = perm_cache->get (root)) != NULL) return *tmp; - complex_load_perm_t retval = std::make_pair (PERM_UNKNOWN, vNULL); + complex_perm_kinds_t retval = PERM_UNKNOWN; perm_cache->put (root, retval); /* If it's a load node, then just read the load permute. */ if (SLP_TREE_LOAD_PERMUTATION (root).exists ()) { - retval.first = is_linear_load_p (SLP_TREE_LOAD_PERMUTATION (root)); - retval.second = SLP_TREE_LOAD_PERMUTATION (root); + retval = is_linear_load_p (SLP_TREE_LOAD_PERMUTATION (root)); perm_cache->put (root, retval); return retval; } else if (SLP_TREE_DEF_TYPE (root) != vect_internal_def) { - retval.first = PERM_TOP; + retval = PERM_TOP; perm_cache->put (root, retval); return retval; } - auto_vec all_loads; complex_perm_kinds_t kind = PERM_TOP; slp_tree child; FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (root), i, child) { - complex_load_perm_t res = linear_loads_p (perm_cache, child); - kind = vect_merge_perms (kind, res.first); + complex_perm_kinds_t res = linear_loads_p (perm_cache, child); + kind = vect_merge_perms (kind, res); /* Unknown and Top are not valid on blends as they produce no permute. */ - retval.first = kind; + retval = kind; if (kind == PERM_UNKNOWN || kind == PERM_TOP) return retval; - all_loads.safe_push (res.second); } - if (SLP_TREE_LANE_PERMUTATION (root).exists ()) - { - lane_permutation_t perm = SLP_TREE_LANE_PERMUTATION (root); - load_permutation_t nloads; - nloads.create (SLP_TREE_LANES (root)); - nloads.quick_grow (SLP_TREE_LANES (root)); - for (i = 0; i < SLP_TREE_LANES (root); i++) - nloads[i] = all_loads[perm[i].first][perm[i].second]; - - retval.first = kind; - retval.second = nloads; - } - else - { - retval.first = kind; - retval.second = all_loads[0]; - } + retval = kind; perm_cache->put (root, retval); return retval; @@ -704,11 +685,11 @@ complex_add_pattern::matches (complex_operation_t op, vec children = SLP_TREE_CHILDREN ((*ops)[0]); /* First node must be unpermuted. */ - if (linear_loads_p (perm_cache, children[0]).first != PERM_EVENODD) + if (linear_loads_p (perm_cache, children[0]) != PERM_EVENODD) return IFN_LAST; /* Second node must be permuted. */ - if (linear_loads_p (perm_cache, children[1]).first != PERM_ODDEVEN) + if (linear_loads_p (perm_cache, children[1]) != PERM_ODDEVEN) return IFN_LAST; if (!vect_pattern_validate_optab (ifn, *node)) @@ -795,9 +776,9 @@ vect_normalize_conj_loc (vec args, bool *neg_first_p = NULL) /* Helper function to check if PERM is KIND or PERM_TOP. */ static inline bool -is_eq_or_top (complex_load_perm_t perm, complex_perm_kinds_t kind) +is_eq_or_top (complex_perm_kinds_t perm, complex_perm_kinds_t kind) { - return perm.first == kind || perm.first == PERM_TOP; + return perm == kind || perm == PERM_TOP; } /* Helper function that checks to see if LEFT_OP and RIGHT_OP are both MULT_EXPR @@ -828,7 +809,7 @@ vect_validate_multiplication (slp_tree_to_load_perm_map_t *perm_cache, /* Canonicalization for fms is not consistent. So have to test both variants to be sure. This needs to be fixed in the mid-end so this part can be simpler. */ - kind = linear_loads_p (perm_cache, right_op[0]).first; + kind = linear_loads_p (perm_cache, right_op[0]); if (!((is_eq_or_top (linear_loads_p (perm_cache, right_op[0]), PERM_ODDODD) && is_eq_or_top (linear_loads_p (perm_cache, right_op[1]), PERM_ODDEVEN)) @@ -839,7 +820,7 @@ vect_validate_multiplication (slp_tree_to_load_perm_map_t *perm_cache, } else { - if (linear_loads_p (perm_cache, right_op[1]).first != PERM_ODDODD + if (linear_loads_p (perm_cache, right_op[1]) != PERM_ODDODD && !is_eq_or_top (linear_loads_p (perm_cache, right_op[0]), PERM_ODDEVEN)) return false; @@ -852,15 +833,15 @@ vect_validate_multiplication (slp_tree_to_load_perm_map_t *perm_cache, /* Check if the conjugate is on the second first or second operand. The order of the node with the conjugate value determines this, and the dup node must be one of lane 0 of the same DR as the neg node. */ - kind = linear_loads_p (perm_cache, left_op[index1]).first; + kind = linear_loads_p (perm_cache, left_op[index1]); if (kind == PERM_TOP) { - if (linear_loads_p (perm_cache, left_op[index2]).first == PERM_EVENODD) + if (linear_loads_p (perm_cache, left_op[index2]) == PERM_EVENODD) return true; } else if (kind == PERM_EVENODD) { - if ((kind = linear_loads_p (perm_cache, left_op[index2]).first) == PERM_EVENODD) + if ((kind = linear_loads_p (perm_cache, left_op[index2])) == PERM_EVENODD) return false; return true; } @@ -1003,7 +984,7 @@ complex_mul_pattern::matches (complex_operation_t op, left_op.safe_splice (SLP_TREE_CHILDREN (muls[0])); right_op.safe_splice (SLP_TREE_CHILDREN (muls[1])); - if (linear_loads_p (perm_cache, left_op[1]).first == PERM_ODDEVEN) + if (linear_loads_p (perm_cache, left_op[1]) == PERM_ODDEVEN) return IFN_LAST; bool neg_first = false; @@ -1035,7 +1016,7 @@ complex_mul_pattern::matches (complex_operation_t op, ops->truncate (0); ops->create (3); - complex_perm_kinds_t kind = linear_loads_p (perm_cache, left_op[0]).first; + complex_perm_kinds_t kind = linear_loads_p (perm_cache, left_op[0]); if (kind == PERM_EVENODD) { ops->quick_push (left_op[1]); @@ -1356,7 +1337,7 @@ complex_fms_pattern::matches (complex_operation_t op, ops->truncate (0); ops->create (4); - complex_perm_kinds_t kind = linear_loads_p (perm_cache, right_op[0]).first; + complex_perm_kinds_t kind = linear_loads_p (perm_cache, right_op[0]); if (kind == PERM_EVENODD) { ops->quick_push (child); diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index b861c97ab3aef179ba9b2900701cf09e75a847a5..9861d9e88102138c0e2de8dfc34422ff65a0e9e0 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -2059,13 +2059,8 @@ typedef enum _complex_perm_kinds { PERM_TOP } complex_perm_kinds_t; -/* A pair with a load permute and a corresponding complex_perm_kind which gives - information about the load it represents. */ -typedef std::pair - complex_load_perm_t; - /* Cache from nodes to the load permutation they represent. */ -typedef hash_map +typedef hash_map slp_tree_to_load_perm_map_t; /* Vector pattern matcher base class. All SLP pattern matchers must inherit