From patchwork Fri Sep 25 14:27:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1371335 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=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=5GrfG+dj; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=5GrfG+dj; 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 4ByZ4h3RLHz9sR4 for ; Sat, 26 Sep 2020 00:27:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 977E0398B43E; Fri, 25 Sep 2020 14:27:26 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2074.outbound.protection.outlook.com [40.107.20.74]) by sourceware.org (Postfix) with ESMTPS id 45804394504E for ; Fri, 25 Sep 2020 14:27:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 45804394504E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Tamar.Christina@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NTlBkBst2QgHxiwxC1qsvvQVnLzBi1cd8RYhAi1bwgM=; b=5GrfG+djN/qBz77RKxZ35y+kVkQoYzYr/XOycygUaGRiw3ZE7L3dNX9yIffxO+QNg1DyeWyVecAzKo9IgrCz2b4OtHO3NtWZInxL4HmxuoKzMvMXdZP4PZHbJtsCh4IeACWpHG1Pl3LTY60NzvHKRwONH0HOGvAvcExHEm1PfPY= Received: from AM6PR10CA0020.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:89::33) by HE1PR0802MB2186.eurprd08.prod.outlook.com (2603:10a6:3:c2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Fri, 25 Sep 2020 14:27:20 +0000 Received: from AM5EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:89:cafe::31) by AM6PR10CA0020.outlook.office365.com (2603:10a6:209:89::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Fri, 25 Sep 2020 14:27:20 +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=bestguesspass 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 AM5EUR03FT041.mail.protection.outlook.com (10.152.17.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Fri, 25 Sep 2020 14:27:20 +0000 Received: ("Tessian outbound 34b830c8a0ef:v64"); Fri, 25 Sep 2020 14:27:20 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e74e1c5df3209167 X-CR-MTA-TID: 64aa7808 Received: from e1568830dfaa.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 8BD16C36-DE1A-4CCE-9566-67E1BC3C47EF.1; Fri, 25 Sep 2020 14:27:13 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e1568830dfaa.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 25 Sep 2020 14:27:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Oa1DBkb4ctr5wKlOqUuCzpXbcIL+lQthpqKlMN4Sm9NGf8am9uldk1nPU6qqu563bg2vOHAN39YDSV3FkAm27jGIMe9MZdxSSXx04mXzaE860Q2IHAQkJl/oO2xMk7wzAlsFXpWY0vqXaOYtQpLRtYCTSWnCBSG7S1lSEVimp15F9FcVpu56UFqmvaeI0dBMTxt1wGz9OevvVCgQsG7X3j8qy8aA+ftL1com4rZteRJ3NscntcLiF6JmGVYlG6Akno0eeF6UHcTaeq29tE7Ai6DyI58ETFxoxpjkex6CRY9ymq0covbfU/8EyzG5D/mvGQ74HyRlGbrN3maXtwtljQ== 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=NTlBkBst2QgHxiwxC1qsvvQVnLzBi1cd8RYhAi1bwgM=; b=UISddP6Cic2aLONaHE8OfEGaKXr33zmYGrObN88b0KNlZp1fVapZH6IrKRUY8zv1wFFeukpHDSa5Y31f02UdXD8cuYrAWJcCgYOIjSy5TGIxaEvuvbFQueoixpbumCF5LyaG+y4JN/cQhfEwV/lhsjy1C2v2sKX45tkyzrp5+hVHjR1bRMjRmAKGJRimj9MWWHyX1mpIHZNz83Pju37J9ZO9R6TFtUC/paFNW7L34liOpdg/oY4oMN+XoOIoiVhCEBfJ/+RfHyFHfsSQMp1cpjLd0DejF/5kjkQr6FVpZnZBn3pK1W9aozeSCROB8ZTaQyb3Ujmadmasi2bYgmRHdw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NTlBkBst2QgHxiwxC1qsvvQVnLzBi1cd8RYhAi1bwgM=; b=5GrfG+djN/qBz77RKxZ35y+kVkQoYzYr/XOycygUaGRiw3ZE7L3dNX9yIffxO+QNg1DyeWyVecAzKo9IgrCz2b4OtHO3NtWZInxL4HmxuoKzMvMXdZP4PZHbJtsCh4IeACWpHG1Pl3LTY60NzvHKRwONH0HOGvAvcExHEm1PfPY= 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 VE1PR08MB5678.eurprd08.prod.outlook.com (2603:10a6:800:1a0::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.11; Fri, 25 Sep 2020 14:27:12 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::d0e7:49cd:4dae:a2a2]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::d0e7:49cd:4dae:a2a2%7]) with mapi id 15.20.3412.024; Fri, 25 Sep 2020 14:27:12 +0000 Date: Fri, 25 Sep 2020 15:27:09 +0100 From: Tamar Christina To: gcc-patches@gcc.gnu.org Subject: [PATCH v2 0/16][RFC][AArch64/Arm/SVE/SVE2/MVE]middle-end Add support for SLP vectorization of complex number instructions. Message-ID: <20200925142704.GA9928@arm.com> Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: LNXP265CA0001.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::13) 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 LNXP265CA0001.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Fri, 25 Sep 2020 14:27:11 +0000 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2f50e31c-9ef3-4120-10b2-08d8615f1c80 X-MS-TrafficTypeDiagnostic: VE1PR08MB5678:|HE1PR0802MB2186: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: ygyjihB223NohqiIjmXYX5tygSgAzIparEI2F3adTNmILhzvrJTnMG3bc0fEwWptVh17i0vjks/cgWGxcQUbfg8+Bf/rgFDrChAhURW1+PS5xqRwOEBhIOLKCk7/n+dE6XcHwKJ+tdEg19hmPrwH3r/hAd+5EYprK0kq4wmJKpLpYpj6gteN7BzdURLzu+ocu4OCSaZRoCPo1VH4aJxNarb25AtAIUe6ciK72rN4GzEYmxUhzCM+2CGDxVAYUE3dQUvPMgcir3Nbn1jnveeIezAJzLqZE2wgRSr2a9kI0FHovnl2QKbJW7dumZ2qWL0tM69QbVC3YcGknhyLswRz1MXb7PwirW+Q1nH/JmxZJQWN3MHCvzFjHEpDaZraUnW9bgOQ7Ky9+JnX9ERkea3xlmRzvydldik5rVxL9cJIr8+105IWMLwcrxAKA1aFEGdTJdx1ODdduDl6lp7qJEUHSleHMfXYEciqmefuqxv7UYDUCTdvWhk4BxYviM8vV2QM 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)(366004)(136003)(39860400002)(346002)(376002)(8936002)(1076003)(55016002)(33656002)(8886007)(66946007)(66556008)(86362001)(66616009)(83380400001)(36756003)(66476007)(478600001)(6916009)(235185007)(44144004)(5660300002)(16526019)(186003)(4326008)(33964004)(52116002)(44832011)(7696005)(316002)(2616005)(966005)(26005)(2906002)(8676002)(956004)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: z/3NMwoYakphJexsdhfxMZtmN47xeOFSGv9BUEcySRSXahp7BmDtGKCo+CyF3p8ix71PNh75bEMSDjqhfjv5d1hEuQkye++KVBodxTW4FgpfasYeIwnDGlja01UzlF/+k34aFbUy5uXA3aaA93w4GYQSNQ15AZQPaqfaMUKLBxKRRbFmUNmqL0CKBOuVXqe1YXQbw78JQbj3T95o130KCBISh17prmuEOpJtlhqUDvZzazq5sH1MqvA/JHQnkvaOSePbdeSEwt8FbqvbyxKjwoNl7bRt+pVdq1qQyDL0nYAkwmp3D0YeFPJUFw6XBomUor+PUifxi2MrBggWYzLg54ZJCcKAinQM2/8PI/rp1ZLo0FyK/pgLZELMLZ8Ejqfi0m1sB2XMEw6rqaY9IUhAgCbQvEjStEW+DVkibGYPnG27bn2QStfuCzAuqEZdZ/xxwxMquA9ZEeAlWbOEmkSZRYXLnRn2yZD30XbnSZlKzmsCL3Kbh739NStV+KuYNaiiA8zuZA9t74NGo2+sDDjolnijgMudqwvvIxbnro6NS8jSXwes0MD2W6nbaXPjohjb+PhDikRBK+vu4006ATdWFZXxgKQik4xWjsVr+3UD1JBso5yuRGUwmmJJpVi8aatWqJ6nu7HdrcKpnFk/DHdLCA== X-MS-Exchange-Transport-Forked: True X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5678 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: AM5EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 7e7d5c39-9cd3-4b93-e035-08d8615f179a X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: L+cRNMxz1Qc1Kp2oojW/n5Ceee4+MoZhELaKTyH1ZkLH0iv683d/lKrRGCYCuiUQwJ4WhQ6QoQiXPa21t/YMfxy1vMhq+4B0u/ULCXosUSqk1fbkQjoO05JymJBmV0Srdae8w2eyadTKiacDjXitpCYqUi1ST2fn7DFROeljEl6u50E0L6Y19oImnzvPfklJm4YSoiHkGvJbs7UIBrI1KftP0KcVyxL6f2AM3hsiAlyBLwu9wG4RNMfM+eHyUsH2bl6VW5o9DnGCVsPi6VmgBArsNtzyxVaZgI0VQbkkFFcLDEYKFGfLQfyuK5rweb28b8GQ86LiKSVYt4QQDlYfpTbiv8FEaKpFetaRMiQbxbYN6DGAU/37ZfxVImU2ekBHoKy6Cs9DIc0YLHQEVOI6Q7f2GnrvRJEEt3C5vHPp1hZ5DbcaXL9aZGj2sNMb0JZ9dA+UQA+qQ419qQQrcdpbPSiedirGTgVsZoosarUdworryJRTda0fLMVvn3L0D0rmL2yLa2uk7tmLSGW2Y86rTSVVNxwDzCAPY3Od9yYFQt8td6r9lX1nkgpHjSZClfDg 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)(39860400002)(136003)(346002)(376002)(396003)(46966005)(82740400003)(8886007)(5660300002)(316002)(4326008)(47076004)(36906005)(966005)(36756003)(2906002)(70586007)(81166007)(33656002)(83380400001)(478600001)(1076003)(44832011)(86362001)(2616005)(235185007)(8676002)(6916009)(956004)(33964004)(55016002)(82310400003)(336012)(44144004)(7696005)(16526019)(356005)(8936002)(70206006)(26005)(66616009)(186003)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2020 14:27:20.0307 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f50e31c-9ef3-4120-10b2-08d8615f1c80 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: AM5EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2186 X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, 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: , Cc: nd@arm.com, rguenther@suse.de, ook@ucw.cz Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi All, This patch series adds support for SLP vectorization of complex instructions [1]. These instructions exist only in their vector forms and require you to recognize two statements in parallel. Complex operations usually require a permute due to the fact that the real and imaginary numbers are stored intermixed but these vector instructions expect this and no longer need the compiler to generate a permute. For this reason the pass also re-orders the loads in the SLP tree such that they become contiguous and no longer need the permutes. The Basic Blocks are left untouched such that the scalar loop will still correctly issue permutes. The instructions also support rotations along the Argand plane, as such the operands have to be re-ordered to coincide with their load group. For now, this patch only adds support for: * Complex Addition with rotation of 0 and 180. * Complex Multiplication and Multiplication where one operand is conjucated. * Complex FMA and FMA where one operand is conjucated. * Complex FMS and FMS where one operand is conjucated. Complex dot-product is not currently supported in this patch set as build_slp fails for it. This will be provided as a future patch. These are supported for both integer and floating point and as such these don't look for real or imaginary pairs but instead rely on the early lowering of complex numbers by GCC and canonicazation of the operations such that it just recognizes any instruction sequence matching the operations requested. To be safe when the it is not sure it can support the operation or if it finds something it does not understand it backs off. This patch is an RFC and I am looking on feedback on the approach. Particularly this series has one problem which is when it is decided that SLP is not viable and that the normal loop vectorizer is to be used. In this case I dissolve the changes but the compiler crashes because the use of pattern matcher essentially undoes two_operands. This means that the number of copies needed when using the patterns and when not are different. When using the patterns the two operands become the same and so are treated as manually unrolled loops. The problem is that because nunits has already been decided along with the unroll factor. When the dissolved statements are then analyzed they fail. This is also the reason why I cannot analyze both the pattern and original statements initially. The relavent placed in the source code have comments describing the problem. [1] https://developer.arm.com/documentation/ddi0487/fc/ Thanks, Tamar