Predefined Macro Names

The compiler maintains and recognizes the predefined macro names listed in Table 2-30.

Table 2-30 Predefined ARM Macro Names

Macro Name Description
__16bis__ Defined if 16-BIS state is selected (the -code_state=16 option is used); otherwise, it is undefined.
__32bis__ Defined if 32-BIS state is selected (the -code_state=16 option is not used); otherwise, it is undefined.
_AEABI_PORTABILITY_LEVEL Define to 1 to enable full object file portability when headers files are included. Define to 0 to require full C standard compatibility. See the ARM standard for details.
__DATE__(1) Expands to the compilation date in the form mmm dd yyyy
__FILE__(1) Expands to the current source filename
__LINE__(1) Expands to the current line number
__signed_chars__ Defined if char types are signed by default
__STDC__(1) Defined to 1 to indicate that compiler conforms to ISO C Standard. See Section 5.1 for exceptions to ISO C conformance.
__STDC_VERSION__ C standard macro.
__STDC_HOSTED__ C standard macro. Always defined to 1.
__STDC_NO_THREADS__ C standard macro. Always defined to 1.
__TI_COMPILER_VERSION__ Defined to a 7-9 digit integer, depending on if X has 1, 2, or 3 digits. The number does not contain a decimal. For example, version 3.2.1 is represented as 3002001. The leading zeros are dropped to prevent the number being interpreted as an octal.
__TI_EABI_SUPPORT__ Defined to 1 if the EABI ABI is enabled (this is the default); otherwise, it is undefined.
__TI_FPALIB_SUPPORT__ Defined to 1 if the FPA endianness is used to store double-precision floating-point values; otherwise, it is undefined.
__TI_GNU_ATTRIBUTE_SUPPORT__ Defined to 1 if GCC extensions are enabled (which is the default)
__TI_NEON_SUPPORT__ Defined to 1 if NEON SIMD extension is targeted (the --neon option is used); otherwise, it is undefined.
__TI_STRICT_ANSI_MODE__ Defined to 1 if strict ANSI/ISO mode is enabled (the --strict_ansi option is used); otherwise, it is defined as 0.
__TI_STRICT_FP_MODE__ Defined to 1 if --fp_mode=strict is used (default); otherwise, it is defined as 0.
__TI_ ARM_V4__ Defined to 1 if the v4 architecture (ARM7) is targeted (the -mv4 option is used); otherwise, it is undefined.
__TI_ ARM_V5__ Defined to 1 if the v5E architecture (ARM9E) is targeted (the -mv5e option is used); otherwise, it is undefined.
__TI_ ARM_V6__ Defined to 1 if the v6 architecture (ARM11) is targeted (the -mv6 option is used); otherwise, it is undefined.
__TI_ ARM_V6M0__ Defined to 1 if the v6M0 architecture (Cortex-M0) is targeted (the -mv6M0 option is used); otherwise, it is undefined.
__TI_ ARM_V7__ Defined to 1 if any v7 architecture (Cortex) is targeted; otherwise, it is undefined.
__TI_ ARM_V7A8__ Defined to 1 if the v7A8 architecture (Cortex-A8) is targeted (the -mv7A8 option is used); otherwise, it is undefined.
__TI_ ARM_V7M3__ Defined to 1 if the v7M3 architecture (Cortex-M3) is targeted (the -mv7M3 option is used); otherwise, it is undefined.
__TI_ ARM_V7M4__ Defined to 1 if the v7M4 architecture (Cortex-M4) is targeted (the -mv7M4 option is used); otherwise, it is undefined.
__TI_ ARM_V7R4__ Defined to 1 if the v7R4 architecture (Cortex-R4) is targeted (the -mv7R4 option is used); otherwise, it is undefined.
__TI_ ARM_V7R5__ Defined to 1 if the v7R5 architecture (Cortex-R5) is targeted (the -mv7R5 option is used); otherwise, it is undefined.
__TI_VFP_SUPPORT__ Defined to 1 if the VFP coprocessor is enabled (any --float_support option is used); otherwise, it is undefined.
__TI_VFPLIB_SUPPORT__ Defined to 1 if the VFP endianness is used to store double-precision floating-point values; otherwise, it is undefined.
__TI_VFPV3_SUPPORT__ Defined to 1 if the VFP coprocessor is enabled (the --float_support=vfpv3 option is used); otherwise, it is undefined.
__TI_VFPV3D16_SUPPORT__ Defined to 1 if the VFP coprocessor is enabled (the --float_support=vfpv3d16 option is used); otherwise, it is undefined.
__TI_FPV4SPD16_SUPPORT__ Defined to 1 if the VFP coprocessor is enabled (the --float_support=fpv4spd16 option is used); otherwise, it is undefined.
__TI_WCHAR_T_BITS__ Set to the type of wchar_t.
__TIME__(1) Expands to the compilation time in the form "hh:mm:ss"
__TI_ ARM__ Always defined
__unsigned_chars__ Defined if char types are unsigned by default (default)
__big_endian__ Defined if big-endian mode is selected (the --endian=big option is used or the --endian=little option is not used); otherwise, it is undefined.
__WCHAR_T_TYPE__ Set to the type of wchar_t.
_INLINE Expands to 1 if optimization is used (--opt_level or -O option); undefined otherwise.
__little_endian__ Defined if little-endian mode is selected (the --endian=little option is used); otherwise, it is undefined.
Specified by the ISO standard

NOTE

Macros with names that contain __TI_ARM are duplicates of the older __TI_TMS470 macros. For example, __TI_ARM_V7__ is the newer name for the __TI_TMS470_V7__ macro. The old macro names still exist and can continue to be used.

You can use the names listed in Table 2-30 in the same manner as any other defined name. For example,

printf ( "%s %s" , __TIME__ , __DATE__);

translates to a line such as:

printf ("%s %s" , "13:58:17", "Jan 14 1997");

In addition, the ARM C Language Extensions (ACLE) v2.0 specification describes macros that identify features of the ARM architecture and how the C/C++ implementation uses the architecture. All ACLE predefined macros begin with the prefix __ARM. Table 2-31 lists the macros mentioned in the ACLE specification and the section of the specification that provides more information. Some macros are undefined because they are not applicable for any Cortex-M or Cortex-R processor variant.

Table 2-31 ACLE Pre-Defined Macros

Macro Name Description Section in ACLE Specification
__ARM_32BIT_STATE Defined as 1 if the compiler is generating code for an ARM 32-bit processor variant (-mv6m0, -mv7m3, -mv7m4, -mv7a8, -mv7r4, and -mv7r5); undefined otherwise. (Section 5.4.1)
__ARM_64BIT_STATE Undefined (Section 5.4.1)
__ARM_ACLE Defined as 200 for all Cortex-M and Cortex-R processor variants (-mv6m0, -mv7m3, -mv7m4, -mv7r4, and -mv7r5). (Sections 3.4, 5.2)
__ARM_ALIGN_MAX_PWR Not supported (Section 6.5.2)
__ARM_ALIGN_MAX_STACK_PWR Not supported (Section 6.5.3)
__ARM_ARCH Identifies the version of ARM architecture selected on the compiler command line.
  • 4 indicates -mv4
  • 5 indicates -mv5e
  • 6 indicates -mv6 or -mv6m0
  • 7 indicates -mv7a8, -mv7m3, -mv7m4, -mv7r4, or -mv7r5
(Section 5.1)
__ARM_ARCH_ISA_A64 Undefined (Section 5.4.1)
__ARM_ARCH_ISA_ARM Defined as 1 if the compiler is generating code for a processor variant that supports the ARM instruction set (-mv7a8, -mv7r4, and -mv7r5); undefined otherwise. (Section 5.4.1)
__ARM_ARCH_ISA_THUMB Defined as 1 if the compiler is generating code for a processor variant that supports the THUMB-1 instruction set. Defined as 2 if the compiler is generating code for a processor variant that supports the THUMB-2 instruction set; undefined otherwise. (Section 5.4.1)
__ARM_ARCH_PROFILE Not supported (Section 5.4.2)
__ARM_BIG_ENDIAN Defined as 1 by default; not defined if --little-endian (-me) option is used. (Section 5.3)
__ARM_FEATURE_CLZ Defined as 1 if the compiler is generating code for a processor variant that supports the CLZ instruction (-mv7m3, -mv7m4, -mv7a8, -mv7r4, and -mv7r5); undefined otherwise. (Section 5.4.5)
__ARM_FEATURE_COPROC Not supported (Section 5.9)
__ARM_FEATURE_CRC32 Undefined (Section 5.5.8)
__ARM_FEATURE_CRYPTO Undefined (Section 5.5.7)
__ARM_FEATURE_DIRECTED_ROUNDING Undefined (Section 5.5.9)
__ARM_FEATURE_DSP Defined as 1 if the compiler is generating code for a Cortex-M or Cortex-R processor that supports DSP instructions/intrinsics (-mv7m4, -mv7r4, and -mv7r5); undefined otherwise. (Section 5.4.7)
__ARM_FEATURE_FMA Not supported (Section 5.5.3)
__ARM_FEATURE_FP16_SCALAR_ ARITHMETIC Undefined (Sections 3.4, 5.5.13)
__ARM_FEATURE_FP16_VECTOR_ ARITHMETIC Undefined (Section 5.5.13)
__ARM_FEATURE_IDIV Not supported (Section 5.4.10)
__ARM_FEATURE_JCVT Undefined (Section 5.5.14)
__ARM_FEATURE_LDREX Undefined (Section 5.4.4)
__ARM_FEATURE_NUMERIC_MAXMIN Undefined (Section 5.5.10)
__ARM_FEATURE_QBIT Not supported (Section 5.4.6)
__ARM_FEATURE_QRDMX Undefined (Section 5.5.12)
__ARM_FEATURE_SAT Defined as 1 if the compiler is generating code for a processor variant that supports SSAT/USAT instructions/intrinsics (-mv7m3, -mv7m4, -mv7a8, -mv7r4, and -mv7r5); undefined otherwise. (Section 5.4.8)
__ARM_FEATURE_SIMD32 Defined as 1 if the compiler is generating code for a processor variant that supports all SIMD instructions/intrinsics (-mv7m4, -mv7r4, and -mv7r5); undefined otherwise. (Section 5.4.9)
__ARM_FEATURE_UNALIGNED Defined as 1 if the compiler is generating code for a processor variant that supports unaligned access to memory (-mv7m3, -mv7m4, -mv7a8, -mv7r4, and -mv7r5); undefined otherwise. (Section 5.4.3)
__ARM_FP Defined as 6 for --float_support={fpv4spd16 | fpv5spd16}. Defined as 12 for --float_support={vfpv2 | vfpv3 | vfpv3d16}; undefined otherwise. (Section 5.5.1)
__ARM_FP16_ARGS Defined as 1 if a 16-bit float type can be used for an argument and/or result; undefined otherwise. (Section 5.5.11)
__ARM_FP16_FORMAT_ALTERNATIVE Undefined (Section 5.5.2)
__ARM_FP16_FORMAT_IEEE Defined as 1 if the IEEE format for 16-bit floating-point (according to IEEE 754-2008 standard) is used; undefined otherwise. (Section 5.5.2)
__ARM_FP_FAST Not supported (Section 5.6)
__ARM_FP_FENV_ROUNDING Not supported (Section 5.6)
__ARM_NEON Undefined (Sections 3.4, 5.5.4)
__ARM_NEON_FP Undefined (Section 5.5.5)
__ARM_PCS Defined as 1 if the compiler can assume the default procedure calling standard for a translation unit conforms to the "base procedure call standard" as prescribed in the ARM Architecture Procedure Call Standard (AAPCS) specification (-mv7m3, -mv7m4, -mv7r4, and -mv7r5); undefined otherwise. (Section 5.7)
__ARM_PCS_AAPCS64 Undefined (Section 5.7)
__ARM_PCS_VFP Defined as 1 if the default procedure calling convention is to pass floating-point arguments / return values in hardware floating-point registers; undefined otherwise. (Section 5.7)
__ARM_ROPI Undefined (Section 5.8)
__ARM_RWPI Undefined (Section 5.8)
__ARM_SIZEOF_MINIMAL_ENUM Defined to the smallest possible enum type size (1 byte for packed, 4 bytes for int). This mirrors the --enum_type=[packed | int] option where packed is the default. (Section 3.1.1)
__ARM_SIZEOF_WCHAR_T Defined as 2 if --wchar_t=16 (default). Defined as 4 if --wchar_t=32. (Section 3.1.1)
__ARM_WMMX Undefined (Section 5.5.6)
__STDC_IEC_559__ Undefined (Section 5.6)
__SUPPORT_SNAN__ Not supported (Section 5.6)