From patchwork Tue Jul 19 18:22:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Carlotti X-Patchwork-Id: 1658173 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=RkqwW7tV; dkim-atps=neutral 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+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.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 (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LnRyk5XJ7z9s2R for ; Wed, 20 Jul 2022 04:22:54 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 596B43858430 for ; Tue, 19 Jul 2022 18:22:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 596B43858430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1658254971; bh=hdpM3cI/l8euC7B6VZXYXAl9TMK8PzJoRbgwpTf4odY=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=RkqwW7tVBIp7JE10lD45Mupx0ydzjxL0dU16+izhFACTjywJretx2hMlUcLngcYJW cBsKMn1IfWxHIBrzJKwIrpmZPmZT3FIFYeWM2obhm946MojcqtI4JW2P54GsaC0SEL 3jwRRm1rR9NlXlhETuszBWe+61YwtXmfK0NNsW9g= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10041.outbound.protection.outlook.com [40.107.1.41]) by sourceware.org (Postfix) with ESMTPS id 14B523858C83 for ; Tue, 19 Jul 2022 18:22:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 14B523858C83 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Li4CcP2M40UYLhpZS0sEBM8WptBHh7viga5/8bt56QIQNwELTTemjHCULTpkyIOlGhw8QCacRMqrDduNY+/2NrCt5209XB2Kvw7nNzTLVsoS5Q3PrNJfjgOLumrlaQti/NYsIAaJCQlwH6gTjpClIGvDPGPdC64s5suYOrv/LpAnrlIpzJUzvwtppwIfu14Imk0NR1GyqI2yCYhSOLTQkSQHxP1RXh/V9LGFcAyQJxixxiTVFGHo1FW+e6t1gbwIdQPvVxpemOccKMVHxxiM7ioaCcs85YkcjVejqtKrNs6jCd8/Oc5+a3IcYJ+XPAa+FdvZIou4wJce/q5vlIII8Q== 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=hdpM3cI/l8euC7B6VZXYXAl9TMK8PzJoRbgwpTf4odY=; b=R+AVh1fu4u33zdzdW/GSIaqIOyugF4vLiJKeva3fBV8wqGDe4LGnLIuGUAEzi/rc0DrL26zyDqn+7Y5+mi7gq9SKwHOLxq9NrtU5w6MvfBevmVeUqioMRCbYds3KxThbPluiw/lhkDA3qmsw+PelJUfCFJ8wNGm9lIYaRdgz2A/Ais1iosT+ZFnAM+2h3toEpP6Qdu2tK4E1seLucvXgfSLJYiYztihP5qYbNRNL73Im0QGUtQ5BupehGu9mFv2k0H6GLEZOwa/up8QN0avBWd45w03MSmLspw8UleRZRzSkXimgrN8uCXBX8hFR2nQYpItsdMrx1oNI5EPop3d7kg== 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 AS9PR06CA0226.eurprd06.prod.outlook.com (2603:10a6:20b:45e::25) by AM5PR0801MB1668.eurprd08.prod.outlook.com (2603:10a6:203:3c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12; Tue, 19 Jul 2022 18:22:27 +0000 Received: from AM5EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45e:cafe::51) by AS9PR06CA0226.outlook.office365.com (2603:10a6:20b:45e::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.13 via Frontend Transport; Tue, 19 Jul 2022 18:22:27 +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 AM5EUR03FT005.mail.protection.outlook.com (10.152.16.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12 via Frontend Transport; Tue, 19 Jul 2022 18:22:27 +0000 Received: ("Tessian outbound cc6a8ab50b6b:v123"); Tue, 19 Jul 2022 18:22:27 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 231047c5f6ab7842 X-CR-MTA-TID: 64aa7808 Received: from aafd99296d67.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 791954CD-1480-4F43-84E2-65B193C37BC2.1; Tue, 19 Jul 2022 18:22:16 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id aafd99296d67.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 19 Jul 2022 18:22:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U5Ur5W7ZuujC46nKW9VKlRD1XxkO69FujPO8xCReP9njadUasLWj3ca4Rcw38191mwBQ+ho+RjqJpeS+BukAQJi/IEsKfeeltDC0m6/w684eEFRMWk/R/4Gpq6B0F7KEIwwerEz4b011Xkr/ucqPF42Kgg+Q27TgRf4FIcvR9WKuVJkLGo1y2wLRFtZVdvhZXFkCj40K8yFXrsDuHS+v+rzy2KLSnRKtCXO+oODVnHNEQCRE5ZCdXUK8xmrKGreo4dXrX9lpesCqZXYc0I+zKzXTkVlwgVD639ky55+CZG8ouGNbeG05RpbTv9Rm9rCruebDJiTH3ArNRsyXYbeeHA== 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=hdpM3cI/l8euC7B6VZXYXAl9TMK8PzJoRbgwpTf4odY=; b=b85Y14QaEOCd2sDylcXdUDOx8uxM1CFkp1h6l0bKz4LT649KIoMKhEPfRPzIm7I6DPPL1YYGRAqjYpR95uwZe0Vn6BKJywg/CgRw9F+3vgPgdJQP6YE2ppPVxWUmkkF7WJ0mscsoMpgOFCLjMYarbRtztWlZKF5crn8KrAiRg5p754LaCNgicGQRqopl233MfTsMfAc/iSkUqeemR+WHMA2bLJmRU/2bgtV0hUtTjcXUbH2raB70p5Y98Pbs1HxpQid49Pi1Z0UGYMG/wu+4oXfutERy/f/b6kSWli/f0Ecx8lYJc5ls0T3uyxP7CqBfH/y+FSJiR1gR6FNdcCbLZA== 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 DB6PR0801MB1973.eurprd08.prod.outlook.com (2603:10a6:4:73::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.20; Tue, 19 Jul 2022 18:22:14 +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.023; Tue, 19 Jul 2022 18:22:13 +0000 Date: Tue, 19 Jul 2022 19:22:23 +0100 To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH v2.1 3/4] aarch64: Consolidate simd type lookup functions Message-ID: References: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: LO4P123CA0174.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18a::17) To AS8PR08MB6678.eurprd08.prod.outlook.com (2603:10a6:20b:398::8) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: d7080774-329a-46a2-dbaf-08da69b3a2a7 X-MS-TrafficTypeDiagnostic: DB6PR0801MB1973:EE_|AM5EUR03FT005:EE_|AM5PR0801MB1668: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: LbZ9mxn3fLgbnX1PTukUYNXxbq4GJ6zMVP5FwdT7L1biVjOAFFct0q1L/VNn0RFNtHlYksw1aEMSYC9i9Xr+GOGltIVQ+vaDsh7ct+4atGRYVJWY5/dKvqzHa616n5J/jq3/iINQWUYoZ3B6AF/6uHdejZirPeqKuMgFsaUEkZnr/fF69ittr7s3VsgogSgXLgfVLFTjL6b95jBF/4Ho0XZ+rP2Ng2BK9F3k02V3ut5OXO2cBy67cRb/VKXOA/xRpUsRhvgKYrXwyRWF9fUrrTn4HwOgnnPOQNy7VS0kvaDIMko91p76aBpiyWrD52bVaCCLY2depfcMcfgARf2q/lpNPM84V8Bk3gmYtTOs74NANRIM3T4TpRTA9mBgPfzpl+h/vSF19tiVI0oT3wTZzdcYJ57A4OlI1hoi0T9F72HMobuVWcRD8DZCtV9x0lpzvY9CzVL4WJk/u/Mw8AZZz8yiQHRSPcytxHj//36QGx/UAH0KR6D/FU9hGyfB/vRK9f/Tz6F4dhjPtaTWzgCBGT3UO/wdvO+TEacBhVqywqNsKmC5013HYjL0I/P/COaIN6TAF2cqYhjIvStxZKqAapUaSeJg5XweZJPe7Kyhx8YKc8RMlBsxs0iCObAYqlwm8MPDMK7fsctP77N/xPKlRaO7ZKFNwWByjCtCKIDSDDfqL7hVD1HV3zcI8TET/4/c0kFUvtgRW5vpguiCwXasjisM9C5+tkMdcXNQ7yJ6eCs= 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)(396003)(136003)(366004)(346002)(376002)(39860400002)(478600001)(6636002)(5660300002)(66476007)(8936002)(66556008)(316002)(2906002)(66946007)(8676002)(44832011)(83380400001)(6506007)(38100700002)(86362001)(6486002)(41300700001)(6512007)(26005)(186003)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1973 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: AM5EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: d093237b-9bed-44c6-f638-08da69b399df X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6U5SpAqNOLUY101TEBpSMDmeHcG6nYwNXaD/VtzpmSIdqcknkGZzR8b9H7+64L0oJ/UfR976lnQQrNaUYVpUk3vqabCkUly+buwzeo/LsNcjkgbA2qYaJ2N/wEMMaxlcL4XNpbuRtDVth2gPSYx6auYlQPM7N/CZf4TzJ4ukwuNlwmFwGnbv0YX1VTTFq8HoQ/VPL1vWDGmed3yxeWtpKtI3VYpR58a0uf9ukOfm4xpmLDRISdy2yuXgrObK4X38+JOUfS+aH64OCZx9FHkvCPYeG8l3rOaVXPIvIFaUtfMGZkBi64qYvMILYjKjs9V9PH+b+A9+qmMQJYhZk0ipg6ufXA7/tytLxVqz+xWZm7khMlzY2fJlo9WCsS3qDcNhwNbnxZATNJp+jedjyMIaGM1RNBJ5Wsnj0xdKc+qWSj+nuC8vSEoUJp2QuicFyoE5yC/NHb1ZADLYH26xCP72PkTDPwW/fOeuDzT4717JGB3LYdRmxgj9xgjB0eZhMIG+0LSYMvWj8/eQJ5bFAK4SZPpauW2YeJ2WJjWt8yG8tWAChbGyZU9E7VI04ZvqFQ29Up3LSBQpTxhWyY+uxZIKIlanT41XDHqOFYKztTCPxOk0qVzn7izygMQag64MWaOd7QU6XuND95hC8wgtfQcFZdeSbNqY7atX3n5ZYahMkwWy9jOX69EMqBFhF4rM00n1bWDRIuKfxcKnDEx7k/hsXcGsdpe0jspOuRGLZ1geMN3bX5bQ67ts+V90AHPFDGo7uDw4GKqJUGQ8byoWZL/Ih1/Ttsn89EznHE9KMBmF9B5D57p/A5pFcrOG/lgARrnx 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)(136003)(346002)(376002)(39860400002)(396003)(36840700001)(46966006)(40470700004)(8676002)(316002)(478600001)(6636002)(70206006)(8936002)(70586007)(83380400001)(40480700001)(86362001)(36860700001)(5660300002)(6486002)(41300700001)(186003)(47076005)(336012)(6506007)(44832011)(6666004)(2906002)(40460700003)(81166007)(356005)(82740400003)(6512007)(26005)(82310400005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2022 18:22:27.4440 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d7080774-329a-46a2-dbaf-08da69b3a2a7 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: AM5EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1668 X-Spam-Status: No, score=-13.4 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, 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 Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" On Wed, Jul 13, 2022 at 05:36:04PM +0100, Richard Sandiford wrote: > I like the part about getting rid of: > > static tree > aarch64_simd_builtin_type (machine_mode mode, > bool unsigned_p, bool poly_p) > > and the flow of the new function. However, I think it's still > slightly more readable if we keep the switch and lookup routines > separate, partly to keep down the size of the main routine and > partly to avoid the goto. I agree. > So how about: > > - aarch64_simd_builtin_std_type becomes aarch64_int_or_fp_element_type > but otherwise stays as-is > > ... I've called it aarch64_int_or_fp_type, because it's sometimes used for an operand that doesn't represent an element of a vector. Updated patch below. --- There were several similarly-named functions, which each built or looked up an operand type using a different subset of valid modes or qualifiers. This change provides a single function to return operand types, which can additionally handle const and pointer qualifiers. For clarity, the existing functionality is kept in separate helper functions. gcc/ChangeLog: * config/aarch64/aarch64-builtins.cc (aarch64_simd_builtin_std_type): Rename to... (aarch64_int_or_fp_type): ...this, and allow irrelevant qualifiers. (aarch64_lookup_simd_builtin_type): Rename to... (aarch64_simd_builtin_type): ...this. Add const/pointer support, and extract table lookup to... (aarch64_lookup_simd_type_in_table): ...this function. (aarch64_init_crc32_builtins): Update to use aarch64_simd_builtin_type. (aarch64_init_fcmla_laneq_builtins): Ditto. (aarch64_init_simd_builtin_functions): Ditto. --- diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc index 55ad2e8b6831d6cc2b039270c8656d429347092d..cd7c2a79d9b4d67adf1d9de1f9b56eb3a0d1ee2b 100644 --- a/gcc/config/aarch64/aarch64-builtins.cc +++ b/gcc/config/aarch64/aarch64-builtins.cc @@ -788,12 +788,13 @@ aarch64_general_mangle_builtin_type (const_tree type) return NULL; } +/* Helper function for aarch64_simd_builtin_type. */ static tree -aarch64_simd_builtin_std_type (machine_mode mode, - enum aarch64_type_qualifiers q) +aarch64_int_or_fp_type (machine_mode mode, + enum aarch64_type_qualifiers qualifiers) { -#define QUAL_TYPE(M) \ - ((q == qualifier_none) ? int##M##_type_node : unsigned_int##M##_type_node); +#define QUAL_TYPE(M) ((qualifiers & qualifier_unsigned) \ + ? unsigned_int##M##_type_node : int##M##_type_node); switch (mode) { case E_QImode: @@ -826,16 +827,14 @@ aarch64_simd_builtin_std_type (machine_mode mode, #undef QUAL_TYPE } +/* Helper function for aarch64_simd_builtin_type. */ static tree -aarch64_lookup_simd_builtin_type (machine_mode mode, - enum aarch64_type_qualifiers q) +aarch64_lookup_simd_type_in_table (machine_mode mode, + enum aarch64_type_qualifiers qualifiers) { 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); + int q = qualifiers & (qualifier_poly | qualifier_unsigned); for (i = 0; i < nelts; i++) { @@ -852,16 +851,32 @@ aarch64_lookup_simd_builtin_type (machine_mode mode, return NULL_TREE; } +/* Return a type for an operand with specified mode and qualifiers. */ static tree aarch64_simd_builtin_type (machine_mode mode, - bool unsigned_p, bool poly_p) + enum aarch64_type_qualifiers qualifiers) { - 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); + tree type = NULL_TREE; + + /* 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); + + /* Non-poly scalar modes map to standard types not in the table. */ + if ((qualifiers & qualifier_poly) || VECTOR_MODE_P (mode)) + type = aarch64_lookup_simd_type_in_table (mode, qualifiers); else - return aarch64_lookup_simd_builtin_type (mode, qualifier_none); + type = aarch64_int_or_fp_type (mode, qualifiers); + + gcc_assert (type != 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); + + return type; } static void @@ -1110,12 +1125,11 @@ 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_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); + tree quadtype = aarch64_simd_builtin_type (quadmode, qualifier_none); tree lanetype - = aarch64_simd_builtin_std_type (SImode, qualifier_lane_pair_index); + = aarch64_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 +1224,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_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 +1381,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_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_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);