From patchwork Thu Jun 8 10:38:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oluwatamilore Adebayo X-Patchwork-Id: 104920 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp183660vqr; Thu, 8 Jun 2023 03:39:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7l0C2Sp/r0iBspO3dN4+5vHh30UoIC24XyZOlCr8aQCb2Le5WitaNIC50A5Vm/iknj5Y1Y X-Received: by 2002:a17:907:9405:b0:969:f677:11b4 with SMTP id dk5-20020a170907940500b00969f67711b4mr8188656ejc.37.1686220789354; Thu, 08 Jun 2023 03:39:49 -0700 (PDT) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e7-20020a170906248700b00957e7c30d27si563838ejb.1051.2023.06.08.03.39.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 03:39:49 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=VHAWutYT; arc=fail (signature failed); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2F9403857027 for ; Thu, 8 Jun 2023 10:39:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F9403857027 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686220788; bh=yEbBIyhSoiQfdA3J8rVzFx3RrK386/pDDvZSghYy1DA=; h=To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=VHAWutYTITQLCmxIYZHr0Xw8JAjkrwAPTDGEprQo1jsjUnaLUxjaH2thl8ySA/9dC Mf/YXP7GxGwg3cEwXBTI2N1ClrJ0h59bcE/NfVYaHMFtFiW2CrxoUSY26cgXm0V35F bqVaywC950BnYYVunZBIafX//tJ/Adv5xyRcXyhk= 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-am6eur05on2082.outbound.protection.outlook.com [40.107.22.82]) by sourceware.org (Postfix) with ESMTPS id D60363858C2F for ; Thu, 8 Jun 2023 10:39:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D60363858C2F Received: from AM6P191CA0085.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8a::26) by VE1PR08MB5645.eurprd08.prod.outlook.com (2603:10a6:800:1a6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Thu, 8 Jun 2023 10:38:52 +0000 Received: from AM7EUR03FT050.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8a:cafe::5c) by AM6P191CA0085.outlook.office365.com (2603:10a6:209:8a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.29 via Frontend Transport; Thu, 8 Jun 2023 10:38:52 +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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT050.mail.protection.outlook.com (100.127.141.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.25 via Frontend Transport; Thu, 8 Jun 2023 10:38:52 +0000 Received: ("Tessian outbound 5bb4c51d5a1f:v136"); Thu, 08 Jun 2023 10:38:52 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 307fc1027b650f85 X-CR-MTA-TID: 64aa7808 Received: from c7e17c465629.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9E675E90-6F50-48FF-B9F1-FB452371225E.1; Thu, 08 Jun 2023 10:38:45 +0000 Received: from EUR02-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c7e17c465629.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 08 Jun 2023 10:38:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m1EiEjWs0IqushhVleOEE0LtEBhQZwukclwj5qHu3B5AQtg8qWQ/0bAsG26IhhMXyIaMPheFaH0RqVuolxAJnTx48DnqRT3Um9QEk9Gzv3/9G7d5X1KeeohG7ylVOY+2EZVQNV6hyFEqw+pk4YLPv977bGkW3VVr8QISkc44X1CU4P2ZrbZOI/+D8WcZDvtJr5gVMuUoLkw0QMQnzHhPaWxwE9p1Uo1Xw3K/qHQcH/1d68aiOgR+dDI+He9Q1RVRt58zdmBwF/2HqSPmyvg3Q4CWqMR4rnRY4zNH7lSrQVk/RBj1EjtkQVKkV2FMZ40E43gPUon76u9DGBIqyyL2vw== 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=yEbBIyhSoiQfdA3J8rVzFx3RrK386/pDDvZSghYy1DA=; b=bMdhYvMCBoEjxyA0FTEPaquI3naqk7aU1A+r3buZoeiQ1CeJDs4IfwY29V8ZHrc7k6MCfROtt8bACpuyWgveklUHuA3gG06j+E7QkZ8O721QFX1EV41+jSCQIttod69FCRp2y7BDn8HgNYrUqpsAfof7C86y8Ubg9CWJ3q42Q0I4T4UCe9iVhGJORnIopzuYF+V6zkx4CAaI++RUU1nOUG/Io9+JsaanzoxlUtv5t1wg962oOrKef7FIwQFkdBtaoF4eghryfZk76LqvsXVIrd5SBzFivYEwPVeZz1S9q8Jyfzo4KrtplaY7ydaKXBNMSDa1crAsvlI/o+tgNJtVuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=armh.onmicrosoft.com smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AM0PR01CA0093.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::34) by AS8PR08MB6469.eurprd08.prod.outlook.com (2603:10a6:20b:33c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19; Thu, 8 Jun 2023 10:38:45 +0000 Received: from AM7EUR03FT030.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:10e:cafe::25) by AM0PR01CA0093.outlook.office365.com (2603:10a6:208:10e::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Thu, 8 Jun 2023 10:38:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM7EUR03FT030.mail.protection.outlook.com (100.127.140.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.25 via Frontend Transport; Thu, 8 Jun 2023 10:38:41 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 8 Jun 2023 10:38:40 +0000 Received: from e119885.cambridge.arm.com (10.2.78.52) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Thu, 8 Jun 2023 10:38:40 +0000 To: CC: , , Subject: [PATCH 2/2] AArch64: New RTL for ABD Date: Thu, 8 Jun 2023 11:38:33 +0100 Message-ID: <20230608103833.25420-1-oluwatamilore.adebayo@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230608103713.25297-1-oluwatamilore.adebayo@arm.com> References: <20230608103713.25297-1-oluwatamilore.adebayo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT030:EE_|AS8PR08MB6469:EE_|AM7EUR03FT050:EE_|VE1PR08MB5645:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e74c036-b053-43a0-225a-08db680c8d9e x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: azWodjD/p/XP2XHae87gLm9VYrkjbw/fE4vovbFYI29KhGD/R+E3xhdaY4OBULA29S2pKWcAJ/eL9aTl9Ymx+6LoXBs8gDFhS9bqe3G+huiPmwo6RRNVE8FjP3e95sgPY8B4/hHLyfkwKlmJB1eQSVQEzSAj2xrZVxEH6FVVzwV5QGMGrQKRNUcBJsjZ4VJtoDKhiJMtMGWuGkpbH7GW8EZmfWbavHhjfjMeKdauT9pyCQKsjTWkZIdVEi6vJzdyg+S3GwaJgTbmoSbWhOgtj54nAdIroIxCGYS7FFSZzJuN8kBjrQ7R5lPvC3kljClciQXp9i+IWepRwnPf8BhbVNH4i5eda6j5aSlXrs72kV7cOiVCOC9bt70bUGQH47FPqy86WSAV3Zl/PAR6M/M0soBoAZbuegWNu9j8ta60VhnIq06CbZlf79FDk3xl+Qkrt/JaN0PIomCZp6yPZMGn+j/FfUPbvvdhVQMRq8wzOxzjtoKpukF2kcp6OV6lfi+DWLkTUttPqYbpzhoc431Ku4DGwXZR1u64hoVJAHdwBIfKM1my2+HWycO7XWU/r1cPmgPrK5gb9C50RezztDoJoVFOCRt+QXu6tfs/ovgojkBUQ9CJSseHUKlxOBdCsy5QRfClya1Z2QvxmN1zkSOdrQjelPymgqtLqw/s1/rRbnqXSdEAHDa3Ifl5TI++04fZ9d6HAKWMbedrGbzwHCHYphVCNr0/JVUd/9PFE96J6PxKE4ZJrcPi/BTAjs/fW+q7uDTD9LwoH3zlKGoixau5CbGceKO5DJPyv7DY6jTAZTY= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(396003)(346002)(376002)(451199021)(46966006)(40470700004)(36840700001)(7696005)(6666004)(7049001)(356005)(81166007)(82740400003)(30864003)(70586007)(70206006)(2906002)(37006003)(36756003)(54906003)(5660300002)(8936002)(8676002)(44832011)(86362001)(41300700001)(4326008)(316002)(40480700001)(478600001)(6862004)(40460700003)(426003)(336012)(2616005)(84970400001)(26005)(1076003)(186003)(82310400005)(47076005)(36860700001)(83380400001)(6200100001)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6469 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT050.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 481e0430-b939-4c23-de9d-08db680c8705 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0DlGW37117vM1gdrv7Yh72huDiFn8/ofoxyr95e5pxkxdvPfYuIfyGExkBwzOmZF/6TbkwoviafALFfDaKymmBf3KUMG5iylKe1Ca1ZbOktJ6LznpxTS72p63DiHTtvtd2FYJc0L3bzOUyZjvk55jhB3Yv+Yrq0VRX3q/EjHkC9YJ5aTU1jH7PmWCDwkVvA2oK/wjcjmjCoT2WIj03hLZX+aD3YQje2y5CcApM+RFoifL9/h/h9yy3I+FNKXPWh/0w4ZQzZZnBIYXP59gT3QaFgOADNjq7s6WqUGedfLJ2a5uRK6Wd011K8xm7kFYcudr5t5kiGIbk0eCeJs0tz75t2qCS9YeM8P57Lx7IyigyqaI0AHt+b4CfYz+8+2KoPLN0BKlaIktohsVEoc/HPIV9YyPF14UbYl+qRu3bUn1ZsgxKVLzLUuf4mOAQs7RQGC8LifbykSBBYpmrMSlMS8U7oPgFSfSNp4nLEMMX2OEeblSWopMlrRbVyBhUryF3P83hH6SzZnW/PwLJHXYdx+Wv3rMS+ZQ6q9bsQnW9VRJt022ZE1pXo9OzDpWaKvFSgk5h7AXBKCQwj5iA/dZw3RdNVMIgUj2DqVfkfwIVOb1iRqnLgiTEhN+b8hGIe2wNAcXcz0cfYcJWBAd1pGXu+HepK61teNUI0Q7IIoliPItagi112BSI/tXJEmgBrac52cXSPWch5wRYqF7QzexGpvqW20jRkCzZ8zE/r+C7Nv1SYdZTeLC/O1kExOK39/sHjRZiO3vZwozowvDbUhdC0K5w== 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:(13230028)(4636009)(39860400002)(376002)(396003)(346002)(136003)(451199021)(40470700004)(46966006)(36840700001)(1076003)(41300700001)(7696005)(2616005)(186003)(336012)(6666004)(7049001)(426003)(47076005)(84970400001)(36860700001)(83380400001)(26005)(40460700003)(40480700001)(478600001)(37006003)(54906003)(70206006)(82310400005)(4326008)(82740400003)(70586007)(316002)(81166007)(5660300002)(8936002)(6862004)(8676002)(2906002)(44832011)(86362001)(30864003)(36756003)(6200100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2023 10:38:52.6966 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e74c036-b053-43a0-225a-08db680c8d9e 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: AM7EUR03FT050.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5645 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_LOTSOFHASH, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SCC_5_SHORT_WORD_LINES, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Oluwatamilore Adebayo via Gcc-patches From: Oluwatamilore Adebayo Reply-To: Oluwatamilore Adebayo Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768130650694691531?= X-GMAIL-MSGID: =?utf-8?q?1768130650694691531?= From: oluade01 This patch adds new RTL and tests for sabd and uabd PR tree-optimization/109156 gcc/ChangeLog: * config/aarch64/aarch64-simd-builtins.def (sabd, uabd): Change the mode to 3. * config/aarch64/aarch64-simd.md (aarch64_abd): Rename to abd3. * config/aarch64/aarch64-sve.md (abd_3): Rename to abd3. gcc/testsuite/ChangeLog: * gcc.target/aarch64/abd.h: New file. * gcc.target/aarch64/abd_2.c: New test. * gcc.target/aarch64/abd_3.c: New test. * gcc.target/aarch64/abd_4.c: New test. * gcc.target/aarch64/abd_none_2.c: New test. * gcc.target/aarch64/abd_none_3.c: New test. * gcc.target/aarch64/abd_none_4.c: New test. * gcc.target/aarch64/abd_run_1.c: New test. * gcc.target/aarch64/sve/abd_1.c: New test. * gcc.target/aarch64/sve/abd_none_1.c: New test. * gcc.target/aarch64/sve/abd_2.c: New test. * gcc.target/aarch64/sve/abd_none_2.c: New test. --- gcc/config/aarch64/aarch64-simd-builtins.def | 6 +- gcc/config/aarch64/aarch64-simd.md | 4 +- gcc/config/aarch64/aarch64-sve.md | 4 +- gcc/testsuite/gcc.target/aarch64/abd.h | 68 ++++++++++++++ gcc/testsuite/gcc.target/aarch64/abd_2.c | 35 +++++++ gcc/testsuite/gcc.target/aarch64/abd_3.c | 36 +++++++ gcc/testsuite/gcc.target/aarch64/abd_4.c | 30 ++++++ gcc/testsuite/gcc.target/aarch64/abd_none_2.c | 14 +++ gcc/testsuite/gcc.target/aarch64/abd_none_3.c | 14 +++ gcc/testsuite/gcc.target/aarch64/abd_none_4.c | 19 ++++ gcc/testsuite/gcc.target/aarch64/abd_run_1.c | 93 +++++++++++++++++++ gcc/testsuite/gcc.target/aarch64/sve/abd_1.c | 35 +++++++ gcc/testsuite/gcc.target/aarch64/sve/abd_2.c | 32 +++++++ .../gcc.target/aarch64/sve/abd_none_1.c | 13 +++ .../gcc.target/aarch64/sve/abd_none_2.c | 18 ++++ 15 files changed, 414 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/abd.h create mode 100644 gcc/testsuite/gcc.target/aarch64/abd_2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/abd_3.c create mode 100644 gcc/testsuite/gcc.target/aarch64/abd_4.c create mode 100644 gcc/testsuite/gcc.target/aarch64/abd_none_2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/abd_none_3.c create mode 100644 gcc/testsuite/gcc.target/aarch64/abd_none_4.c create mode 100644 gcc/testsuite/gcc.target/aarch64/abd_run_1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/abd_1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/abd_2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/abd_none_1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/abd_none_2.c diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def index 1beaa08c1e7c94bc13a64865ddb677345534699c..3efbf0a1874f6242e69665b8316d9a7d62a9c8cf 100644 --- a/gcc/config/aarch64/aarch64-simd-builtins.def +++ b/gcc/config/aarch64/aarch64-simd-builtins.def @@ -194,9 +194,9 @@ BUILTIN_VDQV_L (UNOP, saddlv, 0, NONE) BUILTIN_VDQV_L (UNOPU, uaddlv, 0, NONE) - /* Implemented by aarch64_abd. */ - BUILTIN_VDQ_BHSI (BINOP, sabd, 0, NONE) - BUILTIN_VDQ_BHSI (BINOPU, uabd, 0, NONE) + /* Implemented by abd3. */ + BUILTIN_VDQ_BHSI (BINOP, sabd, 3, NONE) + BUILTIN_VDQ_BHSI (BINOPU, uabd, 3, NONE) /* Implemented by aarch64_aba. */ BUILTIN_VDQ_BHSI (TERNOP, saba, 0, NONE) diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index a567f016b354c0f0542e58e7b51c0be739882d65..da35a928bac91db61f4e9884d9c8b162c3a3c937 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -896,7 +896,7 @@ (define_insn "aarch64_abs" ;; So (ABS:QI (minus:QI 64 -128)) == (ABS:QI (192 or -64 signed)) == 64. ;; Whereas SABD would return 192 (-64 signed) on the above example. ;; Use MINUS ([us]max (op1, op2), [us]min (op1, op2)) instead. -(define_insn "aarch64_abd" +(define_insn "abd3" [(set (match_operand:VDQ_BHSI 0 "register_operand" "=w") (minus:VDQ_BHSI (USMAX:VDQ_BHSI @@ -1087,7 +1087,7 @@ (define_expand "sadv16qi" { rtx ones = force_reg (V16QImode, CONST1_RTX (V16QImode)); rtx abd = gen_reg_rtx (V16QImode); - emit_insn (gen_aarch64_abdv16qi (abd, operands[1], operands[2])); + emit_insn (gen_abdv16qi3 (abd, operands[1], operands[2])); emit_insn (gen_udot_prodv16qi (operands[0], abd, ones, operands[3])); DONE; } diff --git a/gcc/config/aarch64/aarch64-sve.md b/gcc/config/aarch64/aarch64-sve.md index 2898b85376b831c2728b806e0f2079086345f1fe..2de651a1989c6b36272dd78a8744c700ebc75c1a 100644 --- a/gcc/config/aarch64/aarch64-sve.md +++ b/gcc/config/aarch64/aarch64-sve.md @@ -4001,7 +4001,7 @@ (define_insn_and_rewrite "*aarch64_adr_shift_uxtw" ;; ------------------------------------------------------------------------- ;; Unpredicated integer absolute difference. -(define_expand "abd_3" +(define_expand "abd3" [(use (match_operand:SVE_I 0 "register_operand")) (USMAX:SVE_I (match_operand:SVE_I 1 "register_operand") @@ -6973,7 +6973,7 @@ (define_expand "sad" { rtx ones = force_reg (mode, CONST1_RTX (mode)); rtx diff = gen_reg_rtx (mode); - emit_insn (gen_abd_3 (diff, operands[1], operands[2])); + emit_insn (gen_abd3 (diff, operands[1], operands[2])); emit_insn (gen_udot_prod (operands[0], diff, ones, operands[3])); DONE; } diff --git a/gcc/testsuite/gcc.target/aarch64/abd.h b/gcc/testsuite/gcc.target/aarch64/abd.h new file mode 100644 index 0000000000000000000000000000000000000000..b95fd908d91d9e576e4d76638844e22deb50a006 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd.h @@ -0,0 +1,68 @@ +#ifdef ABD_IDIOM + +#define TEST1(S, TYPE) \ +__attribute__((noipa)) \ +void fn_##S##_##TYPE (S TYPE * restrict a, \ + S TYPE * restrict b, \ + S TYPE * restrict out) { \ + for (int i = 0; i < N; i++) { \ + signed TYPE diff = b[i] - a[i]; \ + out[i] = diff > 0 ? diff : -diff; \ +} } + +#define TEST2(S, TYPE1, TYPE2) \ +__attribute__((noipa)) \ +void fn_##S##_##TYPE1##_##TYPE1##_##TYPE2 \ + (S TYPE1 * restrict a, \ + S TYPE1 * restrict b, \ + S TYPE2 * restrict out) { \ + for (int i = 0; i < N; i++) { \ + signed TYPE2 diff = b[i] - a[i]; \ + out[i] = diff > 0 ? diff : -diff; \ +} } + +#define TEST3(S, TYPE1, TYPE2, TYPE3) \ +__attribute__((noipa)) \ +void fn_##S##_##TYPE1##_##TYPE2##_##TYPE3 \ + (S TYPE1 * restrict a, \ + S TYPE2 * restrict b, \ + S TYPE3 * restrict out) { \ + for (int i = 0; i < N; i++) { \ + signed TYPE3 diff = b[i] - a[i]; \ + out[i] = diff > 0 ? diff : -diff; \ +} } + +#endif + +#ifdef ABD_ABS + +#define TEST1(S, TYPE) \ +__attribute__((noipa)) \ +void fn_##S##_##TYPE (S TYPE * restrict a, \ + S TYPE * restrict b, \ + S TYPE * restrict out) { \ + for (int i = 0; i < N; i++) \ + out[i] = __builtin_abs(a[i] - b[i]); \ +} + +#define TEST2(S, TYPE1, TYPE2) \ +__attribute__((noipa)) \ +void fn_##S##_##TYPE1##_##TYPE1##_##TYPE2 \ + (S TYPE1 * restrict a, \ + S TYPE1 * restrict b, \ + S TYPE2 * restrict out) { \ + for (int i = 0; i < N; i++) \ + out[i] = __builtin_abs(a[i] - b[i]); \ +} + +#define TEST3(S, TYPE1, TYPE2, TYPE3) \ +__attribute__((noipa)) \ +void fn_##S##_##TYPE1##_##TYPE2##_##TYPE3 \ + (S TYPE1 * restrict a, \ + S TYPE2 * restrict b, \ + S TYPE3 * restrict out) { \ + for (int i = 0; i < N; i++) \ + out[i] = __builtin_abs(a[i] - b[i]); \ +} + +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/abd_2.c b/gcc/testsuite/gcc.target/aarch64/abd_2.c new file mode 100644 index 0000000000000000000000000000000000000000..c0d41fb7ef99baf95b0f6a2e68a88f6748482af3 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd_2.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#pragma GCC target "+nosve" +#define N 1024 + +#define ABD_ABS +#include "abd.h" + +TEST1(signed, int) +TEST1(signed, short) +TEST1(signed, char) + +TEST2(signed, char, short) +TEST2(signed, char, int) +TEST2(signed, short, int) + +TEST3(signed, char, int, short) +TEST3(signed, char, short, int) + +TEST1(unsigned, short) +TEST1(unsigned, char) + +TEST2(unsigned, char, short) +TEST2(unsigned, char, int) + +TEST3(unsigned, char, short, int) + +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.4s, v\[0-9\]+\.4s, v\[0-9\]+\.4s" 5 } } */ +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.8h" 4 } } */ +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b, v\[0-9\]+\.16b" 3 } } */ +/* { dg-final { scan-assembler-times "uabd\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.8h" 3 } } */ +/* { dg-final { scan-assembler-times "uabd\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b, v\[0-9\]+\.16b" 3 } } */ + +/* { dg-final { scan-assembler-not {\tabs\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/abd_3.c b/gcc/testsuite/gcc.target/aarch64/abd_3.c new file mode 100644 index 0000000000000000000000000000000000000000..4873c64f34885b3993010beafa01087569336dec --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd_3.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast" } */ + +#pragma GCC target "arch=armv8-a" +#define N 1024 + +#define ABD_ABS +#include "abd.h" + +TEST1(signed, int) +TEST1(signed, short) +TEST1(signed, char) + +TEST2(signed, char, short) +TEST2(signed, char, int) +TEST2(signed, short, int) + +TEST3(signed, char, int, short) +TEST3(signed, char, short, int) + +TEST1(unsigned, short) +TEST1(unsigned, char) + +TEST2(unsigned, char, short) +TEST2(unsigned, char, int) +TEST2(unsigned, short, int) + +TEST3(unsigned, char, short, int) + +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.4s, v\[0-9\]+\.4s, v\[0-9\]+\.4s" 5 } } */ +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.8h" 4 } } */ +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b, v\[0-9\]+\.16b" 3 } } */ +/* { dg-final { scan-assembler-times "uabd\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.8h" 4 } } */ +/* { dg-final { scan-assembler-times "uabd\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b, v\[0-9\]+\.16b" 3 } } */ + +/* { dg-final { scan-assembler-not {\tabs\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/abd_4.c b/gcc/testsuite/gcc.target/aarch64/abd_4.c new file mode 100644 index 0000000000000000000000000000000000000000..4670ec8fe92f3cd4b1bb0a15125fc66231b2be0a --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd_4.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#pragma GCC target "+nosve" +#define N 1024 + +#define ABD_IDIOM +#include "abd.h" + +TEST1(signed, int) +TEST1(signed, short) +TEST1(signed, char) + +TEST2(signed, char, short) +TEST2(signed, char, int) +TEST2(signed, short, int) + +TEST3(signed, char, short, int) + +TEST2(unsigned, char, short) +TEST2(unsigned, char, int) +TEST2(unsigned, short, int) + +TEST3(unsigned, char, short, int) + +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.4s, v\[0-9\]+\.4s, v\[0-9\]+\.4s" 1 } } */ +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.8h" 4 } } */ +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b, v\[0-9\]+\.16b" 3 } } */ +/* { dg-final { scan-assembler-times "uabd\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.8h" 3 } } */ +/* { dg-final { scan-assembler-times "uabd\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b, v\[0-9\]+\.16b" 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/abd_none_2.c b/gcc/testsuite/gcc.target/aarch64/abd_none_2.c new file mode 100644 index 0000000000000000000000000000000000000000..658e7426965ead945d0cad68ef721f176fb41665 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd_none_2.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#pragma GCC target "+nosve" +#define N 1024 + +#define ABD_ABS +#include "abd.h" + +TEST1(unsigned, int) +TEST3(unsigned, char, int, short) + +/* { dg-final { scan-assembler-not {\tsabd\t} } } */ +/* { dg-final { scan-assembler-not {\tuabd\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/abd_none_3.c b/gcc/testsuite/gcc.target/aarch64/abd_none_3.c new file mode 100644 index 0000000000000000000000000000000000000000..14cfdcbde6998b527989326ff8848d071a4774e8 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd_none_3.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast" } */ + +#pragma GCC target "arch=armv8-a" +#define N 1024 + +#define ABD_ABS +#include "abd.h" + +TEST1(unsigned, int) +TEST3(unsigned, char, int, short) + +/* { dg-final { scan-assembler-not {\tsabd\t} } } */ +/* { dg-final { scan-assembler-not {\tuabd\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/abd_none_4.c b/gcc/testsuite/gcc.target/aarch64/abd_none_4.c new file mode 100644 index 0000000000000000000000000000000000000000..667acf2c3c8156fcf5ff9a56b40fdf2cf2aa5502 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd_none_4.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#pragma GCC target "+nosve" +#define N 1024 + +#define ABD_IDIOM +#include "abd.h" + +TEST3(signed, char, int, short) + +TEST1(unsigned, int) +TEST1(unsigned, short) +TEST1(unsigned, char) + +TEST3(unsigned, char, int, short) + +/* { dg-final { scan-assembler-not {\tsabd\t} } } */ +/* { dg-final { scan-assembler-not {\tuabd\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/abd_run_1.c b/gcc/testsuite/gcc.target/aarch64/abd_run_1.c new file mode 100644 index 0000000000000000000000000000000000000000..7bb0a801415ffeab235bd636032112228255e836 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd_run_1.c @@ -0,0 +1,93 @@ +/* { dg-do run } */ +/* { dg-options "-O3" } */ + +#pragma GCC target "+nosve" +#define N 16 + +#define ABD_ABS +#include "abd.h" + +TEST1(signed, int) +TEST1(signed, short) +TEST1(signed, char) + +TEST1(unsigned, int) +TEST1(unsigned, short) +TEST1(unsigned, char) + +#define EMPTY { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +#define sA { -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50 } +#define uA { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 } +#define B { 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25 } +#define GOLD { 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75 } + +typedef signed char s8; +typedef unsigned char u8; +typedef signed short s16; +typedef unsigned short u16; +typedef signed int s32; +typedef unsigned int u32; + +s8 sc_out[] = EMPTY; +u8 uc_out[] = EMPTY; +s16 ss_out[] = EMPTY; +u16 us_out[] = EMPTY; +s32 si_out[] = EMPTY; +u32 ui_out[] = EMPTY; + +s8 sc_A[] = sA; +s8 sc_B[] = B; +u8 uc_A[] = uA; +u8 uc_B[] = B; + +s16 ss_A[] = sA; +s16 ss_B[] = B; +u16 us_A[] = uA; +u16 us_B[] = B; + +s32 si_A[] = sA; +s32 si_B[] = B; +u32 ui_A[] = uA; +u32 ui_B[] = B; + +s8 sc_gold[] = GOLD; +u8 uc_gold[] = GOLD; +s16 ss_gold[] = GOLD; +u16 us_gold[] = GOLD; +s32 si_gold[] = GOLD; +u32 ui_gold[] = GOLD; + +extern void abort (void); + +#define CLEAR(arr) \ +for (int i = 0; i < N; i++) \ + arr[i] = 0; + +#define COMPARE(A, B) \ +for (int i = 0; i < N; i++) \ + if (A[i] != B[i]) \ + abort(); + +int main () +{ + fn_signed_char (sc_A, sc_B, sc_out); + COMPARE (sc_out, sc_gold); + + fn_unsigned_char (uc_A, uc_B, uc_out); + COMPARE (uc_out, uc_gold); + + fn_signed_short (ss_A, ss_B, ss_out); + COMPARE (ss_out, ss_gold) + + fn_unsigned_short (us_A, us_B, us_out); + COMPARE (us_out, us_gold) + + fn_signed_int (si_A, si_B, si_out); + COMPARE (si_out, si_gold); + + fn_unsigned_int (ui_A, ui_B, ui_out); + COMPARE (ui_out, ui_gold); + + return 0; +} + diff --git a/gcc/testsuite/gcc.target/aarch64/sve/abd_1.c b/gcc/testsuite/gcc.target/aarch64/sve/abd_1.c new file mode 100644 index 0000000000000000000000000000000000000000..e49006f90b22040f890c279ec19c490a655abd63 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/abd_1.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#define N 1024 + +#define ABD_ABS +#include "../abd.h" + +TEST1(signed, int) +TEST1(signed, short) +TEST1(signed, char) + +TEST2(signed, char, int) +TEST2(signed, char, short) +TEST2(signed, short, int) + +TEST3(signed, char, int, short) +TEST3(signed, char, short, int) + +TEST1(unsigned, short) +TEST1(unsigned, char) + +TEST2(unsigned, char, short) +TEST2(unsigned, char, int) +TEST2(unsigned, short, int) + +TEST3(unsigned, char, short, int) + +/* { dg-final { scan-assembler-times "sabd\\tz\[0-9\]+\.s, p\[0-9\]/m, z\[0-9\]+\.s, z\[0-9\]+\.s" 2 } } */ +/* { dg-final { scan-assembler-times "sabd\\tz\[0-9\]+\.h, p\[0-9\]/m, z\[0-9\]+\.h, z\[0-9\]+\.h" 3 } } */ +/* { dg-final { scan-assembler-times "sabd\\tz\[0-9\]+\.b, p\[0-9\]/m, z\[0-9\]+\.b, z\[0-9\]+\.b" 3 } } */ +/* { dg-final { scan-assembler-times "uabd\\tz\[0-9\]+\.h, p\[0-9\]/m, z\[0-9\]+\.h, z\[0-9\]+\.h" 3 } } */ +/* { dg-final { scan-assembler-times "uabd\\tz\[0-9\]+\.b, p\[0-9\]/m, z\[0-9\]+\.b, z\[0-9\]+\.b" 3 } } */ + +/* { dg-final { scan-assembler-not {\tabs\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/abd_2.c b/gcc/testsuite/gcc.target/aarch64/sve/abd_2.c new file mode 100644 index 0000000000000000000000000000000000000000..bb17c8d6855eeee0a109b991c6610cfe7af12fd9 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/abd_2.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#define N 1024 + +#define ABD_IDIOM +#include "../abd.h" + +TEST1(signed, int) +TEST1(signed, short) +TEST1(signed, char) + +TEST2(signed, char, int) +TEST2(signed, char, short) +TEST2(signed, short, int) + +TEST3(signed, char, short, int) + +TEST2(unsigned, char, int) +TEST2(unsigned, char, short) +TEST2(unsigned, short, int) + +TEST3(unsigned, char, int, short) +TEST3(unsigned, char, short, int) + +/* { dg-final { scan-assembler-times "sabd\\tz\[0-9\]+\.s, p\[0-9\]/m, z\[0-9\]+\.s, z\[0-9\]+\.s" 1 } } */ +/* { dg-final { scan-assembler-times "sabd\\tz\[0-9\]+\.h, p\[0-9\]/m, z\[0-9\]+\.h, z\[0-9\]+\.h" 3 } } */ +/* { dg-final { scan-assembler-times "sabd\\tz\[0-9\]+\.b, p\[0-9\]/m, z\[0-9\]+\.b, z\[0-9\]+\.b" 3 } } */ +/* { dg-final { scan-assembler-times "uabd\\tz\[0-9\]+\.h, p\[0-9\]/m, z\[0-9\]+\.h, z\[0-9\]+\.h" 2 } } */ +/* { dg-final { scan-assembler-times "uabd\\tz\[0-9\]+\.b, p\[0-9\]/m, z\[0-9\]+\.b, z\[0-9\]+\.b" 2 } } */ + +/* { dg-final { scan-assembler-not {\tabs\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/abd_none_1.c b/gcc/testsuite/gcc.target/aarch64/sve/abd_none_1.c new file mode 100644 index 0000000000000000000000000000000000000000..a4c2053c50e235e6ea6ad8bfb124889556be1657 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/abd_none_1.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#define N 1024 + +#define ABD_ABS +#include "../abd.h" + +TEST1(unsigned, int) +TEST3(unsigned, char, int, short) + +/* { dg-final { scan-assembler-not {\tsabd\t} } } */ +/* { dg-final { scan-assembler-not {\tuabd\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/abd_none_2.c b/gcc/testsuite/gcc.target/aarch64/sve/abd_none_2.c new file mode 100644 index 0000000000000000000000000000000000000000..b540c38844936a17dc658acd909f3416f8887071 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/abd_none_2.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#define N 1024 + +#define ABD_IDIOM +#include "../abd.h" + +TEST3(signed, char, int, short) + +TEST1(unsigned, int) +TEST1(unsigned, short) +TEST1(unsigned, char) + +TEST3(unsigned, char, int, short) + +/* { dg-final { scan-assembler-not {\tsabd\t} } } */ +/* { dg-final { scan-assembler-not {\tuabd\t} } } */