From patchwork Wed Jul 13 13:41:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Carlotti X-Patchwork-Id: 233 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a98:d5ce:0:b0:178:cc93:bf7d with SMTP id g14csp262403eik; Wed, 13 Jul 2022 06:42:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sq63Ps8ufkG7VbVr7VRg4hUp/NyyNbEQcBmza40FiQu25oaC8LvlGEkmzIx9W0AU34Md96 X-Received: by 2002:a17:907:60d1:b0:726:a049:7740 with SMTP id hv17-20020a17090760d100b00726a0497740mr3566730ejc.215.1657719733021; Wed, 13 Jul 2022 06:42:13 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id i11-20020a05640242cb00b0043a76f88f65si23308508edc.186.2022.07.13.06.42.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 06:42:13 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=d8jHgCwD; arc=fail (signature failed); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 632953836FAF for ; Wed, 13 Jul 2022 13:41:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 632953836FAF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1657719717; bh=ZyOcokIdWGv2krmnpANk4E3EUblnuKlU9mPIBHdUGVI=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=d8jHgCwD57vfoLtj5bShFkvE77s7c4ZvWS87HGC1iyM1dW2ysKobtLUQspHIcRBSZ 6HYanitGdfvayHONvyJJQ+qzEl6GVvWYXW6ce6sXF1szvz2dwZypqJC2Oav0Q9qGZU PuEt22tjq6sFRlFFVgXgxA8J5pN6qqoVDtg9sx3g= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20057.outbound.protection.outlook.com [40.107.2.57]) by sourceware.org (Postfix) with ESMTPS id D5710383A36A for ; Wed, 13 Jul 2022 13:41:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D5710383A36A ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=S7zpDMHg8RE8GRvUkgl1vZwWtzKXJem+3lcTruGWkdjFFAFIERgWFsG8wgFoMU9HW5OS+u2Ud4ap199Ahgz5lTvhE5YX8nptFf56h4ru2jZlQQoswAX9AyvIrPEgWC9yme4fTwaJp5qAVMstJv81F+zbv8n9lyL9WgNnct32Z4XWyjgDvZvhDGVPEz59AwM5ViwcTaxy8jLlGBth8BMezd2Rzp/ZeF5Y24M2FaJu7YWhznckMdE09eJZf6KJoCjtzB1boxyT11XOPbhlVgSNWW0F+ha6Mt9bAtChfIJOoUMmAYgB2V9HwLZt+Qn7aF+ooJ78m6l4hvwQ3HkEeqmWSg== ARC-Message-Signature: i=2; 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=ZyOcokIdWGv2krmnpANk4E3EUblnuKlU9mPIBHdUGVI=; b=gHOw6KHF2p7az/8f38rIeojUoNSiwfgl+mmCqN+jZxzcf1FPzvx/m62qhfbvFdh0SreUekJFpVF+jW1SOvJwJlfo1kRx5o0XbNrtFmEMvx//5HsazR4x3a/cqKNrYKl2Zz3PzCbYXkUGrtPjGelQpztksQFkRuTbPAqoBZ6Nr0PT8h7VqD9Dx8OSCL9BjaU7WLR4H/S1oK0Hf6oxjd7lqW1eW8PyLK5t6hMtzcfdx+/quzcsgGejcsLtcKivxtmaeWnoRgt/9O8kCUCDi2+HTIKPOTN0vPGXb0hR8wX4w4/9K47LdYtpdpXBCjnHpy323SJDlJcGjbWrfsdy1D/PhA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from AS9PR06CA0568.eurprd06.prod.outlook.com (2603:10a6:20b:485::30) by AM0PR08MB4276.eurprd08.prod.outlook.com (2603:10a6:208:13a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12; Wed, 13 Jul 2022 13:41:07 +0000 Received: from AM5EUR03FT058.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:485:cafe::97) by AS9PR06CA0568.outlook.office365.com (2603:10a6:20b:485::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.11 via Frontend Transport; Wed, 13 Jul 2022 13:41: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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT058.mail.protection.outlook.com (10.152.17.48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.15 via Frontend Transport; Wed, 13 Jul 2022 13:41:07 +0000 Received: ("Tessian outbound 13cb25bfb745:v122"); Wed, 13 Jul 2022 13:41:07 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 257ce6f100a8ade0 X-CR-MTA-TID: 64aa7808 Received: from f8b04f381feb.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7CD79676-222C-4DD9-9952-5DC0ECC737ED.1; Wed, 13 Jul 2022 13:41:00 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f8b04f381feb.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 13 Jul 2022 13:41:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E6A8/jjuin0Mi0JcTCsuUyR2Tjwp2pgYQRd9s/Qjix14X5+JWzCrx0Npz15ahDmIFyKk2aoPXVIIbo77Ux7AJV7XaJgkw3YJo8JkNaUtYGMGNb4MSXdtM8/msltrOuAzdOKM+VH+xnswSvXI2mx25SrnVd2YF9kPGyXXJ0eE/dvcpJBaHqpIN6mtt64pxt/15aVyaFMACVGZJfSdUe1Ugz9UPZ2T0KfNhpCSDAzEFCW68/PzRX0pceA+Jp9m5heQXS18UQzHuEPHO7MnSwcUdXWPvCGPTDYeoW3M+SQk2F5UZF7pdFXUUVwMI6Q6nb8yf4tiEg8mOMOwbAj9qB2WBw== 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=ZyOcokIdWGv2krmnpANk4E3EUblnuKlU9mPIBHdUGVI=; b=PrMXf/msxfSDNpySphzZcN1Ws4wDgAGVqmMGsK4xw3csWlMNKdihFxxJz7/PyPeI/s3A6xVyoQkcnxpk/q7QUX0bHxHOoRMsfjMuvBx/158X1iQAvWJBL8NmdQmJpSHpjGG145MUQL/iFUvRH39UY4D5Ytrg9HOzQYvshtFtLfXS6U1JeUojH6dNV0OZUC+1r6/c3JtASNa84IUtzNyxalkahdlg6MVICT/kBNSUtoYpYfMEV/enBaIdsY4j8NxSQhuRu9JfeFxx6UUq3oXKPCVC7HE0N+9r/X8VH3iNZZszGpkEH48jZ3oM2B8qxLAXbXzvHLRZ03ouYYVEqT5bHQ== 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 AS8PR08MB6678.eurprd08.prod.outlook.com (2603:10a6:20b:398::8) by PR2PR08MB4699.eurprd08.prod.outlook.com (2603:10a6:101:1d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.23; Wed, 13 Jul 2022 13:40:58 +0000 Received: from AS8PR08MB6678.eurprd08.prod.outlook.com ([fe80::90e1:2317:2ab:bd1e]) by AS8PR08MB6678.eurprd08.prod.outlook.com ([fe80::90e1:2317:2ab:bd1e%9]) with mapi id 15.20.5438.012; Wed, 13 Jul 2022 13:40:57 +0000 Date: Wed, 13 Jul 2022 14:41:05 +0100 To: gcc-patches@gcc.gnu.org Subject: [PATCH v2 3/4] aarch64: Consolidate simd type lookup functions Message-ID: Content-Disposition: inline X-ClientProxiedBy: LNXP123CA0020.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:d2::32) To AS8PR08MB6678.eurprd08.prod.outlook.com (2603:10a6:20b:398::8) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: c3b47d90-3415-4325-daf4-08da64d556e1 X-MS-TrafficTypeDiagnostic: PR2PR08MB4699:EE_|AM5EUR03FT058:EE_|AM0PR08MB4276:EE_ 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: w2R5bh2tGuoMw8e+gVug58hwonRP598tak1ev2CVz/fZYiB8vsJKiHQbHBcM34+M6uo0B2DeJJZ/RFRWQbbopUY99/OYk9FSY0ropV7ADHRdECX7xsIjT6sduCAmdKd4xkRjT+P6dWQoLyzR7yeKZzawSBZkgUVyrjArwsm0nKdJTKRI/5par5aeIocgtkON5HMY/OSyAvRZkD5nQXBqkXuQswQZSD3HX7LQjk3TUfBLMtAoopBI2lORIsyrlvoIYvARHEblct4j5pGpU47pAW9DuFMWYX124/mPcHxKhai8QtgAHRR7vDsvZMAKwMRBvEPK0q4/49NRIhOmt5/jzCFC0763Zb3Uy8ChINmKSbgVb+zJhZlDM/iHeEMaOq+PK4ky5vhN3ZlFGehneAiWTdEtfw/ELa90MuXAaEYPjKrBfDDQUgk6lzmI2LmTpo+2che4QOidNzY4E/xhpGso7u2zeV+bW7P6MpoyXqHdBLpH5YR+ShLtFSvR8uf5xnQtVwRZijTbnaH79o4za8CrEN+FZYhGEZnmUQ7UHJB7JY5j4/E9HBMlnCu/v1nZyXxHRJ5vfs5MExRqaT24QNobySJ3bJLu2sH0hY4Mj4qK4FGFfaRJxZKqqDnItFJxeOd5afovJ85Fpg9SVdrgQcjsd+OaCOZ0zHi/EaV09cyQ0PJ5PLUkku5xDPt3MYssK/fWdYH1PvrgOaXWX3aU2ewtFAzFhfxhpQUEH5OvMe+TcC1JlpvAaHsh93zxINfw9zgA X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB6678.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(346002)(136003)(39860400002)(376002)(396003)(366004)(2906002)(83380400001)(38100700002)(478600001)(316002)(86362001)(6486002)(6666004)(6506007)(41300700001)(8676002)(186003)(8936002)(6512007)(66556008)(44832011)(66946007)(26005)(66476007)(6916009)(5660300002)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR08MB4699 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: AM5EUR03FT058.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 5b0ca99e-21e7-4d86-a76e-08da64d55099 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tV3UZKimygXbEARQXvh10MivKSR3G9qWUFm0ca0aMdBLTc7eDrbS9SPMRQogapgXhvEEv0GauWpYBYUwItLxvcBvynkVNjrejnza8D1TLQOnCuMzl6xkK1vjTB63GHH/mHvh9XsVwH9DutdNEETORIF2OkLa0Kh4Lab+89I6+C8nzaaOu4EL9XBysv40AI5O4SB3+HbXEMl9nJ4/cuvgNAdUUzRRt6Ho+ON+eixG9I8gOZhiv+JxULLlqr2qlUr85XM5BcIFLU0u2sjxuwAJJKc7FcfflgDka/Orp4nqxWwq3ZVaJ0u8vk0YeZU0Esi1AbaeHDn5wnOG6BRF/Je1rZgI2MLGOEyqCo57MHOR66emP+b4VBdZKri0f4Ux8r5db6x/AyAnJQGKph7CVPdXcPo3hgKreRAvhJVfNot0utXmMHQtjShPkiOnfgvjR/+0fsjjxxO0ErlzsX2Yl1xnfVNYlLUZzFPG1L+XR2AYaAQhyvy3lj3CUuCN626x5LEZasp9oDm5AE9RWFBUcFbq7dw9GAwDUmbcKbmDYUFrxuC/Djq/0E4pp81aWl73JuKDgfPeNCCw/I5ZQEngd6TmR3cQPqHK8M6zsfNs1EWfYpdtmjeBHldtFss9Yk6csVbBKt8f8CuEVCbHStrlphHPcrSEWlAiEMaoW8yLr01mTD8uKLujyJ1wUpSRg7htSOt7rBfdZYffLDrDi8leuJB2BFg60rqqOFvbNrZqidd5ujzT3LZvDoQDwgT0QO7sQB3hOr5XGrz2IeUrx1iPD5ED5gGr2AVpPwzjzkXmAvwoC96utY16DeNGqF6P1YU0MZEV 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:(13230016)(4636009)(39860400002)(346002)(136003)(376002)(396003)(46966006)(40470700004)(36840700001)(44832011)(8936002)(82740400003)(81166007)(5660300002)(6506007)(356005)(40460700003)(478600001)(26005)(186003)(41300700001)(316002)(6916009)(6512007)(6486002)(36860700001)(6666004)(47076005)(336012)(8676002)(83380400001)(70586007)(4326008)(2906002)(82310400005)(40480700001)(70206006)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2022 13:41:07.3862 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c3b47d90-3415-4325-daf4-08da64d556e1 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: AM5EUR03FT058.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4276 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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: Andrew Carlotti via Gcc-patches From: Andrew Carlotti Reply-To: Andrew Carlotti Cc: Richard Sandiford 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?1738245126760249461?= X-GMAIL-MSGID: =?utf-8?q?1738245126760249461?= There were several similarly-named functions, which each built or looked up a type using a different subset of valid modes or qualifiers. This change combines these all into a single function, which can additionally handle const and pointer qualifiers. gcc/ChangeLog: * config/aarch64/aarch64-builtins.cc (aarch64_simd_builtin_std_type, aarch64_lookup_simd_builtin_type) (aarch64_simd_builtin_type): Combine and replace with... (aarch64_build_simd_builtin_type): ...this new function. (aarch64_init_fcmla_laneq_builtins): Update to call new function. (aarch64_init_simd_builtin_functions): Ditto. (aarch64_init_crc32_builtins): Ditto. diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc index 55ad2e8b6831d6cc2b039270c8656d429347092d..6b413a36a09c7a4ac41b0fe7c414a3247580f222 100644 --- a/gcc/config/aarch64/aarch64-builtins.cc +++ b/gcc/config/aarch64/aarch64-builtins.cc @@ -789,79 +789,101 @@ aarch64_general_mangle_builtin_type (const_tree type) } static tree -aarch64_simd_builtin_std_type (machine_mode mode, - enum aarch64_type_qualifiers q) -{ -#define QUAL_TYPE(M) \ - ((q == qualifier_none) ? int##M##_type_node : unsigned_int##M##_type_node); - switch (mode) - { - case E_QImode: - return QUAL_TYPE (QI); - case E_HImode: - return QUAL_TYPE (HI); - case E_SImode: - return QUAL_TYPE (SI); - case E_DImode: - return QUAL_TYPE (DI); - case E_TImode: - return QUAL_TYPE (TI); - case E_OImode: - return aarch64_simd_intOI_type_node; - case E_CImode: - return aarch64_simd_intCI_type_node; - case E_XImode: - return aarch64_simd_intXI_type_node; - case E_HFmode: - return aarch64_fp16_type_node; - case E_SFmode: - return float_type_node; - case E_DFmode: - return double_type_node; - case E_BFmode: - return aarch64_bf16_type_node; - default: - gcc_unreachable (); - } -#undef QUAL_TYPE -} - -static tree -aarch64_lookup_simd_builtin_type (machine_mode mode, - enum aarch64_type_qualifiers q) +aarch64_build_simd_builtin_type (machine_mode mode, + enum aarch64_type_qualifiers qualifiers) { + tree type = NULL_TREE; int i; int nelts = sizeof (aarch64_simd_types) / sizeof (aarch64_simd_types[0]); - /* Non-poly scalar modes map to standard types not in the table. */ - if (q != qualifier_poly && !VECTOR_MODE_P (mode)) - return aarch64_simd_builtin_std_type (mode, q); + /* For pointers, we want a pointer to the basic type of the vector. */ + if ((qualifiers & qualifier_pointer) && VECTOR_MODE_P (mode)) + mode = GET_MODE_INNER (mode); - for (i = 0; i < nelts; i++) + if ((qualifiers & qualifier_poly) || VECTOR_MODE_P (mode)) { - if (aarch64_simd_types[i].mode == mode - && aarch64_simd_types[i].q == q) - return aarch64_simd_types[i].itype; - if (aarch64_simd_tuple_types[i][0] != NULL_TREE) - for (int j = 0; j < 3; j++) - if (aarch64_simd_tuple_modes[i][j] == mode + int q = qualifiers & (qualifier_poly | qualifier_unsigned); + /* Poly or vector modes map to types in the table. */ + for (i = 0; i < nelts; i++) + { + if (aarch64_simd_types[i].mode == mode && aarch64_simd_types[i].q == q) - return aarch64_simd_tuple_types[i][j]; + { + type = aarch64_simd_types[i].itype; + goto finished_type_lookup; + } + if (aarch64_simd_tuple_types[i][0] != NULL_TREE) + { + for (int j = 0; j < 3; j++) + { + if (aarch64_simd_tuple_modes[i][j] == mode + && aarch64_simd_types[i].q == q) + { + type = aarch64_simd_tuple_types[i][j]; + goto finished_type_lookup; + } + } + } + } } + else + { + /* Non-poly scalar modes map to standard types. */ +#define QUAL_TYPE(M) ((qualifiers & qualifier_unsigned) \ + ? unsigned_int##M##_type_node : int##M##_type_node); + switch (mode) + { + case E_QImode: + type = QUAL_TYPE (QI); + break; + case E_HImode: + type = QUAL_TYPE (HI); + break; + case E_SImode: + type = QUAL_TYPE (SI); + break; + case E_DImode: + type = QUAL_TYPE (DI); + break; + case E_TImode: + type = QUAL_TYPE (TI); + break; + case E_OImode: + type = aarch64_simd_intOI_type_node; + break; + case E_CImode: + type = aarch64_simd_intCI_type_node; + break; + case E_XImode: + type = aarch64_simd_intXI_type_node; + break; + case E_HFmode: + type = aarch64_fp16_type_node; + break; + case E_SFmode: + type = float_type_node; + break; + case E_DFmode: + type = double_type_node; + break; + case E_BFmode: + type = aarch64_bf16_type_node; + break; + default: + gcc_unreachable (); + } +#undef QUAL_TYPE + } +finished_type_lookup: + gcc_assert (type != NULL_TREE); - return NULL_TREE; -} + /* Add qualifiers. */ + if (qualifiers & qualifier_const) + type = build_qualified_type (type, TYPE_QUAL_CONST); + if (qualifiers & qualifier_pointer) + type = build_pointer_type (type); -static tree -aarch64_simd_builtin_type (machine_mode mode, - bool unsigned_p, bool poly_p) -{ - if (poly_p) - return aarch64_lookup_simd_builtin_type (mode, qualifier_poly); - else if (unsigned_p) - return aarch64_lookup_simd_builtin_type (mode, qualifier_unsigned); - else - return aarch64_lookup_simd_builtin_type (mode, qualifier_none); + return type; } static void @@ -1110,12 +1132,12 @@ aarch64_init_fcmla_laneq_builtins (void) { aarch64_fcmla_laneq_builtin_datum* d = &aarch64_fcmla_lane_builtin_data[i]; - tree argtype = aarch64_lookup_simd_builtin_type (d->mode, qualifier_none); + tree argtype = aarch64_build_simd_builtin_type (d->mode, qualifier_none); machine_mode quadmode = GET_MODE_2XWIDER_MODE (d->mode).require (); tree quadtype - = aarch64_lookup_simd_builtin_type (quadmode, qualifier_none); + = aarch64_build_simd_builtin_type (quadmode, qualifier_none); tree lanetype - = aarch64_simd_builtin_std_type (SImode, qualifier_lane_pair_index); + = aarch64_build_simd_builtin_type (SImode, qualifier_lane_pair_index); tree ftype = build_function_type_list (argtype, argtype, argtype, quadtype, lanetype, NULL_TREE); tree attrs = aarch64_get_attributes (FLAG_FP, d->mode); @@ -1210,23 +1232,7 @@ aarch64_init_simd_builtin_functions (bool called_from_pragma) if (qualifiers & qualifier_map_mode) op_mode = d->mode; - /* For pointers, we want a pointer to the basic type - of the vector. */ - if (qualifiers & qualifier_pointer && VECTOR_MODE_P (op_mode)) - op_mode = GET_MODE_INNER (op_mode); - - eltype = aarch64_simd_builtin_type - (op_mode, - (qualifiers & qualifier_unsigned) != 0, - (qualifiers & qualifier_poly) != 0); - gcc_assert (eltype != NULL); - - /* Add qualifiers. */ - if (qualifiers & qualifier_const) - eltype = build_qualified_type (eltype, TYPE_QUAL_CONST); - - if (qualifiers & qualifier_pointer) - eltype = build_pointer_type (eltype); + eltype = aarch64_build_simd_builtin_type (op_mode, qualifiers); /* If we have reached arg_num == 0, we are at a non-void return type. Otherwise, we are still processing @@ -1383,13 +1389,13 @@ aarch64_init_simd_builtins (void) static void aarch64_init_crc32_builtins () { - tree usi_type = aarch64_simd_builtin_std_type (SImode, qualifier_unsigned); + tree usi_type = aarch64_build_simd_builtin_type (SImode, qualifier_unsigned); unsigned int i = 0; for (i = 0; i < ARRAY_SIZE (aarch64_crc_builtin_data); ++i) { aarch64_crc_builtin_datum* d = &aarch64_crc_builtin_data[i]; - tree argtype = aarch64_simd_builtin_std_type (d->mode, + tree argtype = aarch64_build_simd_builtin_type (d->mode, qualifier_unsigned); tree ftype = build_function_type_list (usi_type, usi_type, argtype, NULL_TREE); tree attrs = aarch64_get_attributes (FLAG_NONE, d->mode);