5.4 Selecting the target processor at compile time

You can often significantly improve the performance of your C or C++ code by selecting the appropriate target processor at compile time.

Each new version of the ARM architecture typically supports extra instructions, extra modes of operation, pipeline differences, and register renaming.

Procedure

  1. Decide whether the compiled program is to run on a specific ARM architecture-based processor or on different ARM processors.
  2. Obtain the name, or names, of the target processors recognized by the compiler using the following compiler command-line option:
    --cpu=list
    
  3. If the compiled program is to run on a specific ARM architecture-based processor, having obtained the name of the processor with the --cpu=list option, select the target processor using the --cpu=name compiler command-line option.

    For example, to compile code to run on a Cortex-A9 processor:

    armcc --cpu=Cortex-A9 myprog.c

    Alternatively, if the compiled program is to run on different ARM processors, choose the lowest common denominator architecture appropriate for the application and then specify that architecture in place of the processor name. For example, to compile code for processors supporting the ARMv6 architecture:

    armcc --cpu=6 myprog.c 

Selecting the target processor using the --cpu=name command-line option lets the compiler:

  • Make full use of all available instructions for that particular processor.

  • Perform processor-specific optimizations such as instruction scheduling.

--cpu=list lists all the processors and architectures that the compiler supports.

Non-ConfidentialPDF file icon PDF versionARM DUI0472M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.