From patchwork Thu Nov 4 14:16:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 1551015 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=w3/oc7yG; 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 (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlQhC5ZMfz9s1l for ; Fri, 5 Nov 2021 01:17:31 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8649C3858036 for ; Thu, 4 Nov 2021 14:17:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8649C3858036 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1636035449; bh=NrveGgG3i43di0yB8EpQlTelKBEX3zGrp2ihsOo3aXc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=w3/oc7yGa7ZAZNvl+/dDNZgZo9F61nF7jEljpBJqAlCSo0z5Twk36R+SlNlLyDRc7 JTlKRz3wCr1a/slFk5vOYIAfxViQQJBsJ579IKlzCmaGF9hMyCJPviuLGdXSH3CaOJ EwJ8V/syq6d4d6uXf+88cwZ+gbdY2xNCInO2aH98= 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-am6eur05on2085.outbound.protection.outlook.com [40.107.22.85]) by sourceware.org (Postfix) with ESMTPS id CDE3B385803F for ; Thu, 4 Nov 2021 14:16:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CDE3B385803F Received: from DB9PR06CA0012.eurprd06.prod.outlook.com (2603:10a6:10:1db::17) by DBAPR08MB5637.eurprd08.prod.outlook.com (2603:10a6:10:1b0::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Thu, 4 Nov 2021 14:16:39 +0000 Received: from DB5EUR03FT009.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:1db:cafe::6c) by DB9PR06CA0012.outlook.office365.com (2603:10a6:10:1db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Thu, 4 Nov 2021 14:16:39 +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 DB5EUR03FT009.mail.protection.outlook.com (10.152.20.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Thu, 4 Nov 2021 14:16:39 +0000 Received: ("Tessian outbound 7b0bcc4a550a:v108"); Thu, 04 Nov 2021 14:16:39 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: baca7502fbefe209 X-CR-MTA-TID: 64aa7808 Received: from 44d3a4f16935.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1F536072-A18F-4B16-8942-F19D86DEDDBD.1; Thu, 04 Nov 2021 14:16:33 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 44d3a4f16935.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 04 Nov 2021 14:16:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PLfIzEp6CyfUV92sIlNyWigHGBQbfiicPwDJ3g23NQpNjEWbLR7b0naW0RvrXC63WCSiIl39+yzWU3tHLcLCX5JXselndY96KX2bA2dn3XjZjkuYtfCguMFN7S4KbYPmvdwYCrR0AIFcLv93+GhfulqaX05pfmb5fGvFtBDpiN7mM4UVvunWEGLNOodeVPwIlPfl/csAPt28rBsjvM0JWb4jq9J0X6wHnKGG2qUAgqjq0cl2KnSS6NCGtQunlTSZwHAYsj2UqEPZTddZgn8r5J3gsyN3wA5x8YlrO7eUdfhxfW4KyQa85A4tDKYb6SuQJf05TqUSBNYlqotOWzRHrQ== 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=NrveGgG3i43di0yB8EpQlTelKBEX3zGrp2ihsOo3aXc=; b=M2BwEzETw8ywktjDVolFfR3EzKM58D/Bc8etuLvSE732CfBeV6zEWb3X2hN/fR2EMxHz98jYrI2KybpGWPl7r3ftsJEpw09cGWVW/ySHJI9Js9OYI6yanC16EElx4QxGX8YBlp7pfKkMUFO/4fQlz2j94+NruZ5A8zYwA9rw4wDtgaZYfMNTweEzdo7Cp9d0v0aa+/vQ1PP15S8bJRLdzgf80k4niMPoD06jDshPzX/aqQSNANU7gng0tk1/4mHHnQAOn5GcUARrJHlGmyMyVIcfp7cvEy+5rLdPdUfaz5J4k13mezWG0wzC2ARdjFPzz2fv1+IRoP4pfCA8jMi2NQ== 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 Received: from VE1PR08MB5599.eurprd08.prod.outlook.com (2603:10a6:800:1a1::12) by VI1PR08MB3693.eurprd08.prod.outlook.com (2603:10a6:803:ba::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Thu, 4 Nov 2021 14:16:29 +0000 Received: from VE1PR08MB5599.eurprd08.prod.outlook.com ([fe80::e49f:f587:130d:78e4]) by VE1PR08MB5599.eurprd08.prod.outlook.com ([fe80::e49f:f587:130d:78e4%7]) with mapi id 15.20.4669.011; Thu, 4 Nov 2021 14:16:28 +0000 To: GCC Patches Subject: [PATCH v2] AArch64: Cleanup CPU option processing code Thread-Topic: [PATCH v2] AArch64: Cleanup CPU option processing code Thread-Index: AQHX0YZOIUQ7eYCvzUCUr5+JSdhxAw== Date: Thu, 4 Nov 2021 14:16:28 +0000 Message-ID: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: suggested_attachment_session_id: 0d2a8299-5e6e-8f49-7a6c-e3f2a0941814 Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 18cb62f2-9752-4f76-7713-08d99f9db80c x-ms-traffictypediagnostic: VI1PR08MB3693:|DBAPR08MB5637: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:207;OLM:207; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: TgH1aJvk4bcbewciB1nVFK7G3H5Nb9yRd+WDxI7jzFTKfMndCxI4XMWKiwjFN2yPueprnYb4PeROwsZ8crz6VcJVabpa1nYimAuF7WOiCpbzvs5+zPdH48mkfI+X66l2w1F80HmmxMbfCCltZ6Ak7xeAQT3NXaglweFke8/l2u2yLkaOdu+yhK5lmELAh3TmaVKSVFRSfZ3QcDnsLnqvQ8JhhNw/nYOsaGEe1EpcN2U1tJ/AFVOZnOEgVCf3uQd/5Feh0rXkMNpQ60eeDlmEnGLPG/EAEEfN4moLHQux0Bt4emVNdbibcBD7Q47wTcqw9efVys8KaVtWrEB52s/MZPS2gGutrdLkFqx1DJwkqpqP6j/jR2NmLDszLWjqPBRio9nKMtia81T6/UEyf/amzfHWNh1wiutWCTjyGJ8qqO4etUgcpjWXbkji1a3ATgAJLhqVMmf2Uyj16kgeQhlDISvShpld+2i16flEsSwTOrgpA9BrNApYoD4/QYnmWmFdag/uYemTDAH6Igpj2VbW1IlcRXG2SwSUvBovZJnZkzMdtnPBtjVVE7ZztRQFRI/eK+P3+U60YFq3s0a5Ns8udPJNdNAIRaicNqBwjQar63ITxVXfl59gdx0BSYfYzSM78KepmqF/v36oKriMZp6EFlZLK0e75AZpeZV+6/XHsbJMNOkiN9RTIGcaxzbI0iyIv4jgZ+8AwOMYb/9BWM15gQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB5599.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(7696005)(186003)(6506007)(52536014)(33656002)(64756008)(55016002)(8936002)(83380400001)(8676002)(2906002)(86362001)(6916009)(316002)(66446008)(9686003)(76116006)(38070700005)(54906003)(5660300002)(66556008)(4326008)(508600001)(122000001)(91956017)(66476007)(38100700002)(66946007)(71200400001)(26005); DIR:OUT; SFP:1101; MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3693 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: DB5EUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 05441e96-5861-4f5c-62a8-08d99f9db155 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PK7fgU/Zuw13QpqQFETYeN4vR4U7m35dUd4oIzlqvyjSrR6paRITcnd2L7nI87yRdy43Q3OwIusqiUiW0PK0C6Hxfp/OCAEA55ZJQBpVQw+NApaBsn7GUyFDPN2/1bg09Xw9y90/QwFB2b9cPdQ+SzGPGIxjto+jsEpim4nfO6s3l+8Sh1UCxhAhMSm2qjyuqQNGEORn2Lk9zhtGDjr8pgCZveKEaedM6bdIxcZJWju8N/kiAQtlXSCPzYNENFrXtwKG06ATYrrX3ixXdVPR7DQw/jDoZkz+jchby2kLbtFyl1N0uXs3hb1gXFnDT6UnG+2d/cZzr1+4ksQy2g/+RvGg4L56Oo/2HbXVlLFpKLg9zXDsJiUTuktl4O+iNbkcrnWv9RgHcg9Rzr9q9pDeARqVGgQywdDCc8IvPizGjECYi1M0D+dxtjBt9A8FFnUBHORoWuQpB0QdUb/wih+nKNzcMk2yjf/PIbRRNLA96u3V9qgz5wPLESE4AITzQ4ARnxM1wcEU9mYebbowi7PMlNCsApzAchq1q+d1/X9v5aBegyciUY1qGrvmd0tXg6IhHQ/vorLat9zvvnpuYwP99oXa1iKZPHDBic0ORAMhmFv96qk3yJw1ASsoQIhAdqx6S6PKZ+51ay4DwxNatvDzmxqeUl9IeVRbqWI3XmOT/NxT4uNBrSbG02QdE5cKZcMMAYL6DOTyznqce1ulkD1YpQ== 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)(33656002)(6506007)(508600001)(8936002)(9686003)(54906003)(86362001)(47076005)(83380400001)(4326008)(55016002)(336012)(186003)(82310400003)(6916009)(36860700001)(7696005)(5660300002)(356005)(2906002)(316002)(26005)(70586007)(70206006)(52536014)(8676002)(81166007); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2021 14:16:39.6062 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 18cb62f2-9752-4f76-7713-08d99f9db80c 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: DB5EUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR08MB5637 X-Spam-Status: No, score=-12.0 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: Wilco Dijkstra via Gcc-patches From: Wilco Dijkstra Reply-To: Wilco Dijkstra Cc: Richard Sandiford Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" v2: rebased The --with-cpu/--with-arch configure option processing not only checks valid arguments but also sets TARGET_CPU_DEFAULT with a CPU and extension bitmask. This isn't used however since a --with-cpu is translated into a -mcpu option which is processed as if written on the command-line (so TARGET_CPU_DEFAULT is never accessed). So remove all the complex processing and bitmask, and just validate the option. Fix a bug that always reports valid architecture extensions as invalid. As a result the CPU processing in aarch64.c can be simplified. Bootstrap OK, regress pass, OK for commit? ChangeLog: 2020-09-03 Wilco Dijkstra * config.gcc (aarch64*-*-*): Simplify --with-cpu and --with-arch processing. Add support for architectural extensions. * config/aarch64/aarch64.h (TARGET_CPU_DEFAULT): Remove AARCH64_CPU_DEFAULT_FLAGS. * config/aarch64/aarch64.c (AARCH64_CPU_DEFAULT_FLAGS): Remove define. (get_tune_cpu): Assert CPU is always valid. (get_arch): Assert architecture is always valid. (aarch64_override_options): Cleanup CPU selection code and simplify logic. diff --git a/gcc/config.gcc b/gcc/config.gcc index aa5bd5d14590e38dcee979f236e60c2505a789f9..25b0fa30a2b7cae4bf1e617db9dd70d9b321eeda 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -4146,8 +4146,6 @@ case "${target}" in pattern=AARCH64_CORE fi - ext_mask=AARCH64_CPU_DEFAULT_FLAGS - # Find the base CPU or ARCH id in aarch64-cores.def or # aarch64-arches.def if [ x"$base_val" = x ] \ @@ -4155,23 +4153,6 @@ case "${target}" in ${srcdir}/config/aarch64/$def \ > /dev/null; then - if [ $which = arch ]; then - base_id=`grep "^$pattern(\"$base_val\"," \ - ${srcdir}/config/aarch64/$def | \ - sed -e 's/^[^,]*,[ ]*//' | \ - sed -e 's/,.*$//'` - # Extract the architecture flags from aarch64-arches.def - ext_mask=`grep "^$pattern(\"$base_val\"," \ - ${srcdir}/config/aarch64/$def | \ - sed -e 's/)$//' | \ - sed -e 's/^.*,//'` - else - base_id=`grep "^$pattern(\"$base_val\"," \ - ${srcdir}/config/aarch64/$def | \ - sed -e 's/^[^,]*,[ ]*//' | \ - sed -e 's/,.*$//'` - fi - # Disallow extensions in --with-tune=cortex-a53+crc. if [ $which = tune ] && [ x"$ext_val" != x ]; then echo "Architecture extensions not supported in --with-$which=$val" 1>&2 @@ -4202,25 +4183,7 @@ case "${target}" in grep "^\"$base_ext\""` if [ x"$base_ext" = x ] \ - || [[ -n $opt_line ]]; then - - # These regexp extract the elements based on - # their group match index in the regexp. - ext_canon=`echo -e "$opt_line" | \ - sed -e "s/$sed_patt/\2/"` - ext_on=`echo -e "$opt_line" | \ - sed -e "s/$sed_patt/\3/"` - ext_off=`echo -e "$opt_line" | \ - sed -e "s/$sed_patt/\4/"` - - if [ $ext = $base_ext ]; then - # Adding extension - ext_mask="("$ext_mask") | ("$ext_on" | "$ext_canon")" - else - # Removing extension - ext_mask="("$ext_mask") & ~("$ext_off" | "$ext_canon")" - fi - + || [ x"$opt_line" != x ]; then true else echo "Unknown extension used in --with-$which=$val" 1>&2 @@ -4229,10 +4192,6 @@ case "${target}" in ext_val=`echo $ext_val | sed -e 's/[a-z0-9]\+//'` done - ext_mask="(("$ext_mask") << 6)" - if [ x"$base_id" != x ]; then - target_cpu_cname="TARGET_CPU_$base_id | $ext_mask" - fi true else # Allow --with-$which=native. diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index 2792bb29adbbb5b3145b3f767615af8edbc30b08..c1cd0a9f6ce83a99dc4d5e7ab2cecd463ad06e08 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -798,8 +798,7 @@ enum target_cpus /* If there is no CPU defined at configure, use generic as default. */ #ifndef TARGET_CPU_DEFAULT -#define TARGET_CPU_DEFAULT \ - (TARGET_CPU_generic | (AARCH64_CPU_DEFAULT_FLAGS << 6)) +# define TARGET_CPU_DEFAULT TARGET_CPU_generic #endif /* If inserting NOP before a mult-accumulate insn remember to adjust the diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index ab2954d11333b3f5a419c55d0a74f13d1df70680..430ea036a7be4da842fd08998923a3462457dbfd 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -2135,8 +2135,6 @@ static const struct attribute_spec aarch64_attribute_table[] = { NULL, 0, 0, false, false, false, false, NULL, NULL } }; -#define AARCH64_CPU_DEFAULT_FLAGS ((selected_cpu) ? selected_cpu->flags : 0) - /* An ISA extension in the co-processor and main instruction set space. */ struct aarch64_option_extension { @@ -16930,35 +16928,24 @@ aarch64_validate_mtune (const char *str, const struct processor **res) return false; } -/* Return the CPU corresponding to the enum CPU. - If it doesn't specify a cpu, return the default. */ +/* Return the CPU corresponding to the enum CPU. */ static const struct processor * aarch64_get_tune_cpu (enum aarch64_processor cpu) { - if (cpu != aarch64_none) - return &all_cores[cpu]; + gcc_assert (cpu != aarch64_none); - /* The & 0x3f is to extract the bottom 6 bits that encode the - default cpu as selected by the --with-cpu GCC configure option - in config.gcc. - ???: The whole TARGET_CPU_DEFAULT and AARCH64_CPU_DEFAULT_FLAGS - flags mechanism should be reworked to make it more sane. */ - return &all_cores[TARGET_CPU_DEFAULT & 0x3f]; + return &all_cores[cpu]; } -/* Return the architecture corresponding to the enum ARCH. - If it doesn't specify a valid architecture, return the default. */ +/* Return the architecture corresponding to the enum ARCH. */ static const struct processor * aarch64_get_arch (enum aarch64_arch arch) { - if (arch != aarch64_no_arch) - return &all_architectures[arch]; - - const struct processor *cpu = &all_cores[TARGET_CPU_DEFAULT & 0x3f]; + gcc_assert (arch != aarch64_no_arch); - return &all_architectures[cpu->arch]; + return &all_architectures[arch]; } /* Return the VG value associated with -msve-vector-bits= value VALUE. */ @@ -16996,10 +16983,6 @@ aarch64_override_options (void) uint64_t arch_isa = 0; aarch64_isa_flags = 0; - bool valid_cpu = true; - bool valid_tune = true; - bool valid_arch = true; - selected_cpu = NULL; selected_arch = NULL; selected_tune = NULL; @@ -17014,77 +16997,56 @@ aarch64_override_options (void) If either of -march or -mtune is given, they override their respective component of -mcpu. */ if (aarch64_cpu_string) - valid_cpu = aarch64_validate_mcpu (aarch64_cpu_string, &selected_cpu, - &cpu_isa); + aarch64_validate_mcpu (aarch64_cpu_string, &selected_cpu, &cpu_isa); if (aarch64_arch_string) - valid_arch = aarch64_validate_march (aarch64_arch_string, &selected_arch, - &arch_isa); + aarch64_validate_march (aarch64_arch_string, &selected_arch, &arch_isa); if (aarch64_tune_string) - valid_tune = aarch64_validate_mtune (aarch64_tune_string, &selected_tune); + aarch64_validate_mtune (aarch64_tune_string, &selected_tune); #ifdef SUBTARGET_OVERRIDE_OPTIONS SUBTARGET_OVERRIDE_OPTIONS; #endif - /* If the user did not specify a processor, choose the default - one for them. This will be the CPU set during configuration using - --with-cpu, otherwise it is "generic". */ - if (!selected_cpu) - { - if (selected_arch) - { - selected_cpu = &all_cores[selected_arch->ident]; - aarch64_isa_flags = arch_isa; - explicit_arch = selected_arch->arch; - } - else - { - /* Get default configure-time CPU. */ - selected_cpu = aarch64_get_tune_cpu (aarch64_none); - aarch64_isa_flags = TARGET_CPU_DEFAULT >> 6; - } - - if (selected_tune) - explicit_tune_core = selected_tune->ident; - } - /* If both -mcpu and -march are specified check that they are architecturally - compatible, warn if they're not and prefer the -march ISA flags. */ - else if (selected_arch) + if (selected_cpu && selected_arch) { + /* If both -mcpu and -march are specified, warn if they are not + architecturally compatible and prefer the -march ISA flags. */ if (selected_arch->arch != selected_cpu->arch) { warning (0, "switch %<-mcpu=%s%> conflicts with %<-march=%s%> switch", aarch64_cpu_string, aarch64_arch_string); } + aarch64_isa_flags = arch_isa; - explicit_arch = selected_arch->arch; - explicit_tune_core = selected_tune ? selected_tune->ident - : selected_cpu->ident; } - else + else if (selected_cpu) { - /* -mcpu but no -march. */ - aarch64_isa_flags = cpu_isa; - explicit_tune_core = selected_tune ? selected_tune->ident - : selected_cpu->ident; - gcc_assert (selected_cpu); selected_arch = &all_architectures[selected_cpu->arch]; - explicit_arch = selected_arch->arch; + aarch64_isa_flags = cpu_isa; } - - /* Set the arch as well as we will need it when outputing - the .arch directive in assembly. */ - if (!selected_arch) + else if (selected_arch) { - gcc_assert (selected_cpu); + selected_cpu = &all_cores[selected_arch->ident]; + aarch64_isa_flags = arch_isa; + } + else + { + /* No -mcpu or -march specified, so use the default CPU. */ + selected_cpu = &all_cores[TARGET_CPU_DEFAULT]; selected_arch = &all_architectures[selected_cpu->arch]; + aarch64_isa_flags = selected_cpu->flags; } + explicit_arch = selected_arch->arch; if (!selected_tune) selected_tune = selected_cpu; + explicit_tune_core = selected_tune->ident; + + gcc_assert (explicit_tune_core != aarch64_none); + gcc_assert (explicit_arch != aarch64_no_arch); if (aarch64_enable_bti == 2) { @@ -17120,15 +17082,6 @@ aarch64_override_options (void) if (aarch64_ra_sign_scope != AARCH64_FUNCTION_NONE && TARGET_ILP32) sorry ("return address signing is only supported for %<-mabi=lp64%>"); - /* Make sure we properly set up the explicit options. */ - if ((aarch64_cpu_string && valid_cpu) - || (aarch64_tune_string && valid_tune)) - gcc_assert (explicit_tune_core != aarch64_none); - - if ((aarch64_cpu_string && valid_cpu) - || (aarch64_arch_string && valid_arch)) - gcc_assert (explicit_arch != aarch64_no_arch); - /* The pass to insert speculation tracking runs before shrink-wrapping and the latter does not know how to update the tracking status. So disable it in this case. */