Pre-defined Architecture Macros

Table of Content - Architecture

Table of Content - Architecture
Alpha
AMD64
ARM
HP/PA RISC
Intel x86
Intel Architecture-64
Motorola 68k
MIPS
PowerPC
RS/6000
SPARC
SuperH
System/370
System/390
z/Architecture

Alpha

Type Macro Description
Identification __alpha__ Defined by GNU C
Version __alpha_ev'V'__ V = Version
Identification __alpha Defined by DEC C
Identification _M_ALPHA Defined by Visual Studio

Example

CPU Macro
Alpha EV4 __alpha_ev4__
Alpha EV5 __alpha_ev5__
Alpha EV6 __alpha_ev6__

Official site Google Directory Wikipedia

AMD64

Type Macro Description
Identification __amd64__
__amd64
__x86_64__
__x86_64
Defined by GNU C and Sun Studio
Identification _M_X64 Defined by Visual Studio

Official site Google Directory Wikipedia

ARM

Type Macro Description
Identification __arm__ Defined by GNU C and RealView
Identification __thumb__ Defined by GNU C and RealView in Thumb mode
Identification __TARGET_ARCH_ARM
__TARGET_ARCH_THUMB
Defined by RealView
Version __TARGET_ARCH_ARM = V
__TARGET_ARCH_THUMB = V
V = Version
Version __TARGET_ARCH_'VR' VR = Version and Revision

Example

CPU Macro
ARM 4T __TARGET_ARM_4T

Official site Google Directory Wikipedia

HP/PA RISC

Type Macro Description
Identification __hppa__ Defined by GNU C
Identification __hppa .
Version _PA_RISC'V'_'R' V = Version
R = Revision

Example

CPU Macro
PA RISC 1.0 _PA_RISC1_0
PA RISC 1.1 _PA_RISC1_1
PA RISC 2.0 _PA_RISC2_0
PA RISC 2.0 __RISC2_0__

Official site Wikipedia

Intel x86

Type Macro Format Description
Identification i386
__i386__
. Defined by GNU C
Version __i386__
__i486__
__i586__
__i686__
. Defined by GNU C
Identification __i386 . Defined by Sun Studio
Identification _M_IX86 . Defined by Visual Studio, Intel C/C++, and Digital Mars
Version _M_IX86 V00 V = Version
Identification _X86_ . Defined by MinGW32
Identification __THW_INTEL__ . Defined by XL C/C++
Identification __I86__ . Defined by Digital Mars
Version __I86__ V V = Version
Identification __INTEL__ . Defined by CodeWarrior

Example

CPU _M_IX86 __I86__
80386 300 3
80486 400 4
Pentium 500 5
Pentium Pro/II 600 6

Official site Google Directory Wikipedia

Intel Architecture-64

Type Macro Format Description
Identification __ia64__
_IA64
__IA64__
. Defined by GNU C
Identification __ia64 . Defined by HP aCC
Identification _M_IA64 . Defined by Visual Studio
Identification _M_IA64 . Defined by Intel C/C++
Version _M_IA64 ? .

Example

CPU _M_IA64 (Intel C/C++)
. 64100

Wikipedia

Motorola 68k

Type Macro Description
Identification __m68k__ Defined by GNU C
Version __mc'V'__
__mc'V'
mc'V'
V = Version
Identification M68000 Defined by SAS/C

Example

CPU Macro
68000 __mc68000__
68010 __mc68010__
68020 __mc68020__
68030 __mc68030__
68040 __mc68040__
68060 __mc68060__

Wikipedia

MIPS

Type Macro Description
Identification __mips__ Defined by GNU C
Version _MIPS_ISA = _MIPS_ISA_MIPS'V' V = MIPS ISA level
Version _R3000
_R4000
.
Identification __mips Defined by MIPSpro
Version __mips The value indicates the MIPS ISA (Instruction Set Architecture) level
Version __MIPS_ISA'V'__ V = MIPS ISA level
Identification __MIPS__ Defined by Metrowerks

Example

CPU _MIPS_ISA GNU C Macro __mips MIPSpro Macro
R2000 _MIPS_ISA_MIPS1 . 1 .
R3000 _MIPS_ISA_MIPS1 _R3000 1 .
R6000 _MIPS_ISA_MIPS2 . 2 __MIPS_ISA2__
R4000 . _R4000 . .
R4400 _MIPS_ISA_MIPS3 . 3 __MIPS_ISA3__
R8000 _MIPS_ISA_MIPS4 . 4 __MIPS_ISA4__
R10000 _MIPS_ISA_MIPS4 . 4 __MIPS_ISA4__

Official site Wikipedia

PowerPC

Type Macro Description
Identification __powerpc
__powerpc__
__POWERPC__
__ppc__
Defined by GNU C
Version __ppc'V'__ V = Version
Identification _M_PPC Defined by Visual Studio
Version _M_PPC .
Identification _ARCH_PPC Defined by XL C/C++
Version _ARCH_'V' V = Version

Example

CPU _M_PPC Macro Macro
PowerPC 601 601 __ppc601__ _ARCH_601
PowerPC 603 603 __ppc603__ _ARCH_603
PowerPC 604 604 __ppc604__ _ARCH_604
PowerPC 620 620 . .

Official site Wikipedia

RS/6000

Type Macro Description
Identification __THW_RS6000 Defined by XL C/C++
Identification _IBMR2 .
Identification _POWER .
Identification _ARCH_PWR
_ARCH_PWR2
.

Official site Wikipedia

SPARC

Type Macro Description
Identification __sparc__ Defined by GNU C
Identification __sparc Defined by Sun Studio
Version __sparcv8
__sparcv9
Defined by Sun Studio

Example

CPU Macro
SPARC v8 (SuperSPARC) __sparcv8
SPARC v9 (UltraSPARC) __sparcv9

Official site Google Directory Wikipedia

SuperH

Type Macro Description
Identification __sh__ Defined by GNU C
Version __sh1__
__sh2__
__sh3__
__SH3__
__SH4__
__SH5__
.

Official site Wikipedia

System/370

Type Macro Description
Identification __370__
__THW_370__
Defined by XL C/C++

Wikipedia

System/390

Type Macro Description
Identification __s390__
__s390x__
Defined by GNU C

Wikipedia

z/Architecture

Type Macro Description
Identification __SYSC_ZARCH__ Defined by Systems/C

Wikipedia