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)