From patchwork Fri Dec 17 15:42:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 49051 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D285C385842D for ; Fri, 17 Dec 2021 15:43:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D285C385842D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1639755831; bh=pUwn1hIO12fvOVQK2C6u1grfJzlw8jK7Rg4LngjtceI=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=KcxfbBB3yHzrtTNksFF2mQXGV5R7dLJnYpWnC9nvV3PsRu0ikQoiy+ZEldNbyK5qf v+99MagTg2p95dD+q6/ttY6JtV+BAcuIVZiaMzDR4ttmKfp/Mp7YpHJkrsPczYLhoO dlWyn7lTuoaeF06/3Pw6/CrChKSol68L2Pa4ihgk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00082.outbound.protection.outlook.com [40.107.0.82]) by sourceware.org (Postfix) with ESMTPS id EF19B3858407 for ; Fri, 17 Dec 2021 15:42:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EF19B3858407 Received: from AM6PR10CA0030.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:89::43) by PAXPR08MB7261.eurprd08.prod.outlook.com (2603:10a6:102:210::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Fri, 17 Dec 2021 15:42:51 +0000 Received: from AM5EUR03FT029.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:89:cafe::c8) by AM6PR10CA0030.outlook.office365.com (2603:10a6:209:89::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Fri, 17 Dec 2021 15:42:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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 AM5EUR03FT029.mail.protection.outlook.com (10.152.16.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Fri, 17 Dec 2021 15:42:51 +0000 Received: ("Tessian outbound 9a8c656e7c94:v110"); Fri, 17 Dec 2021 15:42:50 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d61f3a2118125453 X-CR-MTA-TID: 64aa7808 Received: from 68fd13cba7c1.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F5879342-452C-4BAD-A267-133527BBF9F3.1; Fri, 17 Dec 2021 15:42:43 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 68fd13cba7c1.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 17 Dec 2021 15:42:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kd89Ochl3B51mNU6F98HYOD/EkUfLJyLBRBI4VQmoNSj4zNnrvmzbyWYAa11OeMMuTFYP7Uxps9DhkQS9ylAXDeLGBRBdIG1PGVuCLk8Ans8wOwjek/tWd24FARICkOFZ6zJ/KXZfLXuudaixpYPEt4fq1d7CtVHezm4LXUVLYgC9Vm10khKwUE873dT+n0FG6n9qBAofWKoOZtKg73h0J43yASS8/xURUwoEaS41bHON9x+SMVIcE+RyPC/IWGbvaHRwFEfeGySu7laebrQH6vJKNQA2x2q91v3JCA10w+Cf0gRjcf/eR0pE+6bQeB7FTtIB6j+5hrMJ8zCPK0KgQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pUwn1hIO12fvOVQK2C6u1grfJzlw8jK7Rg4LngjtceI=; b=nnFOYh7tmywqTlR+BRDATrIOOKYdR9T6v40sljOgGWtYgrOoSFyBB1rjBjC0kVi1kBPyWTDOP0z0voukpHRH+6DK66xjSMa1GfMUez/tytHq+nqF4DmQdQwODcQ6nOOXVUiFhIX136zEYz1WE6+MDiZxf5rGSmEil5HuUOZbojm+z0z1jMqMD55ceHc4btOTIvA4NjKlnNRCNq8/GagZsnLGe5OKv2CHW8Xw6iaZUz9DP/pCi2K3vu/7+t1M3jDhAdxuFu18u58l+eGaeGAXHtCrCr0rox1H+7wcyAM92PQw5GhgHV82L+IviVk858C5vXKaAw6djNvtCEeGRifujA== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by VE1PR08MB5566.eurprd08.prod.outlook.com (2603:10a6:800:1a9::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 15:42:37 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::12a:3d2c:81ff:8fcc]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::12a:3d2c:81ff:8fcc%8]) with mapi id 15.20.4778.018; Fri, 17 Dec 2021 15:42:37 +0000 Date: Fri, 17 Dec 2021 15:42:29 +0000 To: gcc-patches@gcc.gnu.org Subject: [1/3 PATCH]middle-end vect: Simplify and extend the complex numbers validation routines. Message-ID: Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: SN1PR12CA0109.namprd12.prod.outlook.com (2603:10b6:802:21::44) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: fe0cd781-39cd-4bb7-3da7-08d9c173e252 X-MS-TrafficTypeDiagnostic: VE1PR08MB5566:EE_|AM5EUR03FT029:EE_|PAXPR08MB7261:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: u/qefuWRHSMBcjkzMgMWQA2eH0E5EVjFXAnRqcaXSabZlPWEGENKl+B0Tpw57C2JAWhDRA/54UdDLWPXik+J3eRrBGniYM+NfxyRq2hWWDntqK955aIyoKtIREFbMS2fK5YLOcSAET6sWLqTzbo5C6uQkBbRI+D3QhKaq27peJAfp0cugR8DKEpwwJ3v2SPDNwNmh+EHtOUch6OmcFrZWuimc69RkOnlXzdpU9oRT6euso/mtfd2H6mux36Jdn5Uo87PRoaCFhwo3SB7LlihyeRzggq3IireazByE8ffizJKqme65opSYJ1jzPS9GSYzHM+PAjG+7yN+8u0IF2uaK38Gt2v4cOUMEGecqLoOho0hSm/3l1eoSogLJMd8X2qcCSGIBViV6wPMWqKAAI5YKrxV2Ln1BP05KITdfd5o232TmBnCOTz3REshv53aK2DTJXvyJK3w9mKX/LPdkKz4rAMn1GShphFJT7Byt0wGDs+myE4E1cWsWbvklR0dG02jzlRhwmwsBTl1qOqA5MsW0RBjPgSgQciUFt385HPrq3+9tgCfSHSsB4jj21QrjEMb0wgnJHXontoX/O46v4zS64fc8dWxYVydu95vrz+wpe1ElRssmvyNb1JfgDFz28fxb3WtVJaErfehbW7po+dDtzIzKj2wckguGD2mxywYszzjIOQZFUTheOiOxWX850Xz0UbiEZIx09Ce6+PFWjM4kU39+zZGvqeTu+Z3tZD2oZE9B6O677JyNzfoDUQijLWT7O5fHyZasEyw00n7iskdYawTP5xAw2oVBCzPMuSBRCOw4VWPSHMqNIVLlf0QF4m1AfpQ8to9lML0h1wEAt6sH/XYUUAgA9ou1EXkFdLnVDtVwik4joRvwA24cKqQhZVq 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)(366004)(5660300002)(6666004)(6506007)(8676002)(66556008)(30864003)(66476007)(83380400001)(186003)(38350700002)(2616005)(66946007)(26005)(38100700002)(4326008)(52116002)(508600001)(44144004)(36756003)(6916009)(8936002)(44832011)(84970400001)(86362001)(6512007)(235185007)(6486002)(2906002)(316002)(33964004)(4216001)(2700100001)(579004); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5566 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT029.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: d28449c0-2ce8-4125-d092-08d9c173d9d1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +/bkren+16UetiUgf/j7JkYeWt46mj32/WWWCyfwmzwmHhTmTEPeFthJdDtHNWGpAE3qelhCQiPcqQZ6UdKjJXrSSyWqtwJn5WP7LNAgEpebfXgAqFa8CjnJlIlpcKoYvd+c0NZ7RualKEVYIyo3q+lr+eM+2JZlQmAznF/AhfT9eluzEBGrA1b2CVTSLFtIa0Ru5Gbdz7hFGmMxphUtPUzwhHev4dZWJsstOemVM0haXbVHDMTMpbQBz7aWkZzCNss5asT8shfugshOQvgiy6uislfEJzP2lTmbpSgtbwumsG3/hOgU7HIO2IAaqM5kR4vOywJbJbDqPbivdmnNo6oElO2y6qGk0FCq8U+JO7ExkSsl4y95Tx622y0p9r7p58oyvajPJ9cUnZ944lrLazbQ6fL15QdC4SiZKM21eqdMFd8Q+QxGxk6l+YCYZPoCzt2SMlBIvvo0lpUMr4a5N6WdjrsrGDs9VOx7Ek92evxt40lRmSPGtraLYPImn2oYf+owVbpoEwO3FUZ3O9hteKctSHcNqt6ydtOttOYYmBthyZoIojHK8cF0Rb06v0I2IWIFK91jRihQtVuixGJGipu9ThvDE3iKgCLDA8nIDUOh6yAE5xeZ6rTVaeeaKsiVV5pw0cjzJslse/iv807XFn2xnQ9OfS+nVseB/Quizh48sABxobbjcDSHjtccj1ONqpnvFLsRIKxKVuCl/v1lB2RwDs90KhIue/fkcuFwDnuG0ZQ/cXkN2NSGYx0cyNEsqJNSDpY5ik9STKnAbOhscwYEg1bg/NcWmik2H3TYiBzeDta6u+PPU0csa6PBGzNKV3d5zo7PWIU3epguUJxBcdGCUjAVALbhQh0iYCY0ylMg1YTnvvfm78VNxWUfcK+DzBvgVmGjQSYTdz3HM2RecJkQpjRL7v9xASKLmcDCUiFYnm1YLbKm/Qmqohvaso4v 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)(46966006)(36840700001)(40470700001)(26005)(83380400001)(6916009)(82310400004)(8936002)(186003)(508600001)(40460700001)(70206006)(70586007)(6512007)(8676002)(356005)(44832011)(336012)(84970400001)(81166007)(6506007)(316002)(5660300002)(2616005)(6486002)(235185007)(107886003)(33964004)(86362001)(36756003)(30864003)(6666004)(4326008)(47076005)(2906002)(36860700001)(44144004)(4216001)(2700100001)(579004); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2021 15:42:51.1138 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fe0cd781-39cd-4bb7-3da7-08d9c173e252 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: AM5EUR03FT029.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB7261 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi All, This patch boosts the analysis for complex mul,fma and fms in order to ensure that it doesn't create an incorrect output. Essentially it adds an extra verification to check that the two nodes it's going to combine do the same operations on compatible values. The reason it needs to do this is that if one computation differs from the other then with the current implementation we have no way to deal with it since we have to remove the permute. When we can keep the permute around we can probably handle these by unrolling. While implementing this since I have to do the traversal anyway I took advantage of it by simplifying the code a bit. Previously we would determine whether something is a conjugate and then try to figure out which conjugate it is and then try to see if the permutes match what we expect. Now the code that does the traversal will detect this in one go and return to us whether the operation is something that can be combined and whether a conjugate is present. Secondly because it does this I can now simplify the checking code itself to essentially just try to apply fixed patterns to each operation. The patterns represent the order operations should appear in. For instance a complex MUL operation combines : Left 1 + Right 1 Left 2 + Right 2 with a permute on the nodes consisting of: { Even, Even } + { Odd, Odd } { Even, Odd } + { Odd, Even } By abstracting over these patterns the checking code becomes quite simple. As part of this I was checking the order of the operands which was left in "slp" order. as in, the same order they showed up in during SLP, which means that the accumulator is first. However it looks like I didn't document this and the x86 optab was implemented assuming the same order as FMA, i.e. that the accumulator is last. I have this changed the order to match that of FMA and FMS which corrects the x86 codegen and will update the Arm targets. This has now also been documented. Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu and no regressions. Ok for master? and backport to GCC 11 after some stew? Thanks, Tamar gcc/ChangeLog: PR tree-optimization/102819 PR tree-optimization/103169 * doc/md.texi: Update docs for cfms, cfma. * tree-data-ref.h (same_data_refs): Accept optional offset. * tree-vect-slp-patterns.c (is_linear_load_p): Fix issue with repeating patterns. (vect_normalize_conj_loc): Remove. (is_eq_or_top): Change to take two nodes. (enum _conj_status, compatible_complex_nodes_p, vect_validate_multiplication): New. (class complex_add_pattern, complex_add_pattern::matches, complex_add_pattern::recognize, class complex_mul_pattern, complex_mul_pattern::recognize, class complex_fms_pattern, complex_fms_pattern::recognize, class complex_operations_pattern, complex_operations_pattern::recognize, addsub_pattern::recognize): Pass new cache. (complex_fms_pattern::matches, complex_mul_pattern::matches): Pass new cache and use new validation code. * tree-vect-slp.c (vect_match_slp_patterns_2, vect_match_slp_patterns, vect_analyze_slp): Pass along cache. (compatible_calls_p): Expose. * tree-vectorizer.h (compatible_calls_p, slp_node_hash, slp_compat_nodes_map_t): New. (class vect_pattern): Update signatures include new cache. gcc/testsuite/ChangeLog: PR tree-optimization/102819 PR tree-optimization/103169 * g++.dg/vect/pr99149.cc: xfail for now. * gcc.dg/vect/complex/pr102819-1.c: New test. * gcc.dg/vect/complex/pr102819-2.c: New test. * gcc.dg/vect/complex/pr102819-3.c: New test. * gcc.dg/vect/complex/pr102819-4.c: New test. * gcc.dg/vect/complex/pr102819-5.c: New test. * gcc.dg/vect/complex/pr102819-6.c: New test. * gcc.dg/vect/complex/pr102819-7.c: New test. * gcc.dg/vect/complex/pr102819-8.c: New test. * gcc.dg/vect/complex/pr102819-9.c: New test. * gcc.dg/vect/complex/pr103169.c: New test. --- inline copy of patch -- diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index 9ec051e94e10cca9eec2773e1b8c01b74b6ea4db..60dc5b3ea6087c2824ad1467bc66e9cfebe9dcfc 100644 diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index 9ec051e94e10cca9eec2773e1b8c01b74b6ea4db..60dc5b3ea6087c2824ad1467bc66e9cfebe9dcfc 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -6325,12 +6325,12 @@ Perform a vector multiply and accumulate that is semantically the same as a multiply and accumulate of complex numbers. @smallexample - complex TYPE c[N]; - complex TYPE a[N]; - complex TYPE b[N]; + complex TYPE op0[N]; + complex TYPE op1[N]; + complex TYPE op2[N]; for (int i = 0; i < N; i += 1) @{ - c[i] += a[i] * b[i]; + op2[i] += op1[i] * op2[i]; @} @end smallexample @@ -6348,12 +6348,12 @@ the same as a multiply and accumulate of complex numbers where the second multiply arguments is conjugated. @smallexample - complex TYPE c[N]; - complex TYPE a[N]; - complex TYPE b[N]; + complex TYPE op0[N]; + complex TYPE op1[N]; + complex TYPE op2[N]; for (int i = 0; i < N; i += 1) @{ - c[i] += a[i] * conj (b[i]); + op2[i] += op0[i] * conj (op1[i]); @} @end smallexample @@ -6370,12 +6370,12 @@ Perform a vector multiply and subtract that is semantically the same as a multiply and subtract of complex numbers. @smallexample - complex TYPE c[N]; - complex TYPE a[N]; - complex TYPE b[N]; + complex TYPE op0[N]; + complex TYPE op1[N]; + complex TYPE op2[N]; for (int i = 0; i < N; i += 1) @{ - c[i] -= a[i] * b[i]; + op2[i] -= op0[i] * op1[i]; @} @end smallexample @@ -6393,12 +6393,12 @@ the same as a multiply and subtract of complex numbers where the second multiply arguments is conjugated. @smallexample - complex TYPE c[N]; - complex TYPE a[N]; - complex TYPE b[N]; + complex TYPE op0[N]; + complex TYPE op1[N]; + complex TYPE op2[N]; for (int i = 0; i < N; i += 1) @{ - c[i] -= a[i] * conj (b[i]); + op2[i] -= op0[i] * conj (op1[i]); @} @end smallexample @@ -6415,12 +6415,12 @@ Perform a vector multiply that is semantically the same as multiply of complex numbers. @smallexample - complex TYPE c[N]; - complex TYPE a[N]; - complex TYPE b[N]; + complex TYPE op0[N]; + complex TYPE op1[N]; + complex TYPE op2[N]; for (int i = 0; i < N; i += 1) @{ - c[i] = a[i] * b[i]; + op2[i] = op0[i] * op1[i]; @} @end smallexample @@ -6437,12 +6437,12 @@ Perform a vector multiply by conjugate that is semantically the same as a multiply of complex numbers where the second multiply arguments is conjugated. @smallexample - complex TYPE c[N]; - complex TYPE a[N]; - complex TYPE b[N]; + complex TYPE op0[N]; + complex TYPE op1[N]; + complex TYPE op2[N]; for (int i = 0; i < N; i += 1) @{ - c[i] = a[i] * conj (b[i]); + op2[i] = op0[i] * conj (op1[i]); @} @end smallexample diff --git a/gcc/testsuite/g++.dg/vect/pr99149.cc b/gcc/testsuite/g++.dg/vect/pr99149.cc index e6e0594a336fa053ffba64a12e2de43a4e373f49..bb9f5fa89f12b184368bf5488d6e9432c2166463 100755 --- a/gcc/testsuite/g++.dg/vect/pr99149.cc +++ b/gcc/testsuite/g++.dg/vect/pr99149.cc @@ -24,4 +24,4 @@ public: } n; main() { n.j(); } -/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_MUL" 1 "slp2" } } */ +/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_MUL" 1 "slp2" { xfail { vect_float } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/complex/pr102819-1.c b/gcc/testsuite/gcc.dg/vect/complex/pr102819-1.c new file mode 100644 index 0000000000000000000000000000000000000000..46b9a55f05279d732fa1418e02f779cf693ede07 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/complex/pr102819-1.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-add-options arm_v8_3a_complex_neon } */ + +float f[12][100]; + +void bad1(float v1, float v2) +{ + for (int r = 0; r < 100; r += 4) + { + int i = r + 1; + f[0][r] = f[1][r] * (f[2][r] + v2) - f[1][i] * (f[2][i] + v1); + f[0][i] = f[1][r] * (f[2][i] + v1) + f[1][i] * (f[2][r] + v2); + f[0][r+2] = f[1][r+2] * (f[2][r+2] + v2) - f[1][i+2] * (f[2][i+2] + v1); + f[0][i+2] = f[1][r+2] * (f[2][i+2] + v1) + f[1][i+2] * (f[2][r+2] + v2); + // ^^^^^^^ ^^^^^^^ + } +} + +/* { dg-final { scan-tree-dump "Found COMPLEX_MUL" "vect" { target { vect_float } } } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/complex/pr102819-2.c b/gcc/testsuite/gcc.dg/vect/complex/pr102819-2.c new file mode 100644 index 0000000000000000000000000000000000000000..ffe646efe57f7ad07541b0fb96601596f46dc5f8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/complex/pr102819-2.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-add-options arm_v8_3a_complex_neon } */ + +float f[12][100]; + +void bad1(float v1, float v2) +{ + for (int r = 0; r < 100; r += 2) + { + int i = r + 1; + f[0][r] = f[1][r] * (f[2][r] + v1) - f[1][i] * (f[2][i] + v2); + f[0][i] = f[1][r] * (f[2][i] + v1) + f[1][i] * (f[2][r] + v2); + } +} + +/* { dg-final { scan-tree-dump-not "Found COMPLEX_MUL" "vect" { target { vect_float } } } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/complex/pr102819-3.c b/gcc/testsuite/gcc.dg/vect/complex/pr102819-3.c new file mode 100644 index 0000000000000000000000000000000000000000..5f98aa204d8b11b0cb433f8965dbb72cf8940de1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/complex/pr102819-3.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-add-options arm_v8_3a_complex_neon } */ + +float f[12][100]; + +void good1(float v1, float v2) +{ + for (int r = 0; r < 100; r += 2) + { + int i = r + 1; + f[0][r] = f[1][r] * (f[2][r] + v2) - f[1][i] * (f[2][i] + v1); + f[0][i] = f[1][r] * (f[2][i] + v1) + f[1][i] * (f[2][r] + v2); + } +} + +/* { dg-final { scan-tree-dump "Found COMPLEX_MUL" "vect" { target { vect_float } } } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/complex/pr102819-4.c b/gcc/testsuite/gcc.dg/vect/complex/pr102819-4.c new file mode 100644 index 0000000000000000000000000000000000000000..882851789c5085e734000609114be480d3b08bd0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/complex/pr102819-4.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-add-options arm_v8_3a_complex_neon } */ + +float f[12][100]; + +void good1() +{ + for (int r = 0; r < 100; r += 2) + { + int i = r + 1; + f[0][r] = f[1][r] * f[2][r] - f[1][i] * f[2][i]; + f[0][i] = f[1][r] * f[2][i] + f[1][i] * f[2][r]; + } +} + +/* { dg-final { scan-tree-dump "Found COMPLEX_MUL" "vect" { target { vect_float } } } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/complex/pr102819-5.c b/gcc/testsuite/gcc.dg/vect/complex/pr102819-5.c new file mode 100644 index 0000000000000000000000000000000000000000..6a2d549d65f3f27d407fb0bd469473e6a5c333ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/complex/pr102819-5.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-add-options arm_v8_3a_complex_neon } */ + +float f[12][100]; + +void good2() +{ + for (int r = 0; r < 100; r += 2) + { + int i = r + 1; + f[0][r] = f[1][r] * (f[2][r] + 1) - f[1][i] * (f[2][i] + 1); + f[0][i] = f[1][r] * (f[2][i] + 1) + f[1][i] * (f[2][r] + 1); + } +} + +/* { dg-final { scan-tree-dump "Found COMPLEX_MUL" "vect" { target { vect_float } } } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/complex/pr102819-6.c b/gcc/testsuite/gcc.dg/vect/complex/pr102819-6.c new file mode 100644 index 0000000000000000000000000000000000000000..71e66dbe3b29eec1fffb8df9b216022fdc0af54e --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/complex/pr102819-6.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-add-options arm_v8_3a_complex_neon } */ + +float f[12][100]; + +void bad1() +{ + for (int r = 0; r < 100; r += 2) + { + int i = r + 1; + f[0][r] = f[1][r] * f[2][r] - f[1][i] * f[3][i]; + f[0][i] = f[1][r] * f[2][i] + f[1][i] * f[3][r]; + // ^^^^^^^ ^^^^^^^ + } +} + +/* { dg-final { scan-tree-dump-not "Found COMPLEX_MUL" "vect" { target { vect_float } } } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/complex/pr102819-7.c b/gcc/testsuite/gcc.dg/vect/complex/pr102819-7.c new file mode 100644 index 0000000000000000000000000000000000000000..536672f3c8bb474ad5fa4bb61b3a36b555acf3cf --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/complex/pr102819-7.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-add-options arm_v8_3a_complex_neon } */ + +float f[12][100]; + +void bad2() +{ + for (int r = 0; r < 100; r += 2) + { + int i = r + 1; + f[0][r] = f[1][r] * (f[2][r] + 1) - f[1][i] * f[2][i]; + f[0][i] = f[1][r] * (f[2][i] + 1) + f[1][i] * f[2][r]; + // ^^^^ + } +} + +/* { dg-final { scan-tree-dump-not "Found COMPLEX_MUL" "vect" { target { vect_float } } } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/complex/pr102819-8.c b/gcc/testsuite/gcc.dg/vect/complex/pr102819-8.c new file mode 100644 index 0000000000000000000000000000000000000000..07b48148688b7d530e5891d023d558b58a485c23 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/complex/pr102819-8.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-add-options arm_v8_3a_complex_neon } */ + +float f[12][100]; + +void bad3() +{ + for (int r = 0; r < 100; r += 2) + { + int i = r + 1; + f[0][r] = f[1][r] * f[2][r] - f[1][r] * f[2][i]; + f[0][i] = f[1][r] * f[2][i] + f[1][i] * f[2][r]; + // ^^^^^^^ + } +} + +/* { dg-final { scan-tree-dump-not "Found COMPLEX_MUL" "vect" { target { vect_float } } } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/complex/pr102819-9.c b/gcc/testsuite/gcc.dg/vect/complex/pr102819-9.c new file mode 100644 index 0000000000000000000000000000000000000000..7655852434b21b381fe7ee316e8caf3d485b8ee1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/complex/pr102819-9.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-add-options arm_v8_3a_complex_neon } */ + +#include +#include + +#define N 200 +#define TYPE float +#define TYPE2 float + +void g (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N]) +{ + for (int i=0; i < N; i++) + { + c[i] -= a[i] * b[0]; + } +} + +/* The pattern overlaps with COMPLEX_ADD so we need to support consuming ADDs in COMPLEX_FMS. */ + +/* { dg-final { scan-tree-dump "Found COMPLEX_FMS" "vect" { xfail { vect_float } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/complex/pr103169.c b/gcc/testsuite/gcc.dg/vect/complex/pr103169.c new file mode 100644 index 0000000000000000000000000000000000000000..1bfabbd85a0eedfb4156a82574324126e9083fc5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/complex/pr103169.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { vect_double } } } */ +/* { dg-add-options arm_v8_3a_complex_neon } */ +/* { dg-additional-options "-O2 -fvect-cost-model=unlimited" } */ + +_Complex double b_0, c_0; + +void +mul270snd (void) +{ + c_0 = b_0 * 1.0iF * 1.0iF; +} + diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h index 74f579c9f3f23bac25d21546068c2ab43209aa2b..8ad5fa521279b20fa5e63eecf442d5dc5c16e7ee 100644 --- a/gcc/tree-data-ref.h +++ b/gcc/tree-data-ref.h @@ -600,10 +600,11 @@ same_data_refs_base_objects (data_reference_p a, data_reference_p b) } /* Return true when the data references A and B are accessing the same - memory object with the same access functions. */ + memory object with the same access functions. Optionally skip the + last OFFSET dimensions in the data reference. */ static inline bool -same_data_refs (data_reference_p a, data_reference_p b) +same_data_refs (data_reference_p a, data_reference_p b, int offset = 0) { unsigned int i; @@ -614,7 +615,7 @@ same_data_refs (data_reference_p a, data_reference_p b) if (!same_data_refs_base_objects (a, b)) return false; - for (i = 0; i < DR_NUM_DIMENSIONS (a); i++) + for (i = offset; i < DR_NUM_DIMENSIONS (a); i++) if (!eq_evolutions_p (DR_ACCESS_FN (a, i), DR_ACCESS_FN (b, i))) return false; diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c index 0350441fad9690cd5d04337171ca3470a064a571..f8da4153632a700680091f37305a5d3078fbb0c5 100644 --- a/gcc/tree-vect-slp-patterns.c +++ b/gcc/tree-vect-slp-patterns.c @@ -149,12 +149,13 @@ is_linear_load_p (load_permutation_t loads) int valid_patterns = 4; FOR_EACH_VEC_ELT (loads, i, load) { - if (candidates[0] != PERM_UNKNOWN && load != 1) + unsigned adj_load = load % 2; + if (candidates[0] != PERM_UNKNOWN && adj_load != 1) { candidates[0] = PERM_UNKNOWN; valid_patterns--; } - if (candidates[1] != PERM_UNKNOWN && load != 0) + if (candidates[1] != PERM_UNKNOWN && adj_load != 0) { candidates[1] = PERM_UNKNOWN; valid_patterns--; @@ -596,11 +597,12 @@ class complex_add_pattern : public complex_pattern public: void build (vec_info *); static internal_fn - matches (complex_operation_t op, slp_tree_to_load_perm_map_t *, slp_tree *, - vec *); + matches (complex_operation_t op, slp_tree_to_load_perm_map_t *, + slp_compat_nodes_map_t *, slp_tree *, vec *); static vect_pattern* - recognize (slp_tree_to_load_perm_map_t *, slp_tree *); + recognize (slp_tree_to_load_perm_map_t *, slp_compat_nodes_map_t *, + slp_tree *); static vect_pattern* mkInstance (slp_tree *node, vec *m_ops, internal_fn ifn) @@ -647,6 +649,7 @@ complex_add_pattern::build (vec_info *vinfo) internal_fn complex_add_pattern::matches (complex_operation_t op, slp_tree_to_load_perm_map_t *perm_cache, + slp_compat_nodes_map_t * /* compat_cache */, slp_tree *node, vec *ops) { internal_fn ifn = IFN_LAST; @@ -692,13 +695,14 @@ complex_add_pattern::matches (complex_operation_t op, vect_pattern* complex_add_pattern::recognize (slp_tree_to_load_perm_map_t *perm_cache, + slp_compat_nodes_map_t *compat_cache, slp_tree *node) { auto_vec ops; complex_operation_t op = vect_detect_pair_op (*node, true, &ops); internal_fn ifn - = complex_add_pattern::matches (op, perm_cache, node, &ops); + = complex_add_pattern::matches (op, perm_cache, compat_cache, node, &ops); if (ifn == IFN_LAST) return NULL; @@ -709,147 +713,214 @@ complex_add_pattern::recognize (slp_tree_to_load_perm_map_t *perm_cache, * complex_mul_pattern ******************************************************************************/ -/* Check to see if either of the trees in ARGS are a NEGATE_EXPR. If the first - child (args[0]) is a NEGATE_EXPR then NEG_FIRST_P is set to TRUE. - - If a negate is found then the values in ARGS are reordered such that the - negate node is always the second one and the entry is replaced by the child - of the negate node. */ +/* Helper function to check if PERM is KIND or PERM_TOP. */ static inline bool -vect_normalize_conj_loc (vec &args, bool *neg_first_p = NULL) +is_eq_or_top (slp_tree_to_load_perm_map_t *perm_cache, + slp_tree op1, complex_perm_kinds_t kind1, + slp_tree op2, complex_perm_kinds_t kind2) { - gcc_assert (args.length () == 2); - bool neg_found = false; - - if (vect_match_expression_p (args[0], NEGATE_EXPR)) - { - std::swap (args[0], args[1]); - neg_found = true; - if (neg_first_p) - *neg_first_p = true; - } - else if (vect_match_expression_p (args[1], NEGATE_EXPR)) - { - neg_found = true; - if (neg_first_p) - *neg_first_p = false; - } + complex_perm_kinds_t perm1 = linear_loads_p (perm_cache, op1); + if (perm1 != kind1 && perm1 != PERM_TOP) + return false; - if (neg_found) - args[1] = SLP_TREE_CHILDREN (args[1])[0]; + complex_perm_kinds_t perm2 = linear_loads_p (perm_cache, op2); + if (perm2 != kind2 && perm2 != PERM_TOP) + return false; - return neg_found; + return true; } -/* Helper function to check if PERM is KIND or PERM_TOP. */ +enum _conj_status { CONJ_NONE, CONJ_FST, CONJ_SND }; static inline bool -is_eq_or_top (complex_perm_kinds_t perm, complex_perm_kinds_t kind) +compatible_complex_nodes_p (slp_compat_nodes_map_t *compat_cache, + slp_tree a, int *pa, slp_tree b, int *pb) { - return perm == kind || perm == PERM_TOP; -} + bool *tmp; + std::pair key = std::make_pair(a, b); + if ((tmp = compat_cache->get (key)) != NULL) + return *tmp; -/* Helper function that checks to see if LEFT_OP and RIGHT_OP are both MULT_EXPR - nodes but also that they represent an operation that is either a complex - multiplication or a complex multiplication by conjugated value. + compat_cache->put (key, false); - Of the negation is expected to be in the first half of the tree (As required - by an FMS pattern) then NEG_FIRST is true. If the operation is a conjugate - operation then CONJ_FIRST_OPERAND is set to indicate whether the first or - second operand contains the conjugate operation. */ + if (SLP_TREE_CHILDREN (a).length () != SLP_TREE_CHILDREN (b).length ()) + return false; -static inline bool -vect_validate_multiplication (slp_tree_to_load_perm_map_t *perm_cache, - const vec &left_op, - const vec &right_op, - bool neg_first, bool *conj_first_operand, - bool fms) -{ - /* The presence of a negation indicates that we have either a conjugate or a - rotation. We need to distinguish which one. */ - *conj_first_operand = false; - complex_perm_kinds_t kind; - - /* Complex conjugates have the negation on the imaginary part of the - number where rotations affect the real component. So check if the - negation is on a dup of lane 1. */ - if (fms) + if (SLP_TREE_DEF_TYPE (a) != SLP_TREE_DEF_TYPE (b)) + return false; + + /* Only internal nodes can be loads, as such we can't check further if they + are externals. */ + if (SLP_TREE_DEF_TYPE (a) != vect_internal_def) { - /* 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]); - 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)) - || (kind == PERM_ODDEVEN - && is_eq_or_top (linear_loads_p (perm_cache, right_op[1]), - PERM_ODDODD)))) - return false; + for (unsigned i = 0; i < SLP_TREE_SCALAR_OPS (a).length (); i++) + { + tree op1 = SLP_TREE_SCALAR_OPS (a)[pa[i % 2]]; + tree op2 = SLP_TREE_SCALAR_OPS (b)[pb[i % 2]]; + if (!operand_equal_p (op1, op2, 0)) + return false; + } + + compat_cache->put (key, true); + return true; + } + + auto a_stmt = STMT_VINFO_STMT (SLP_TREE_REPRESENTATIVE (a)); + auto b_stmt = STMT_VINFO_STMT (SLP_TREE_REPRESENTATIVE (b)); + + if (gimple_code (a_stmt) != gimple_code (b_stmt)) + return false; + + /* code, children, type, externals, loads, constants */ + if (gimple_num_args (a_stmt) != gimple_num_args (b_stmt)) + return false; + + /* At this point, a and b are known to be the same gimple operations. */ + if (is_gimple_call (a_stmt)) + { + if (!compatible_calls_p (dyn_cast (a_stmt), + dyn_cast (b_stmt))) + return false; } + else if (!is_gimple_assign (a_stmt)) + return false; else { - 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)) + tree_code acode = gimple_assign_rhs_code (a_stmt); + tree_code bcode = gimple_assign_rhs_code (b_stmt); + if ((acode == REALPART_EXPR || acode == IMAGPART_EXPR) + && (bcode == REALPART_EXPR || bcode == IMAGPART_EXPR)) + return true; + + if (acode != bcode) return false; } - /* Deal with differences in indexes. */ - int index1 = fms ? 1 : 0; - int index2 = fms ? 0 : 1; - - /* 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]); - if (kind == PERM_TOP) + if (!SLP_TREE_LOAD_PERMUTATION (a).exists () + || !SLP_TREE_LOAD_PERMUTATION (b).exists ()) { - if (linear_loads_p (perm_cache, left_op[index2]) == PERM_EVENODD) - return true; + for (unsigned i = 0; i < gimple_num_args (a_stmt); i++) + { + tree t1 = gimple_arg (a_stmt, i); + tree t2 = gimple_arg (b_stmt, i); + if (TREE_CODE (t1) != TREE_CODE (t2)) + return false; + + /* If SSA name then we will need to inspect the children + so we can punt here. */ + if (TREE_CODE (t1) == SSA_NAME) + continue; + + if (!operand_equal_p (t1, t2, 0)) + return false; + } } - else if (kind == PERM_EVENODD && !neg_first) + else { - if ((kind = linear_loads_p (perm_cache, left_op[index2])) != PERM_EVENEVEN) + auto dr1 = STMT_VINFO_DATA_REF (SLP_TREE_REPRESENTATIVE (a)); + auto dr2 = STMT_VINFO_DATA_REF (SLP_TREE_REPRESENTATIVE (b)); + /* Don't check the last dimension as that's checked by the lineary + checks. This check is also much stricter than what we need + because it doesn't consider loading from adjacent elements + in the same struct as loading from the same base object. + But for now, I'll play it safe. */ + if (!same_data_refs (dr1, dr2, 1)) return false; - return true; } - else if (kind == PERM_EVENEVEN && neg_first) + + for (unsigned i = 0; i < SLP_TREE_CHILDREN (a).length (); i++) { - if ((kind = linear_loads_p (perm_cache, left_op[index2])) != PERM_EVENODD) + if (!compatible_complex_nodes_p (compat_cache, + SLP_TREE_CHILDREN (a)[i], pa, + SLP_TREE_CHILDREN (b)[i], pb)) return false; - - *conj_first_operand = true; - return true; } - else - return false; - - if (kind != PERM_EVENEVEN) - return false; + compat_cache->put (key, true); return true; } -/* Helper function to help distinguish between a conjugate and a rotation in a - complex multiplication. The operations have similar shapes but the order of - the load permutes are different. This function returns TRUE when the order - is consistent with a multiplication or multiplication by conjugated - operand but returns FALSE if it's a multiplication by rotated operand. */ - static inline bool vect_validate_multiplication (slp_tree_to_load_perm_map_t *perm_cache, - const vec &op, - complex_perm_kinds_t permKind) + slp_compat_nodes_map_t *compat_cache, + vec &left_op, + vec &right_op, + bool subtract, + enum _conj_status *_status) { - /* The left node is the more common case, test it first. */ - if (!is_eq_or_top (linear_loads_p (perm_cache, op[0]), permKind)) + auto_vec ops; + enum _conj_status stats = CONJ_NONE; + + /* The complex operations can occur in two layouts and two permute sequences + so declare them and re-use them. */ + int styles[][4] = { { 0, 2, 1, 3} /* {L1, R1} + {L2, R2}. */ + , { 0, 3, 1, 2} /* {L1, R2} + {L2, R1}. */ + }; + + /* Now for the corresponding permutes that go with these values. */ + complex_perm_kinds_t perms[][4] + = { { PERM_EVENEVEN, PERM_ODDODD, PERM_EVENODD, PERM_ODDEVEN } + , { PERM_EVENODD, PERM_ODDEVEN, PERM_EVENEVEN, PERM_ODDODD } + }; + + /* These permutes are used during comparisons of externals on which + we require strict equality. */ + int cq[][4][2] + = { { { 0, 0 }, { 1, 1 }, { 0, 1 }, { 1, 0 } } + , { { 0, 1 }, { 1, 0 }, { 0, 0 }, { 1, 1 } } + }; + + /* Default to style and perm 0, most operations use this one. */ + int style = 0; + int perm = subtract ? 1 : 0; + + /* Check if we have a negate operation, if so absorb the node and continue + looking. */ + bool neg0 = vect_match_expression_p (right_op[0], NEGATE_EXPR); + bool neg1 = vect_match_expression_p (right_op[1], NEGATE_EXPR); + + /* Determine which style we're looking at. We only have different ones + whenever a conjugate is involved. */ + if (neg0 && neg1) + ; + else if (neg0) { - if (!is_eq_or_top (linear_loads_p (perm_cache, op[1]), permKind)) - return false; + right_op[0] = SLP_TREE_CHILDREN (right_op[0])[0]; + stats = CONJ_FST; + if (subtract) + perm = 0; } - return true; + else if (neg1) + { + right_op[1] = SLP_TREE_CHILDREN (right_op[1])[0]; + stats = CONJ_SND; + perm = 1; + } + + *_status = stats; + + /* Flatten the inputs after we've remapped them. */ + ops.create (4); + ops.safe_splice (left_op); + ops.safe_splice (right_op); + + /* Extract out the elements to check. */ + slp_tree op0 = ops[styles[style][0]]; + slp_tree op1 = ops[styles[style][1]]; + slp_tree op2 = ops[styles[style][2]]; + slp_tree op3 = ops[styles[style][3]]; + + /* Do cheapest test first. If failed no need to analyze further. */ + if (linear_loads_p (perm_cache, op0) != perms[perm][0] + || linear_loads_p (perm_cache, op1) != perms[perm][1] + || !is_eq_or_top (perm_cache, op2, perms[perm][2], op3, perms[perm][3])) + return false; + + return compatible_complex_nodes_p (compat_cache, op0, cq[perm][0], op1, + cq[perm][1]) + && compatible_complex_nodes_p (compat_cache, op2, cq[perm][2], op3, + cq[perm][3]); } /* This function combines two nodes containing only even and only odd lanes @@ -908,11 +979,12 @@ class complex_mul_pattern : public complex_pattern public: void build (vec_info *); static internal_fn - matches (complex_operation_t op, slp_tree_to_load_perm_map_t *, slp_tree *, - vec *); + matches (complex_operation_t op, slp_tree_to_load_perm_map_t *, + slp_compat_nodes_map_t *, slp_tree *, vec *); static vect_pattern* - recognize (slp_tree_to_load_perm_map_t *, slp_tree *); + recognize (slp_tree_to_load_perm_map_t *, slp_compat_nodes_map_t *, + slp_tree *); static vect_pattern* mkInstance (slp_tree *node, vec *m_ops, internal_fn ifn) @@ -943,6 +1015,7 @@ class complex_mul_pattern : public complex_pattern internal_fn complex_mul_pattern::matches (complex_operation_t op, slp_tree_to_load_perm_map_t *perm_cache, + slp_compat_nodes_map_t *compat_cache, slp_tree *node, vec *ops) { internal_fn ifn = IFN_LAST; @@ -990,17 +1063,13 @@ complex_mul_pattern::matches (complex_operation_t op, || linear_loads_p (perm_cache, left_op[1]) == PERM_ODDEVEN) return IFN_LAST; - bool neg_first = false; - bool conj_first_operand = false; - bool is_neg = vect_normalize_conj_loc (right_op, &neg_first); + enum _conj_status status; + if (!vect_validate_multiplication (perm_cache, compat_cache, left_op, + right_op, false, &status)) + return IFN_LAST; - if (!is_neg) + if (status == CONJ_NONE) { - /* A multiplication needs to multiply agains the real pair, otherwise - the pattern matches that of FMS. */ - if (!vect_validate_multiplication (perm_cache, left_op, PERM_EVENEVEN) - || vect_normalize_conj_loc (left_op)) - return IFN_LAST; if (add0) ifn = IFN_COMPLEX_FMA; else @@ -1008,11 +1077,6 @@ complex_mul_pattern::matches (complex_operation_t op, } else { - if (!vect_validate_multiplication (perm_cache, left_op, right_op, - neg_first, &conj_first_operand, - false)) - return IFN_LAST; - if(add0) ifn = IFN_COMPLEX_FMA_CONJ; else @@ -1029,19 +1093,13 @@ complex_mul_pattern::matches (complex_operation_t op, ops->quick_push (add0); complex_perm_kinds_t kind = linear_loads_p (perm_cache, left_op[0]); - if (kind == PERM_EVENODD) - { - ops->quick_push (left_op[1]); - ops->quick_push (right_op[1]); - ops->quick_push (left_op[0]); - } - else if (kind == PERM_TOP) + if (kind == PERM_EVENODD || kind == PERM_TOP) { ops->quick_push (left_op[1]); ops->quick_push (right_op[1]); ops->quick_push (left_op[0]); } - else if (kind == PERM_EVENEVEN && !conj_first_operand) + else if (kind == PERM_EVENEVEN && status != CONJ_SND) { ops->quick_push (left_op[0]); ops->quick_push (right_op[0]); @@ -1061,13 +1119,14 @@ complex_mul_pattern::matches (complex_operation_t op, vect_pattern* complex_mul_pattern::recognize (slp_tree_to_load_perm_map_t *perm_cache, + slp_compat_nodes_map_t *compat_cache, slp_tree *node) { auto_vec ops; complex_operation_t op = vect_detect_pair_op (*node, true, &ops); internal_fn ifn - = complex_mul_pattern::matches (op, perm_cache, node, &ops); + = complex_mul_pattern::matches (op, perm_cache, compat_cache, node, &ops); if (ifn == IFN_LAST) return NULL; @@ -1097,8 +1156,8 @@ complex_mul_pattern::build (vec_info *vinfo) /* First re-arrange the children. */ SLP_TREE_CHILDREN (*this->m_node).reserve_exact (2); - SLP_TREE_CHILDREN (*this->m_node)[0] = this->m_ops[2]; - SLP_TREE_CHILDREN (*this->m_node)[1] = newnode; + SLP_TREE_CHILDREN (*this->m_node)[0] = newnode; + SLP_TREE_CHILDREN (*this->m_node)[1] = this->m_ops[2]; break; } case IFN_COMPLEX_FMA: @@ -1115,9 +1174,9 @@ complex_mul_pattern::build (vec_info *vinfo) /* First re-arrange the children. */ SLP_TREE_CHILDREN (*this->m_node).safe_grow (3); - SLP_TREE_CHILDREN (*this->m_node)[0] = this->m_ops[0]; + SLP_TREE_CHILDREN (*this->m_node)[0] = newnode; SLP_TREE_CHILDREN (*this->m_node)[1] = this->m_ops[3]; - SLP_TREE_CHILDREN (*this->m_node)[2] = newnode; + SLP_TREE_CHILDREN (*this->m_node)[2] = this->m_ops[0]; /* Tell the builder to expect an extra argument. */ this->m_num_args++; @@ -1147,11 +1206,12 @@ class complex_fms_pattern : public complex_pattern public: void build (vec_info *); static internal_fn - matches (complex_operation_t op, slp_tree_to_load_perm_map_t *, slp_tree *, - vec *); + matches (complex_operation_t op, slp_tree_to_load_perm_map_t *, + slp_compat_nodes_map_t *, slp_tree *, vec *); static vect_pattern* - recognize (slp_tree_to_load_perm_map_t *, slp_tree *); + recognize (slp_tree_to_load_perm_map_t *, slp_compat_nodes_map_t *, + slp_tree *); static vect_pattern* mkInstance (slp_tree *node, vec *m_ops, internal_fn ifn) @@ -1182,6 +1242,7 @@ class complex_fms_pattern : public complex_pattern internal_fn complex_fms_pattern::matches (complex_operation_t op, slp_tree_to_load_perm_map_t *perm_cache, + slp_compat_nodes_map_t *compat_cache, slp_tree * ref_node, vec *ops) { internal_fn ifn = IFN_LAST; @@ -1197,6 +1258,8 @@ complex_fms_pattern::matches (complex_operation_t op, if (!vect_match_expression_p (root, MINUS_EXPR)) return IFN_LAST; + /* TODO: Support invariants here, with the new layout CADD now + can match before we get a chance to try CFMS. */ auto nodes = SLP_TREE_CHILDREN (root); if (!vect_match_expression_p (nodes[1], MULT_EXPR) || vect_detect_pair_op (nodes[0]) != PLUS_MINUS) @@ -1217,16 +1280,14 @@ complex_fms_pattern::matches (complex_operation_t op, || !vect_match_expression_p (l0node[1], MULT_EXPR)) return IFN_LAST; - bool is_neg = vect_normalize_conj_loc (left_op); - - bool conj_first_operand = false; - if (!vect_validate_multiplication (perm_cache, right_op, left_op, false, - &conj_first_operand, true)) + enum _conj_status status; + if (!vect_validate_multiplication (perm_cache, compat_cache, right_op, + left_op, true, &status)) return IFN_LAST; - if (!is_neg) + if (status == CONJ_NONE) ifn = IFN_COMPLEX_FMS; - else if (is_neg) + else ifn = IFN_COMPLEX_FMS_CONJ; if (!vect_pattern_validate_optab (ifn, *ref_node)) @@ -1243,26 +1304,12 @@ complex_fms_pattern::matches (complex_operation_t op, ops->quick_push (right_op[1]); ops->quick_push (left_op[1]); } - else if (kind == PERM_TOP) - { - ops->quick_push (l0node[0]); - ops->quick_push (right_op[1]); - ops->quick_push (right_op[0]); - ops->quick_push (left_op[0]); - } - else if (kind == PERM_EVENEVEN && !is_neg) - { - ops->quick_push (l0node[0]); - ops->quick_push (right_op[1]); - ops->quick_push (right_op[0]); - ops->quick_push (left_op[0]); - } else { ops->quick_push (l0node[0]); ops->quick_push (right_op[1]); ops->quick_push (right_op[0]); - ops->quick_push (left_op[1]); + ops->quick_push (left_op[0]); } return ifn; @@ -1272,13 +1319,14 @@ complex_fms_pattern::matches (complex_operation_t op, vect_pattern* complex_fms_pattern::recognize (slp_tree_to_load_perm_map_t *perm_cache, + slp_compat_nodes_map_t *compat_cache, slp_tree *node) { auto_vec ops; complex_operation_t op = vect_detect_pair_op (*node, true, &ops); internal_fn ifn - = complex_fms_pattern::matches (op, perm_cache, node, &ops); + = complex_fms_pattern::matches (op, perm_cache, compat_cache, node, &ops); if (ifn == IFN_LAST) return NULL; @@ -1305,9 +1353,24 @@ complex_fms_pattern::build (vec_info *vinfo) SLP_TREE_CHILDREN (*this->m_node).create (3); /* First re-arrange the children. */ + switch (this->m_ifn) + { + case IFN_COMPLEX_FMS: + { + SLP_TREE_CHILDREN (*this->m_node).quick_push (this->m_ops[1]); + SLP_TREE_CHILDREN (*this->m_node).quick_push (newnode); + break; + } + case IFN_COMPLEX_FMS_CONJ: + { + SLP_TREE_CHILDREN (*this->m_node).quick_push (newnode); + SLP_TREE_CHILDREN (*this->m_node).quick_push (this->m_ops[1]); + break; + } + default: + gcc_unreachable (); + } SLP_TREE_CHILDREN (*this->m_node).quick_push (this->m_ops[0]); - SLP_TREE_CHILDREN (*this->m_node).quick_push (this->m_ops[1]); - SLP_TREE_CHILDREN (*this->m_node).quick_push (newnode); /* And then rewrite the node itself. */ complex_pattern::build (vinfo); @@ -1334,11 +1397,12 @@ class complex_operations_pattern : public complex_pattern public: void build (vec_info *); static internal_fn - matches (complex_operation_t op, slp_tree_to_load_perm_map_t *, slp_tree *, - vec *); + matches (complex_operation_t op, slp_tree_to_load_perm_map_t *, + slp_compat_nodes_map_t *, slp_tree *, vec *); static vect_pattern* - recognize (slp_tree_to_load_perm_map_t *, slp_tree *); + recognize (slp_tree_to_load_perm_map_t *, slp_compat_nodes_map_t *, + slp_tree *); }; /* Dummy matches implementation for proxy object. */ @@ -1347,6 +1411,7 @@ internal_fn complex_operations_pattern:: matches (complex_operation_t /* op */, slp_tree_to_load_perm_map_t * /* perm_cache */, + slp_compat_nodes_map_t * /* compat_cache */, slp_tree * /* ref_node */, vec * /* ops */) { return IFN_LAST; @@ -1356,6 +1421,7 @@ matches (complex_operation_t /* op */, vect_pattern* complex_operations_pattern::recognize (slp_tree_to_load_perm_map_t *perm_cache, + slp_compat_nodes_map_t *ccache, slp_tree *node) { auto_vec ops; @@ -1363,15 +1429,15 @@ complex_operations_pattern::recognize (slp_tree_to_load_perm_map_t *perm_cache, = vect_detect_pair_op (*node, true, &ops); internal_fn ifn = IFN_LAST; - ifn = complex_fms_pattern::matches (op, perm_cache, node, &ops); + ifn = complex_fms_pattern::matches (op, perm_cache, ccache, node, &ops); if (ifn != IFN_LAST) return complex_fms_pattern::mkInstance (node, &ops, ifn); - ifn = complex_mul_pattern::matches (op, perm_cache, node, &ops); + ifn = complex_mul_pattern::matches (op, perm_cache, ccache, node, &ops); if (ifn != IFN_LAST) return complex_mul_pattern::mkInstance (node, &ops, ifn); - ifn = complex_add_pattern::matches (op, perm_cache, node, &ops); + ifn = complex_add_pattern::matches (op, perm_cache, ccache, node, &ops); if (ifn != IFN_LAST) return complex_add_pattern::mkInstance (node, &ops, ifn); @@ -1398,11 +1464,13 @@ class addsub_pattern : public vect_pattern void build (vec_info *); static vect_pattern* - recognize (slp_tree_to_load_perm_map_t *, slp_tree *); + recognize (slp_tree_to_load_perm_map_t *, slp_compat_nodes_map_t *, + slp_tree *); }; vect_pattern * -addsub_pattern::recognize (slp_tree_to_load_perm_map_t *, slp_tree *node_) +addsub_pattern::recognize (slp_tree_to_load_perm_map_t *, + slp_compat_nodes_map_t *, slp_tree *node_) { slp_tree node = *node_; if (SLP_TREE_CODE (node) != VEC_PERM_EXPR diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index b912c3577df61a694d5bb9e22c5303fe6a48ab6e..cb577f8a612d583254e42bb06a6d7a0875de5e75 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -804,7 +804,7 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap, /* Return true if call statements CALL1 and CALL2 are similar enough to be combined into the same SLP group. */ -static bool +bool compatible_calls_p (gcall *call1, gcall *call2) { unsigned int nargs = gimple_call_num_args (call1); @@ -2907,6 +2907,7 @@ optimize_load_redistribution (scalar_stmts_to_slp_tree_map_t *bst_map, static bool vect_match_slp_patterns_2 (slp_tree *ref_node, vec_info *vinfo, slp_tree_to_load_perm_map_t *perm_cache, + slp_compat_nodes_map_t *compat_cache, hash_set *visited) { unsigned i; @@ -2918,11 +2919,13 @@ vect_match_slp_patterns_2 (slp_tree *ref_node, vec_info *vinfo, slp_tree child; FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child) found_p |= vect_match_slp_patterns_2 (&SLP_TREE_CHILDREN (node)[i], - vinfo, perm_cache, visited); + vinfo, perm_cache, compat_cache, + visited); for (unsigned x = 0; x < num__slp_patterns; x++) { - vect_pattern *pattern = slp_patterns[x] (perm_cache, ref_node); + vect_pattern *pattern + = slp_patterns[x] (perm_cache, compat_cache, ref_node); if (pattern) { pattern->build (vinfo); @@ -2943,7 +2946,8 @@ vect_match_slp_patterns_2 (slp_tree *ref_node, vec_info *vinfo, static bool vect_match_slp_patterns (slp_instance instance, vec_info *vinfo, hash_set *visited, - slp_tree_to_load_perm_map_t *perm_cache) + slp_tree_to_load_perm_map_t *perm_cache, + slp_compat_nodes_map_t *compat_cache) { DUMP_VECT_SCOPE ("vect_match_slp_patterns"); slp_tree *ref_node = &SLP_INSTANCE_TREE (instance); @@ -2953,7 +2957,8 @@ vect_match_slp_patterns (slp_instance instance, vec_info *vinfo, "Analyzing SLP tree %p for patterns\n", SLP_INSTANCE_TREE (instance)); - return vect_match_slp_patterns_2 (ref_node, vinfo, perm_cache, visited); + return vect_match_slp_patterns_2 (ref_node, vinfo, perm_cache, compat_cache, + visited); } /* STMT_INFO is a store group of size GROUP_SIZE that we are considering @@ -3437,12 +3442,14 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size) hash_set visited_patterns; slp_tree_to_load_perm_map_t perm_cache; + slp_compat_nodes_map_t compat_cache; /* See if any patterns can be found in the SLP tree. */ bool pattern_found = false; FOR_EACH_VEC_ELT (LOOP_VINFO_SLP_INSTANCES (vinfo), i, instance) pattern_found |= vect_match_slp_patterns (instance, vinfo, - &visited_patterns, &perm_cache); + &visited_patterns, &perm_cache, + &compat_cache); /* If any were found optimize permutations of loads. */ if (pattern_found) diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 2f6e1e268fb07e9de065ff9c45af87546e565d66..83cd0919c7838c65576e1debd881e0ec636a605a 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -2268,6 +2268,7 @@ extern void duplicate_and_interleave (vec_info *, gimple_seq *, tree, extern int vect_get_place_in_interleaving_chain (stmt_vec_info, stmt_vec_info); extern slp_tree vect_create_new_slp_node (unsigned, tree_code); extern void vect_free_slp_tree (slp_tree); +extern bool compatible_calls_p (gcall *, gcall *); /* In tree-vect-patterns.c. */ extern void @@ -2306,6 +2307,12 @@ typedef enum _complex_perm_kinds { typedef hash_map slp_tree_to_load_perm_map_t; +/* Cache from nodes pair to being compatible or not. */ +typedef pair_hash , + nofree_ptr_hash <_slp_tree>> slp_node_hash; +typedef hash_map slp_compat_nodes_map_t; + + /* Vector pattern matcher base class. All SLP pattern matchers must inherit from this type. */ @@ -2338,7 +2345,8 @@ class vect_pattern public: /* Create a new instance of the pattern matcher class of the given type. */ - static vect_pattern* recognize (slp_tree_to_load_perm_map_t *, slp_tree *); + static vect_pattern* recognize (slp_tree_to_load_perm_map_t *, + slp_compat_nodes_map_t *, slp_tree *); /* Build the pattern from the data collected so far. */ virtual void build (vec_info *) = 0; @@ -2352,6 +2360,7 @@ class vect_pattern /* Function pointer to create a new pattern matcher from a generic type. */ typedef vect_pattern* (*vect_pattern_decl_t) (slp_tree_to_load_perm_map_t *, + slp_compat_nodes_map_t *, slp_tree *); /* List of supported pattern matchers. */ From patchwork Fri Dec 17 15:42:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 49052 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3EB9B3858010 for ; Fri, 17 Dec 2021 15:45:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3EB9B3858010 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1639755917; bh=6Gpfx7jh1kAAJgeF6hcY/AA+ol6imHo/37c+eWmCudY=; 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=SzmvstnSDPcKVB500P+n/EKZ1VlmYVHq/NpoCcT1XyToID3Y5Sjw4m59TcJVR2jNl 0OVT+qgEFPU+rc+OVU1HY/RKkW8lYcFUKranCP0JNzc9GFAGy4hOV78QNP4zgV/pRP Z/15NTlFnGbk/w7EiCTdLk6iUT9N346/4/a5PMvM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140081.outbound.protection.outlook.com [40.107.14.81]) by sourceware.org (Postfix) with ESMTPS id 7F3B73858412 for ; Fri, 17 Dec 2021 15:43:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7F3B73858412 Received: from AM3PR07CA0105.eurprd07.prod.outlook.com (2603:10a6:207:7::15) by AM9PR08MB6051.eurprd08.prod.outlook.com (2603:10a6:20b:2d6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 15:43:07 +0000 Received: from VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:207:7:cafe::f1) by AM3PR07CA0105.outlook.office365.com (2603:10a6:207:7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.8 via Frontend Transport; Fri, 17 Dec 2021 15:43:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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 VE1EUR03FT010.mail.protection.outlook.com (10.152.18.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Fri, 17 Dec 2021 15:43:06 +0000 Received: ("Tessian outbound c61f076cbd30:v110"); Fri, 17 Dec 2021 15:43:06 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c9303553868c5953 X-CR-MTA-TID: 64aa7808 Received: from 8d7c88051f4f.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5159F57C-DCDD-4FCD-BD33-90EC4FBF21B1.1; Fri, 17 Dec 2021 15:42:59 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8d7c88051f4f.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 17 Dec 2021 15:42:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b/k3DrXnfBmn+TLKRHmfBh1k1lFtPiHKG/2JoqjvPVNi0ywlxwm+Ku5nDU8kKKHPWFITZu8qeVGO/yxUk7r4R1ulFPThuJ+SI78yPQyFEA1q6/zoes5Iz9UIYW2s/oqThGR7fI5Zp0IJXOCse4W+ocO+KmaOlbs4+lJXB4KWmGqZzAePfel9YEVI724ljFU1RGsl0uXg0NIOExt5kTFnOFXNxSCz+T81/tPGxvv9/Q6FM/s/1qdzqrMZsVKaeARRtEo8/WfT91ep2Ly4VFtaj358NeF31CxW1NtRiw3PqFpwVtYgBS+IRN4BfNOrVPnmyrngQX04u6T49KyXAnFQ0g== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6Gpfx7jh1kAAJgeF6hcY/AA+ol6imHo/37c+eWmCudY=; b=IBBjZrbkZzgwQnSC7o9K8HwR7KEheTtkicP6K/15Q81Q7bCxp3d0X07gE6Hu666gvWBqqjG7H+V6aGRoNNAoicy9pqTNKeS1/RDHK5MQrFNRDuyqeqEp0AFIfCZVz1umhvghMMgtTBMp1tBu0pQlT4GDTvIsN14gl5p99P0UObF1jfyAXu4MVXdVjFZB45JfCb6JFuE6X4JWTbFzhJeYF51UebsqZuiLfY6Yj2mJFOygehtbrCMyvjdRv+Ik/h0YAoa+c1yJaodd9tzMEHmrh1MgsL2HsGNEjlZOHWx57pnurtFQEAH51BqcXb6iIDEnCw3cB2t/SLucG7L/Z36aUQ== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by VE1PR08MB4863.eurprd08.prod.outlook.com (2603:10a6:802:ac::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 15:42:57 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::12a:3d2c:81ff:8fcc]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::12a:3d2c:81ff:8fcc%8]) with mapi id 15.20.4778.018; Fri, 17 Dec 2021 15:42:57 +0000 Date: Fri, 17 Dec 2021 15:42:53 +0000 To: gcc-patches@gcc.gnu.org Subject: [2/3 PATCH]AArch64 use canonical ordering for complex mul, fma and fms Message-ID: <20211217154251.GA4694@arm.com> Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: LO2P265CA0369.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::21) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 9c42066a-d3d5-4dc4-5bdf-08d9c173ebac X-MS-TrafficTypeDiagnostic: VE1PR08MB4863:EE_|VE1EUR03FT010:EE_|AM9PR08MB6051:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:4303;OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: T5/Kjg+ul4fmXq5P8LVr8paEBHyUHVWzVwCue8kE12WzCy+5xgDh5L/5RWvAEWaz9KW+7Kh9y/euhMajqiXkqIGzfnc4qEjzFjsT375EPHtGBgVQUCANteGC5jaI+t36bl8Noqkqp6o8F1HhMxUb99cQeFIUAVph3Rv9wooSh/ArEwrCcOTV083TYYI9O25wmYA0zZPUwAhe3ta+pZJE2/+f47SOruzPdzWlJfDU22YwkEiQQw87594mRiA9kJ27oPuduq2yEGPoK1pb/rcISUVHwKookWqTkikgg/hW+jimmhabiIW86khmAzQKFjtSqWvwSOEPb543zh/zuCQHsODURbNzirj8+DzMPH6RpIuEBnHjkwC3OuVHdlnKzcO0pd0ZvI+7V32m3pLqj47XFBd63faBX48peGFNqeualatGbPwEO1zioh2VtV1RmYLxfwrhPcBPBSEhKsH97ew0gPN8AMwKtpnet8CwECj3PJHsmSGmOq1V3E2bjBkrbFITpgN6gJ/bJzg1qCyU5tMLRtSqsbS+6BedUtt4P0tI0eu6ONupvyKvDzIA3jm+Q3qCZHdmlGhAwgdNb0jvekmHk8dxg1Mtn0V+LznpNXY5D33t7GNnH8KPheduQpBIbs+5RqAUbXrHigbqq+M/V5IdenE5bHGPHB/mE43tPlaKOzdXy9C8pfQ+ArEg+16QL2pi6wWlL+e6bvEX0x2H6Eez2cYQ6NDC8T0hzKEVxhPe/Kk= 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)(366004)(52116002)(2906002)(6916009)(86362001)(508600001)(6486002)(26005)(6506007)(33964004)(186003)(8676002)(44144004)(8936002)(5660300002)(316002)(33656002)(66476007)(235185007)(66946007)(1076003)(36756003)(2616005)(38350700002)(6512007)(38100700002)(66556008)(4743002)(4326008)(6666004)(83380400001)(44832011)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4863 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: e8a2b130-2ede-4d36-4352-08d9c173e609 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ycUvkIQASmdKDMSkLSr/yeyutCazRuCQKrOPpWJsPPuRzQEe+gUVmOXKiTUd3GBRalRifHrsrzMtDpjyDLhdUsCijdTFTJVXJKu0xYAilNi9n/oFgCzVqz/fTDcLpG9F0ZNHGYoR2T5E++wJ5ut6xNFF7x9YJQzq3N0v9M/CNObjLnNE1xDbT0tdPAnV3HFoXz60LsjVNK+vbsgrPmyxKbF0No9KGDabeMeKwqYG4ZTseHZvHzB6433AWh2pvXGFw2nDJ7uqvl+A1Oc8BQusdz3FBwUz5nX8Irv4xkTa63oWECaHrWGqd71IVG81b8VOls06R0WoNRGS+53DGJydXdt2bbicy4KV/VC9p2jJ9VHIn/HvXDf4Fj8kAlXWTHxQdarplZV2TgC9qT9mTP19c03HVUIlfgGzbLwApTOzzWEBvJNiU3YT3xrIWiquSw2NG/B+cGwZhC3XHo0296P2EG6bQPPs+lPDVJHEEhuBpOLu3t0ZHc9LMT/HjpNOvt4IWswFI4YNblJZzRUessokbuxfxVIStLY1kAzFVXnrUbIlUnaVQgpj+3krPpBrAdL7BiESlE5oYXsCOwtr3yBw6e+QftlKEI75zdx3k/u0lpojj0RXYr80aNeu8MB7DZSoqMZqkxVC/rQEusgIzMb+faHe5i1YX3YcEB6Ng7Jt0ks3kZ2YRovsrXdRFZzZTj3KWVStAWv+7r+ICR5d/hIUuN0U/OVzNONvzBBx8aIPQNc= 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)(36840700001)(46966006)(8676002)(44832011)(36756003)(2616005)(33656002)(4326008)(6666004)(6486002)(47076005)(26005)(8936002)(1076003)(6506007)(70586007)(6916009)(6512007)(186003)(336012)(86362001)(44144004)(83380400001)(2906002)(33964004)(36860700001)(70206006)(5660300002)(81166007)(356005)(4743002)(82310400004)(508600001)(235185007)(316002)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2021 15:43:06.7554 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c42066a-d3d5-4dc4-5bdf-08d9c173ebac 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: VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6051 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Richard.Earnshaw@arm.com, nd@arm.com, richard.sandiford@arm.com, Marcus.Shawcroft@arm.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi All, After the first patch in the series this updates the optabs to expect the canonical sequence. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? and backport along with the first patch? Thanks, Tamar gcc/ChangeLog: PR tree-optimization/102819 PR tree-optimization/103169 * config/aarch64/aarch64-simd.md (cml4, cmul3): Use canonical order. * config/aarch64/aarch64-sve.md (cml4, cmul3): Likewise. --- inline copy of patch -- diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index f95a7e1d91c97c9e981d75e71f0b49c02ef748ba..875896ee71324712c8034eeff9cfb5649f9b0e73 100644 diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index f95a7e1d91c97c9e981d75e71f0b49c02ef748ba..875896ee71324712c8034eeff9cfb5649f9b0e73 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -556,17 +556,17 @@ (define_insn "aarch64_fcmlaq_lane" ;; remainder. Because of this, expand early. (define_expand "cml4" [(set (match_operand:VHSDF 0 "register_operand") - (plus:VHSDF (match_operand:VHSDF 1 "register_operand") - (unspec:VHSDF [(match_operand:VHSDF 2 "register_operand") - (match_operand:VHSDF 3 "register_operand")] - FCMLA_OP)))] + (plus:VHSDF (unspec:VHSDF [(match_operand:VHSDF 1 "register_operand") + (match_operand:VHSDF 2 "register_operand")] + FCMLA_OP) + (match_operand:VHSDF 3 "register_operand")))] "TARGET_COMPLEX && !BYTES_BIG_ENDIAN" { rtx tmp = gen_reg_rtx (mode); - emit_insn (gen_aarch64_fcmla (tmp, operands[1], - operands[3], operands[2])); + emit_insn (gen_aarch64_fcmla (tmp, operands[3], + operands[1], operands[2])); emit_insn (gen_aarch64_fcmla (operands[0], tmp, - operands[3], operands[2])); + operands[1], operands[2])); DONE; }) @@ -583,9 +583,9 @@ (define_expand "cmul3" rtx tmp = force_reg (mode, CONST0_RTX (mode)); rtx res1 = gen_reg_rtx (mode); emit_insn (gen_aarch64_fcmla (res1, tmp, - operands[2], operands[1])); + operands[1], operands[2])); emit_insn (gen_aarch64_fcmla (operands[0], res1, - operands[2], operands[1])); + operands[1], operands[2])); DONE; }) diff --git a/gcc/config/aarch64/aarch64-sve.md b/gcc/config/aarch64/aarch64-sve.md index 9ef968840c20a3049901b3f8a919cf27ded1da3e..96a57442c7eb5f1080c8014a2f0311b2350de852 100644 --- a/gcc/config/aarch64/aarch64-sve.md +++ b/gcc/config/aarch64/aarch64-sve.md @@ -7278,11 +7278,11 @@ (define_expand "cml4" rtx tmp = gen_reg_rtx (mode); emit_insn (gen_aarch64_pred_fcmla (tmp, operands[4], - operands[3], operands[2], - operands[1], operands[5])); + operands[1], operands[2], + operands[3], operands[5])); emit_insn (gen_aarch64_pred_fcmla (operands[0], operands[4], - operands[3], operands[2], + operands[1], operands[2], tmp, operands[5])); DONE; }) @@ -7305,11 +7305,11 @@ (define_expand "cmul3" rtx tmp = gen_reg_rtx (mode); emit_insn (gen_aarch64_pred_fcmla (tmp, pred_reg, - operands[2], operands[1], + operands[1], operands[2], accum, gp_mode)); emit_insn (gen_aarch64_pred_fcmla (operands[0], pred_reg, - operands[2], operands[1], + operands[1], operands[2], tmp, gp_mode)); DONE; }) From patchwork Fri Dec 17 15:43:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 49053 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 92C393858018 for ; Fri, 17 Dec 2021 15:46:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92C393858018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1639755998; bh=NXE1pYyxOq7YkYZydvTZ3DUFgMqLYNbsNhjBrYROuv8=; 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=OyMCjoShUZLFtXPiirROUIpn5OGCnjR/TwB903a1YVPxGhZmkI6gCEVw0ohpXh1mk BLQv6RspCCI8hgigSDUl174bsT/grXWLlW9Kj1kKVzWPMmHgBjKmQR1QYGNSktsXU5 +C7CdYehPzs2HHTUllgJCjvEvBIBplIqMerA8l2o= 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-db8eur05on2054.outbound.protection.outlook.com [40.107.20.54]) by sourceware.org (Postfix) with ESMTPS id B2B773858430 for ; Fri, 17 Dec 2021 15:43:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B2B773858430 Received: from AM6P193CA0039.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::16) by AM9PR08MB6180.eurprd08.prod.outlook.com (2603:10a6:20b:2d4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Fri, 17 Dec 2021 15:43:28 +0000 Received: from VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8e:cafe::60) by AM6P193CA0039.outlook.office365.com (2603:10a6:209:8e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.15 via Frontend Transport; Fri, 17 Dec 2021 15:43:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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 VE1EUR03FT055.mail.protection.outlook.com (10.152.19.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Fri, 17 Dec 2021 15:43:28 +0000 Received: ("Tessian outbound dbb52aec1fa6:v110"); Fri, 17 Dec 2021 15:43:28 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 97c5e7d8c6398dc6 X-CR-MTA-TID: 64aa7808 Received: from 87bb64d7dda4.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 13A38AC0-4674-4A95-B99E-9065EC7F0D66.1; Fri, 17 Dec 2021 15:43:17 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 87bb64d7dda4.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 17 Dec 2021 15:43:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lNuzya3v60t9S7bh4QjokCB8QvoOa93VCI+7kzkdVSqVCU0+ES2XYnnX42x35anY87aHYUmBqglnwyTDV+2ZKYTrSGLq0VgUxm87q+Ur40tllML6lbtJhz3YJaL/h0ara7w0bdAhV+rneiL5f3TIKtOeYabAgpFy5HkYqxYjc1iXcYC9bmkxcSytfJkygx8zkXCKvWCXO9Msi+gX/WMhNSnHPHvrUewfrh4uDZcUgc/bJvTtjwICcwWI7uTZhqnm5gLsk77aHcSE37uwtenB93Z6PwR54/vKHvDt8Wa95xE0OJHcIlEh3W5i9GmVEJxn9CZuc/j38ctGKWXdZ9yIeQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NXE1pYyxOq7YkYZydvTZ3DUFgMqLYNbsNhjBrYROuv8=; b=oGZbZe8ck6iyoY4weRhDfod1IJSaBK1XGPnSVH0N5/rSNzfgOrsNgdMD5UPBxiA9OtfPfVixKB7G90Id1ZdM8Owb9K559PDPbcrgep1JyXlHznz//3hzqOi1kFrp9sUSxzf5n9Sq4Zrt1gk1csifB3xpOQiwbsBaDLhoLqmvDibn+N3P3GnB6z8Lzo5mTpV1VnX0DVnTBgs1YuBJqzVRc0AccQKJO7mMGznBV2Ny/dzwDKPvsaKXPvY2UX5UYu2b7akMHjtGMrn8EcgSz0ZezX+7AnYa4feV3d0t9MgXRYBarxjPe8sbCHWpV8ElbP6lWxfJyAJ1Mn0V73qpiZir/A== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by VI1PR0802MB2352.eurprd08.prod.outlook.com (2603:10a6:800:9e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Fri, 17 Dec 2021 15:43:15 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::12a:3d2c:81ff:8fcc]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::12a:3d2c:81ff:8fcc%8]) with mapi id 15.20.4778.018; Fri, 17 Dec 2021 15:43:15 +0000 Date: Fri, 17 Dec 2021 15:43:12 +0000 To: gcc-patches@gcc.gnu.org Subject: [3/3 PATCH][AArch32] use canonical ordering for complex mul, fma and fms Message-ID: <20211217154310.GA9498@arm.com> Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: LO2P265CA0054.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::18) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: eabd1d92-ebfa-42d9-4be1-08d9c173f86b X-MS-TrafficTypeDiagnostic: VI1PR0802MB2352:EE_|VE1EUR03FT055:EE_|AM9PR08MB6180:EE_ X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:4303;OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: NjMILCU5wGRel2CLtEahJGuIqCX01KeI8VDd/zte0q1ldQ++CktRwB77//yrPjtqMlGH2DfLF/FJSp44vv3MZ581+eLv3VGLg8AQsVoXPdux3F236G/Qv3+KFkeNguhv2CzmmFsoM88yWb8NULZP+E0or6FzwIzaFx2Wkd5Z7IeiMW5iHo+EJ7q+hHSuICtjZPz6R57+TpheYs48riyQMo8xTFXS5T9FfAMa/XbzsPfrviSyUylXD6gxi8XBeDxtOm6IDHrEIrRFcKLMMZsHpZY+VMVtQNM45NRTRuK/Lxdhdl5lP/MbH4l8vGTLT1besDRdCk+CE9vIRmkr5HCUvKEhCBmuSWFjD/ZJN0h3X25+sWTgGYfpxr19Z6m536LWesER8ZAHqr6og40r3YSe707+HiXVfpdVtDt5+MT8iByk8cCclxSxvHK0PvkAjgZ2l8Ra81yu7N5+CXVUxzMrhMaVwLQyOGClzh9vPEVEOkWfv+h2OuOs5/wFKU0H3krYZWU/mrbCLwVqTYfdcyubRGAKtcJg9XOQsL2zVEj6el64LMMBlS/+16ht5ePLFwbVH4900UPcNFMOWQe8k1Roj5TZwSHLQr8mZSyTkvE6NstEo7myPQdSzGnT1YRVuCa+mgsP7LkXqmw6tMqRphCtBqFoQWp1wStp5KTS6jf+B8/0rIZ/q6fSjiree9t0YVIOmATGQ5i1AvNF2x8cx/j2gCmEaUbCllc65wPXQjeieUQ= 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)(366004)(66946007)(6512007)(6916009)(316002)(52116002)(8936002)(38350700002)(6666004)(83380400001)(6486002)(4326008)(33656002)(6506007)(4743002)(508600001)(2616005)(66556008)(1076003)(66476007)(2906002)(86362001)(44832011)(235185007)(38100700002)(186003)(36756003)(5660300002)(8676002)(26005)(44144004)(33964004)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2352 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 4da5c5e0-6809-47a0-0442-08d9c173f09e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8bv/xUfFHOdFQYNQ5+lFouvuJ5y63dqb1+W5D9SVDHKXe1C9RAs3ClB1lMJvRPbHH6330wDkR96zNhL6EylchYT8MUyq5xlhJvxbcM8EZb//hUswiaYSR0tKpKiag0McAbmXjfzQ+t8JH8Uq+aB5wyv+al/OWDeYSBCPu2CrEHNurbe72ZFP/QBIuTDjEOoP2I0e0j7yuEQ3ZgEdE8ME6hEoWlSA63o91slZ7cDEHHB9muspfHEIegnayCFKJUgFjEkPvciUtdsACTe9xVlLN7OXXHlk7VjaQ91echJ4PNW9KFV8DIqB/jeiemWZ3ekztqgu34OlQXCpSCxUYx/RXEkmXXt0Wr6y5arqX3ExcnSMzhY50nxrbbf6VXMBVn+C29PQqd/EgStli4ZE99edwl3VeJpxw94l68UFH3sNDFEuARVRhr0bZm68/Ofj2IhytLUrzVp3iKpiS7UjSV82CAqYh5UGl55ENApllspcAG/EEwthOS0Fvg+5LQOzTbfWJ8FUBWtSrr75Y5RKsefHEgNbGmzHAM6RXmmrfwRRmaU00UfhXPNO9B2yqj2sOXVTn5wySrcISdm/w/0rdlXGMfpmpEdu9pf28DPguQerrGhqTvVcn3e9n3FxsQLIbzby1TwOz5I9d4CgzgwwMMdWAUXasAjDDWdvT+m2Vo0YYf4cumuBmYxUl/x7tOyNyDycY2fHsVW7sYQOEdExUDdNrPUt57rhXpqrds72MANEKZSZaUhViP8MjvRZju13tFD6vAcNEKoR9lAAiCsg03wg7gk2WPsrHhhEDxN/oAU0bSk= 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)(36840700001)(46966006)(40470700001)(36756003)(81166007)(70586007)(33656002)(70206006)(26005)(8676002)(6486002)(4326008)(6512007)(336012)(86362001)(316002)(186003)(6916009)(44832011)(36860700001)(235185007)(6506007)(40460700001)(8936002)(508600001)(1076003)(82310400004)(33964004)(2616005)(4743002)(356005)(6666004)(2906002)(83380400001)(44144004)(5660300002)(47076005)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2021 15:43:28.1410 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eabd1d92-ebfa-42d9-4be1-08d9c173f86b 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: VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6180 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Richard.Earnshaw@arm.com, nd@arm.com, Ramana.Radhakrishnan@arm.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi All, After the first patch in the series this updates the optabs to expect the canonical sequence. Bootstrapped Regtested on arm-none-linux-gnueabihf and no issues. Ok for master? and backport along with the first patch? Thanks, Tamar gcc/ChangeLog: PR tree-optimization/102819 PR tree-optimization/103169 * config/arm/neon.md (cmul3): Use canon order. * config/arm/vec-common.md (cmul3, cml4): Likewise. --- inline copy of patch -- diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md index 8b0a396947cc8e7345f178b926128d7224fb218a..2b6ae67a7ec6bef505c2eaef0ec495d14c656495 100644 diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md index 8b0a396947cc8e7345f178b926128d7224fb218a..2b6ae67a7ec6bef505c2eaef0ec495d14c656495 100644 --- a/gcc/config/arm/neon.md +++ b/gcc/config/arm/neon.md @@ -2859,9 +2859,9 @@ (define_expand "cmul3" rtx res1 = gen_reg_rtx (mode); rtx tmp = force_reg (mode, CONST0_RTX (mode)); emit_insn (gen_neon_vcmla (res1, tmp, - operands[2], operands[1])); + operands[1], operands[2])); emit_insn (gen_neon_vcmla (operands[0], res1, - operands[2], operands[1])); + operands[1], operands[2])); DONE; }) diff --git a/gcc/config/arm/vec-common.md b/gcc/config/arm/vec-common.md index e71d9b3811fde62159f5c21944fef9fe3f97b4bd..0940e987de53e191f4abdd248c654aed69f016f7 100644 --- a/gcc/config/arm/vec-common.md +++ b/gcc/config/arm/vec-common.md @@ -239,14 +239,14 @@ (define_expand "cmul3" { rtx tmp = force_reg (mode, CONST0_RTX (mode)); emit_insn (gen_arm_vcmla (res1, tmp, - operands[2], operands[1])); + operands[1], operands[2])); } else emit_insn (gen_arm_vcmla (res1, CONST0_RTX (mode), - operands[2], operands[1])); + operands[1], operands[2])); emit_insn (gen_arm_vcmla (operands[0], res1, - operands[2], operands[1])); + operands[1], operands[2])); DONE; }) @@ -265,18 +265,18 @@ (define_expand "arm_vcmla" ;; remainder. Because of this, expand early. (define_expand "cml4" [(set (match_operand:VF 0 "register_operand") - (plus:VF (match_operand:VF 1 "register_operand") - (unspec:VF [(match_operand:VF 2 "register_operand") - (match_operand:VF 3 "register_operand")] - VCMLA_OP)))] + (plus:VF (unspec:VF [(match_operand:VF 1 "register_operand") + (match_operand:VF 2 "register_operand")] + VCMLA_OP) + (match_operand:VF 3 "register_operand")))] "(TARGET_COMPLEX || (TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT && ARM_HAVE__ARITH)) && !BYTES_BIG_ENDIAN" { rtx tmp = gen_reg_rtx (mode); - emit_insn (gen_arm_vcmla (tmp, operands[1], - operands[3], operands[2])); + emit_insn (gen_arm_vcmla (tmp, operands[3], + operands[1], operands[2])); emit_insn (gen_arm_vcmla (operands[0], tmp, - operands[3], operands[2])); + operands[1], operands[2])); DONE; })