Specifying a target architecture, processor, and instruction set
When compiling code, the compiler must know which architecture or processor to target, and which instruction set to use.
To specify a target architecture with
armclang, use the
Supported targets are as follows:
- The AArch64 state of the ARMv8 architecture. This target supports the A64 instruction set. This is the default target.
- The AArch32 state of the ARMv8 architecture. This target supports the A32 and T32 instruction sets.
--targetoption is an
armclangoption. For all of the other tools, such as
armlink, use the
--deviceoptions to specify target processors and architectures.
Targeting an architecture with
generates generic code that runs on any processor with that architecture. If you
want to optimize your code for a particular processor, use the
-mcpu option. The
-mcpu option supports the following
Processors in AArch64 state execute A64 instructions. Processors in AArch32 state can execute A32 or T32 instructions. To specify the target instruction set for AArch32 state, use the following command-line options:
-marmtargets the A32 instruction set. This is the default for the
-mthumbtargets the T32 instruction set.
-mthumboptions are only valid with AArch32 targets, for example
--target=armv8a-arm-none-eabi. The compiler ignores the
-mthumboptions and generates a warning with AArch64 targets.
ARM Compiler 6 lets you compile for the following combinations of architecture and instruction set:
Table 3-1 Compiling for different combinations of architecture and instruction set
|Architecture||Processor||Instruction set||armclang command|
|ARMv8 AArch32 state||Generic||A32||
|ARMv8 AArch32 state||Cortex-A57||A32||
|ARMv8 AArch32 state||Cortex-A53||A32||
|ARMv8 AArch32 state||Generic||T32||
|ARMv8 AArch32 state||Cortex-A57||T32||
|ARMv8 AArch32 state||Cortex-A53||T32||
|ARMv8 AArch64 state||Generic||A64||
|ARMv8 AArch64 state||Cortex-A57||A64||
|ARMv8 AArch64 state||Cortex-A53||A64||