From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 24BEC3858D37 for ; Mon, 21 Feb 2022 11:35:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 24BEC3858D37 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A12491476; Mon, 21 Feb 2022 03:35:46 -0800 (PST) Received: from localhost (unknown [10.32.98.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2AFA13F66F; Mon, 21 Feb 2022 03:35:46 -0800 (PST) From: Richard Sandiford To: Christer Solskogen via Gcc-help Mail-Followup-To: Christer Solskogen via Gcc-help , Christer Solskogen , richard.sandiford@arm.com Cc: Christer Solskogen Subject: Re: aarch64 feature modifiers References: Date: Mon, 21 Feb 2022 11:35:44 +0000 In-Reply-To: (Christer Solskogen via Gcc-help's message of "Fri, 18 Feb 2022 11:58:14 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Feb 2022 11:35:48 -0000 Christer Solskogen via Gcc-help writes: > On https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html there's a > list of feature modifiers to -march and -mcpu. Is there a way to check > or detect what features are available on a particular CPU? If you want to compile for a specific CPU then it's better to use -mcpu= with no feature modifiers, and leave out -march. GCC will then make full use of the available features. E.g. -mcpu=neoverse-n1 (on its own) will enable all features available on Neoverse N1 and optimise code for Neoverse N1. If you're just curious which features a given CPU implements, you can find that out by compiling a dummy file with -mcpu. E.g.: echo | gcc -mcpu=neoverse-n1 -xc - -o - -S | grep '\.arch' will print out: .arch armv8.2-a+crc+fp16+rcpc+dotprod+profile But it should never be necessary to convert that back into an -march option. Using -mcpu with no feature modifiers is better. -march is really for the case in which you don't know which CPU the code will run on, but you instead have a baseline set of requirements. Thanks, Richard