public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* aarch64 feature modifiers
@ 2022-02-18 10:58 Christer Solskogen
  2022-02-21 11:35 ` Richard Sandiford
  0 siblings, 1 reply; 4+ messages in thread
From: Christer Solskogen @ 2022-02-18 10:58 UTC (permalink / raw)
  To: gcc-help

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?

-- 
chs


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: aarch64 feature modifiers
  2022-02-18 10:58 aarch64 feature modifiers Christer Solskogen
@ 2022-02-21 11:35 ` Richard Sandiford
  2022-02-21 11:51   ` Christer Solskogen
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Sandiford @ 2022-02-21 11:35 UTC (permalink / raw)
  To: Christer Solskogen via Gcc-help; +Cc: Christer Solskogen

Christer Solskogen via Gcc-help <gcc-help@gcc.gnu.org> 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=<that-cpu> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: aarch64 feature modifiers
  2022-02-21 11:35 ` Richard Sandiford
@ 2022-02-21 11:51   ` Christer Solskogen
  2022-02-21 12:29     ` Richard Sandiford
  0 siblings, 1 reply; 4+ messages in thread
From: Christer Solskogen @ 2022-02-21 11:51 UTC (permalink / raw)
  To: gcc-help

On 21.02.2022 12:35, Richard Sandiford via Gcc-help wrote:
> Christer Solskogen via Gcc-help <gcc-help@gcc.gnu.org> 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=<that-cpu> 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
> 
>

I see. Thank you.
Does that mean that the cortex-a72 doesn't really support the +crypto or 
+simd? Or does that depend on what is built?

-- 
chs


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: aarch64 feature modifiers
  2022-02-21 11:51   ` Christer Solskogen
@ 2022-02-21 12:29     ` Richard Sandiford
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Sandiford @ 2022-02-21 12:29 UTC (permalink / raw)
  To: Christer Solskogen via Gcc-help; +Cc: Christer Solskogen

Christer Solskogen via Gcc-help <gcc-help@gcc.gnu.org> writes:
> On 21.02.2022 12:35, Richard Sandiford via Gcc-help wrote:
>> Christer Solskogen via Gcc-help <gcc-help@gcc.gnu.org> 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=<that-cpu> 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

BTW, I should have said that this only explicitly lists the *optional*
features.  It doesn't include features that are required by Armv8.2-A.

> I see. Thank you.
> Does that mean that the cortex-a72 doesn't really support the +crypto or 
> +simd? Or does that depend on what is built?

+simd and +fp are implied by the armv8.2-a (and armv8-a).

Cortex-A72 support for +crypto is optional, so you're right that it has
to be specified explicitly when present.  See the TRM for details:

    https://developer.arm.com/documentation/100095/0003

Thanks,
Richard

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-21 12:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18 10:58 aarch64 feature modifiers Christer Solskogen
2022-02-21 11:35 ` Richard Sandiford
2022-02-21 11:51   ` Christer Solskogen
2022-02-21 12:29     ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).