From patchwork Fri Sep 25 14:28:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1371341 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=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=lznPVSZB; 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=lznPVSZB; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4ByZ6w1qnZz9sR4 for ; Sat, 26 Sep 2020 00:29:28 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5BD1C398B86D; Fri, 25 Sep 2020 14:29:26 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2089.outbound.protection.outlook.com [40.107.22.89]) by sourceware.org (Postfix) with ESMTPS id 73070398B400 for ; Fri, 25 Sep 2020 14:29:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 73070398B400 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=zAgCDFAIpsXApfuS190Tg0xG//RojuHHKfHNMDubn80=; b=lznPVSZBrgAc9jWfTIxoiDQjpU3dkVuK8al4/mLwE+cUW671Es5Cv2A8vP1qEhKIcvQ12nJF+OfmECi0xbA9aZASHRDeQSmAIFuv+/HnTj/h5tkKL9Lfcsg5g/T0+SE9wk4bDJBoh0fNYPMPSrd5fNo+BwYHw1/lgU/OI/V7IRI= Received: from AM6P195CA0003.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:81::16) by VI1PR08MB4286.eurprd08.prod.outlook.com (2603:10a6:803:f6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21; Fri, 25 Sep 2020 14:29:20 +0000 Received: from AM5EUR03FT023.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:81:cafe::1f) by AM6P195CA0003.outlook.office365.com (2603:10a6:209:81::16) 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:29: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 AM5EUR03FT023.mail.protection.outlook.com (10.152.16.169) 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:29:20 +0000 Received: ("Tessian outbound e8cdb8c6f386:v64"); Fri, 25 Sep 2020 14:29:20 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9454446fccfff07a X-CR-MTA-TID: 64aa7808 Received: from 936e2253589e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 55BFDA7B-72C2-4F3E-83F1-75A1A3AC825F.1; Fri, 25 Sep 2020 14:29:07 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 936e2253589e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 25 Sep 2020 14:29:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e4Wv2geNzx4+j+JkP+ytPF6izgfEkiOZftTRgO/+ZBi1u8OIWd5K0mL5JC67honc3MquwbgFUs2gW/tTWqSKeJc6t+sS9310HXbNNUjBVlB1IFUY1cExodRVk2BmLLRbCgnz2h2DInRlzAy2l/mY0yWgQUNlFlKmYQULDwNoW07oFArMOJqWylbvwhVf2y2JQPKaoQd2M0NR8QrFynApUk4MBebESGJI2eTk7Aoaw9ujCh/KrIxvrqYk067yF3RCTDT+2XbEQncz7DCWQD9jm9qKv8yliIPAT+vzXI2kd5/97JJBuvY9eyf16Lv8gHxV1rDuSECV6QXtbSrupgv/yg== 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=zAgCDFAIpsXApfuS190Tg0xG//RojuHHKfHNMDubn80=; b=SotIYwS9GuPMo/OsxLzkyRAMbK9nedLhvoHkI2QgiZPWTL1MYb5nc/85USezA1TG6A9Oh389zBkDjeljQElZG2eN04nbVPTlQKg6caJeWszhSEh0+gHhf4p/ZJJMjZUiNioWYgnCkv56sUmWos134jze9F3NJ/oeZA5ske2eJmwWtDBOw4YA+mr8tQGhAA4lAqawN4N9zAjIvG3E1l1hYG/86/rymhiBr5qCRUnrxqe0cH9IpIMJ2lZbDn+kV5POD9EKjM9k3+S0DwJy6s7QDv47MCw977/1sC27ddbIFmVGb3kzpoLCQwBIkClFcbRez1qWJuGS95UGQ2axcBcrmw== 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=zAgCDFAIpsXApfuS190Tg0xG//RojuHHKfHNMDubn80=; b=lznPVSZBrgAc9jWfTIxoiDQjpU3dkVuK8al4/mLwE+cUW671Es5Cv2A8vP1qEhKIcvQ12nJF+OfmECi0xbA9aZASHRDeQSmAIFuv+/HnTj/h5tkKL9Lfcsg5g/T0+SE9wk4bDJBoh0fNYPMPSrd5fNo+BwYHw1/lgU/OI/V7IRI= 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:29:06 +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:29:06 +0000 Date: Fri, 25 Sep 2020 15:28:58 +0100 From: Tamar Christina To: gcc-patches@gcc.gnu.org Subject: [PATCH v2 6/16]middle-end Add Complex Addition with rotation detection Message-ID: <20200925142856.GA17824@arm.com> Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: SN4PR0601CA0007.namprd06.prod.outlook.com (2603:10b6:803:2f::17) 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 SN4PR0601CA0007.namprd06.prod.outlook.com (2603:10b6:803:2f::17) 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:29:04 +0000 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b5c106fe-cb63-4920-4e9f-08d8615f6438 X-MS-TrafficTypeDiagnostic: VE1PR08MB5678:|VI1PR08MB4286: 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: b+7lkR7IHMILk2K0HAEssuRBSQhrxTpvyUWE2Dzz9HsGTVq9tUvYyMNxIljBbfKaDTVsUa2fySUUMT79WQl6KLzBUQMvDyZetOOxisvWOhmwMiVW3o9lQTQRaxt7Nr86WFxEnEzN7ASrYgmlRAAtrVt2Qy9pay43cNqshmx+0e68mfgC16NPJQxznQ5QMpz371WYCFLMZgnsa3Zr87B2B9OuKHK5HdjUTkcrYsLOl313CI/DDEf36jv9Jb2wS4/pFdsd/AYO2qLseNVaf865oPEQPh8eE348Oi3lK3d42xU+Q/meB8nL5eMHHm4PpVArgmDpsDUuHEOvYaSiz5jYtXvDvDtol3rYBMjqauZwXsfK9kPaoWDP+Jm+HE1nYm+/E85OfUIA9ZGizdQZcUhD4d2tTGYAf3bhwtRx4phTX+0= 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)(6666004)(6916009)(235185007)(44144004)(5660300002)(16526019)(186003)(4743002)(4326008)(33964004)(52116002)(44832011)(7696005)(316002)(2616005)(26005)(2906002)(8676002)(956004)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hMMuhccMB2jNCvIulS2YmvJXRcCuVXuZtIAgnGBVf3LPZ+jevIsKitDYIw7nfxOoc2rk76IxVfVhYI2YaqulBPxxGhjenNBjqXVAM2j3TfD9LiRTobQ6bEzt8iq/FzEHVo1+brdDgU3o2AQ8IYbvx33ltYx/tQfd91vjwsv/UPjk4/0zvaT5eIFUnWCnExcYQuQF1mN65L/SKhNCRo2C/kBjYsgrn61ksAKM8WfDvu5nvjxYLjALu0+I7RQjWEB+sB+a6atPTna4LA89ZYyFm0Ncf+KMUhdGtKpWZbe1+E2F47gbgcYk5MpMM0IzRHhI9cS1K/OapLRqYsipsWr7sY6bsjj17A7hB2iMazE5k9CF3482VoL0vTqa/WU0L1Ey6Za1vZAKpOsC2uUPfRZsqjbbe6YNsr/Hr1UQFlhvVM8gP0KN2xPNWz0eby5EO72ziSEIV9WwakAIk7qR+yyfHLvI+jbCvqlpjKou2Ri4VVj+vFHT08ijbTtfNIkR2j4awbU91UrU6SRO7WL/Oq5o7mRR67F5RxvYOK22gp8J1OuYYbA8S9lUld78lo5QUsZg+PaiRF+KYoFykqodRhJYkAuIvQq/BdLaez/ZKPwY8pUn65bXAzcVtPyAomN2gn2o20utCKxdmJktTyzlvzAjQA== 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: AM5EUR03FT023.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 3e7b9eaa-2bdb-4c41-1672-08d8615f5baf X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xmHduiikshwxecTEBGUHYnum6xJVbg+MvpDeOuWhgoxjOXikPLXp1QiT6QpPIjzN5OZ0NSuQ4TJclRoBC/Q0i1WITfhr7UitC8IQktxDs+Yl6SVIDbO7NaicaSDQjuJDfNEA0KBGAOBg1NFYdDKX2iSl6Ybuuf5wzp3PDE4x2w/focaWuWCEEH0Ju/hQ66uEArVGGKkSfk4vczzRaNllSEWyqYclTwu6mFslytaq2nOpZvVFHQg0333dE3B/94WGxU7Ha1NNuqFJiRtja8u1U3e8WkrSKItIpV9Yr3RmPlCUXpR5pxwmfZZH5Vo93b+kNCkkkeI54gckFdSS3nb8oFhWrBYXw9uO1wwplTUzgESTEGEdPnEmKp7px0IQsvfMA//VexqQpgekkNjOFq/tE9G5vffOZnaVHy4ORXiwb4Q= 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)(136003)(376002)(346002)(396003)(39860400002)(46966005)(82740400003)(83380400001)(26005)(1076003)(33656002)(55016002)(4743002)(186003)(36756003)(6666004)(16526019)(44832011)(44144004)(356005)(33964004)(2616005)(956004)(81166007)(2906002)(7696005)(4326008)(47076004)(316002)(235185007)(86362001)(6916009)(5660300002)(82310400003)(8886007)(478600001)(36906005)(66616009)(70586007)(70206006)(8676002)(8936002)(336012)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2020 14:29:20.3384 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5c106fe-cb63-4920-4e9f-08d8615f6438 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: AM5EUR03FT023.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4286 X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 adds pattern detections for the following operation: Addition with rotation of the second argument around the Argand plane. Supported rotations are 90 and 180. c = a + (b * I) and c = a + (b * I * I) where a, b and c are complex numbers. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: * doc/md.texi: Document optabs. * internal-fn.def (COMPLEX_ADD_ROT90, COMPLEX_ADD_ROT270): New. * optabs.def (cadd90_optab, cadd270_optab): New. * tree-vect-slp-patterns.c (class ComplexAddPattern): New. (slp_patterns): Add ComplexAddPattern. diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index 2b46286943778e16d95b15def4299bcbf8db7eb8..71e226505b2619d10982b59a4ebbed73a70f29be 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -6132,6 +6132,17 @@ floating-point mode. This pattern is not allowed to @code{FAIL}. +@cindex @code{cadd@var{m}@var{n}3} instruction pattern +@item @samp{cadd@var{m}@var{n}3} +Perform a vector addition of complex numbers in operand 1 with operand 2 +rotated by @var{m} degrees around the argand plane and storing the result in +operand 0. The instruction must perform the operation on data loaded +contiguously into the vectors. +The operation is only supported for vector modes @var{n} and with +rotations @var{m} of 90 or 270. + +This pattern is not allowed to @code{FAIL}. + @cindex @code{ffs@var{m}2} instruction pattern @item @samp{ffs@var{m}2} Store into operand 0 one plus the index of the least significant 1-bit diff --git a/gcc/internal-fn.def b/gcc/internal-fn.def index 13e60828fcf5db6c5f15aae2bacd4cf04029e430..956a65a338c157b51de7e78a3fb005b5af78ef31 100644 --- a/gcc/internal-fn.def +++ b/gcc/internal-fn.def @@ -275,6 +275,8 @@ DEF_INTERNAL_FLT_FN (SCALB, ECF_CONST, scalb, binary) DEF_INTERNAL_FLT_FLOATN_FN (FMIN, ECF_CONST, fmin, binary) DEF_INTERNAL_FLT_FLOATN_FN (FMAX, ECF_CONST, fmax, binary) DEF_INTERNAL_OPTAB_FN (XORSIGN, ECF_CONST, xorsign, binary) +DEF_INTERNAL_OPTAB_FN (COMPLEX_ADD_ROT90, ECF_CONST, cadd90, binary) +DEF_INTERNAL_OPTAB_FN (COMPLEX_ADD_ROT270, ECF_CONST, cadd270, binary) /* FP scales. */ DEF_INTERNAL_FLT_FN (LDEXP, ECF_CONST, ldexp, binary) diff --git a/gcc/optabs.def b/gcc/optabs.def index 78409aa14537d259bf90277751aac00d452a0d3f..2bb0bf857977035bf562a77f5f6848e80edf936d 100644 --- a/gcc/optabs.def +++ b/gcc/optabs.def @@ -290,6 +290,8 @@ OPTAB_D (atan_optab, "atan$a2") OPTAB_D (atanh_optab, "atanh$a2") OPTAB_D (copysign_optab, "copysign$F$a3") OPTAB_D (xorsign_optab, "xorsign$F$a3") +OPTAB_D (cadd90_optab, "cadd90$a3") +OPTAB_D (cadd270_optab, "cadd270$a3") OPTAB_D (cos_optab, "cos$a2") OPTAB_D (cosh_optab, "cosh$a2") OPTAB_D (exp10_optab, "exp10$a2") diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c index 6453a5b1b6464dba833adc2c2a194db5e712bb79..b2b0ac62e9a69145470f41d2bac736dd970be735 100644 --- a/gcc/tree-vect-slp-patterns.c +++ b/gcc/tree-vect-slp-patterns.c @@ -663,12 +663,94 @@ graceful_exit: } }; +class ComplexAddPattern : public ComplexPattern +{ + protected: + ComplexAddPattern (slp_tree node, vec_info *vinfo) + : ComplexPattern (node, vinfo) + { + this->m_arity = 2; + this->m_num_args = 2; + this->m_vects.create (0); + this->m_defs.create (0); + } + + public: + ~ComplexAddPattern () + { + this->m_vects.release (); + this->m_defs.release (); + } + + static VectPattern* create (slp_tree node, vec_info *vinfo) + { + return new ComplexAddPattern (node, vinfo); + } + + const char* get_name () + { + return "Complex Addition"; + } + + /* Pattern matcher for trying to match complex addition pattern in SLP tree + using the N statements statements found in node starting at position IDX. + If the operation matches then IFN is set to the operation it matched and + the arguments to the two replacement statements are put in VECTS. + + If no match is found then IFN is set to IFN_LAST. + + This function matches the patterns shaped as: + + c[i] = a[i] - b[i+1]; + c[i+1] = a[i+1] + b[i]; + + If a match occurred then TRUE is returned, else FALSE. */ + + bool matches (stmt_vec_info *stmts, int idx) + { + this->m_last_ifn = IFN_LAST; + int base = idx - (this->m_arity - 1); + this->m_last_idx = idx; + this->m_stmt_info = stmts[0]; + + complex_operation_t op + = vect_detect_pair_op (base, this->m_node, &this->m_vects); + + /* Find the two components. Rotation in the complex plane will modify + the operations: + + * Rotation 0: + + + * Rotation 90: - + + * Rotation 180: - - + * Rotation 270: + - + + Rotation 0 and 180 can be handled by normal SIMD code, so we don't need + to care about them here. */ + if (op == MINUS_PLUS) + this->m_last_ifn = IFN_COMPLEX_ADD_ROT90; + else if (op == PLUS_MINUS) + this->m_last_ifn = IFN_COMPLEX_ADD_ROT270; + + if (this->m_last_ifn == IFN_LAST) + return false; + + /* Correct the arguments after matching. */ + std::swap (this->m_vects[1], this->m_vects[3]); + + /* If the two operands are the same, we don't have a permute. In such a case + there is no advantage in doing the replacement. */ + return store_results (); + } +}; + #define SLP_PATTERN(x) &x::create VectPatternDecl slp_patterns[] { /* For least amount of back-tracking and more efficient matching order patterns from the largest to the smallest. Especially if they overlap in what they can detect. */ + + SLP_PATTERN (ComplexAddPattern), }; #undef SLP_PATTERN