You copied the Doc URL to your clipboard.

-mcpu

Enables code generation for a specific ARM® processor.

Syntax

-mcpu=name

-mcpu=name[+[no]feature]* (AArch64 targets only)

Where:

name

Specifies the processor.

The following are valid -mcpu values with --target=aarch64-arm-none-eabi and --target=arm-arm-none-eabi:

  • cortex-a53
  • cortex-a57
  • cortex-a72

The following are valid -mcpu values with --target=arm-arm-none-eabi only:

  • cortex-a5
  • cortex-a7
  • cortex-a8
  • cortex-a9
  • cortex-a12
  • cortex-a15
  • cortex-a17
feature

Enables or disables an optional architectural feature (AArch64 targets only), any of the following:

  • crc - enable CRC instructions.
  • crypto - enable the cryptographic extension.
  • fp - enable the floating-point extension.
  • simd - enable the NEON advanced SIMD extension.

Note

name and feature are case-sensitive.

Usage

For AArch64 targets only, you can use -mcpu option to enable and disable specific architectural features.

To disable a feature, prefix with no, for example cortex-a57+nocrypto.

To enable or disable multiple features, chain multiple feature modifiers. For example, to enable CRC instructions and disable all other extensions:

armclang --target=aarch64-arm-none-eabi -mcpu=cortex-a57+nocrypto+nofp+nosimd+crc

If you specify conflicting feature modifiers with -mcpu, the rightmost feature is used. For example, the following command enables the floating-point extension:

armclang --target=aarch64-arm-none-eabi -mcpu=cortex-a57+nofp+fp

You can prevent the use of floating-point instructions or floating-point registers for AArch64 targets with the -mcpu=name+nofp+nosimd option. Subsequent use of floating-point data types in this mode is unsupported.

Default

For AArch64 targets (--target=aarch64-arm-none-eabi), the compiler generates generic code for the ARMv8-A architecture in AArch64 state by default.

For AArch32 targets (--target=arm-arm-none-eabi) there is no default. You must specify either -march (to target an architecture) or -mcpu (to target a processor).

Examples

To target the AArch64 state of a Cortex®â€‘A57 processor:

armclang --target=aarch64-arm-none-eabi -mcpu=cortex-a57 test.c

To target the AArch32 state of a Cortex‑A53 processor, generating A32 instructions:

armclang --target=arm-arm-none-eabi -mcpu=cortex-a53 -marm test.c

Related reference

Was this page helpful? Yes No