Index: lib/Basic/Targets.cpp =================================================================== --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -3441,9 +3441,6 @@ Builder.defineMacro("__ARM_SIZEOF_MINIMAL_ENUM", Opts.ShortEnums ? "1" : "4"); - if (BigEndian) - Builder.defineMacro("__AARCH_BIG_ENDIAN"); - if (FPU == NeonMode) { Builder.defineMacro("__ARM_NEON"); // 64-bit NEON supports half, single and double precision operations. @@ -3633,6 +3630,8 @@ void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { Builder.defineMacro("__AARCH64EB__"); + Builder.defineMacro("__AARCH_BIG_ENDIAN"); + Builder.defineMacro("__ARM_BIG_ENDIAN"); AArch64TargetInfo::getTargetDefines(Opts, Builder); } }; Index: test/Preprocessor/init.c =================================================================== --- test/Preprocessor/init.c +++ test/Preprocessor/init.c @@ -211,14 +211,17 @@ // SHORTWCHAR2: #define __SIZEOF_WCHAR_T__ 4 // SHORTWCHAR2: #define __WCHAR_WIDTH__ 32 // Other definitions vary from platform to platform -// + // RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-none-none < /dev/null | FileCheck -check-prefix AARCH64 %s // // AARCH64:#define _LP64 1 +// AARCH64-NOT:#define __AARCH64EB__ 1 // AARCH64:#define __AARCH64EL__ 1 +// AARCH64-NOT:#define __AARCH_BIG_ENDIAN 1 // AARCH64:#define __ARM_64BIT_STATE 1 // AARCH64:#define __ARM_ARCH 8 // AARCH64:#define __ARM_ARCH_ISA_A64 1 +// AARCH64-NOT:#define __ARM_BIG_ENDIAN 1 // AARCH64:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ // AARCH64:#define __CHAR16_TYPE__ unsigned short // AARCH64:#define __CHAR32_TYPE__ unsigned int @@ -311,13 +314,118 @@ // AARCH64:#define __WINT_WIDTH__ 32 // AARCH64:#define __aarch64__ 1 // +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64_be-none-none < /dev/null | FileCheck -check-prefix AARCH64-BE %s +// +// AARCH64-BE:#define _LP64 1 +// AARCH64-BE:#define __AARCH64EB__ 1 +// AARCH64-BE-NOT:#define __AARCH64EL__ 1 +// AARCH64-BE:#define __AARCH_BIG_ENDIAN 1 +// AARCH64-BE:#define __ARM_64BIT_STATE 1 +// AARCH64-BE:#define __ARM_ARCH 8 +// AARCH64-BE:#define __ARM_ARCH_ISA_A64 1 +// AARCH64-BE:#define __ARM_BIG_ENDIAN 1 +// AARCH64-BE:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ +// AARCH64-BE:#define __CHAR16_TYPE__ unsigned short +// AARCH64-BE:#define __CHAR32_TYPE__ unsigned int +// AARCH64-BE:#define __CHAR_BIT__ 8 +// AARCH64-BE:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// AARCH64-BE:#define __DBL_DIG__ 15 +// AARCH64-BE:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// AARCH64-BE:#define __DBL_HAS_DENORM__ 1 +// AARCH64-BE:#define __DBL_HAS_INFINITY__ 1 +// AARCH64-BE:#define __DBL_HAS_QUIET_NAN__ 1 +// AARCH64-BE:#define __DBL_MANT_DIG__ 53 +// AARCH64-BE:#define __DBL_MAX_10_EXP__ 308 +// AARCH64-BE:#define __DBL_MAX_EXP__ 1024 +// AARCH64-BE:#define __DBL_MAX__ 1.7976931348623157e+308 +// AARCH64-BE:#define __DBL_MIN_10_EXP__ (-307) +// AARCH64-BE:#define __DBL_MIN_EXP__ (-1021) +// AARCH64-BE:#define __DBL_MIN__ 2.2250738585072014e-308 +// AARCH64-BE:#define __DECIMAL_DIG__ 36 +// AARCH64-BE:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// AARCH64-BE:#define __FLT_DIG__ 6 +// AARCH64-BE:#define __FLT_EPSILON__ 1.19209290e-7F +// AARCH64-BE:#define __FLT_EVAL_METHOD__ 0 +// AARCH64-BE:#define __FLT_HAS_DENORM__ 1 +// AARCH64-BE:#define __FLT_HAS_INFINITY__ 1 +// AARCH64-BE:#define __FLT_HAS_QUIET_NAN__ 1 +// AARCH64-BE:#define __FLT_MANT_DIG__ 24 +// AARCH64-BE:#define __FLT_MAX_10_EXP__ 38 +// AARCH64-BE:#define __FLT_MAX_EXP__ 128 +// AARCH64-BE:#define __FLT_MAX__ 3.40282347e+38F +// AARCH64-BE:#define __FLT_MIN_10_EXP__ (-37) +// AARCH64-BE:#define __FLT_MIN_EXP__ (-125) +// AARCH64-BE:#define __FLT_MIN__ 1.17549435e-38F +// AARCH64-BE:#define __FLT_RADIX__ 2 +// AARCH64-BE:#define __INT16_TYPE__ short +// AARCH64-BE:#define __INT32_TYPE__ int +// AARCH64-BE:#define __INT64_C_SUFFIX__ L +// AARCH64-BE:#define __INT64_TYPE__ long int +// AARCH64-BE:#define __INT8_TYPE__ char +// AARCH64-BE:#define __INTMAX_MAX__ 9223372036854775807L +// AARCH64-BE:#define __INTMAX_TYPE__ long int +// AARCH64-BE:#define __INTMAX_WIDTH__ 64 +// AARCH64-BE:#define __INTPTR_TYPE__ long int +// AARCH64-BE:#define __INTPTR_WIDTH__ 64 +// AARCH64-BE:#define __INT_MAX__ 2147483647 +// AARCH64-BE:#define __LDBL_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966L +// AARCH64-BE:#define __LDBL_DIG__ 33 +// AARCH64-BE:#define __LDBL_EPSILON__ 1.92592994438723585305597794258492732e-34L +// AARCH64-BE:#define __LDBL_HAS_DENORM__ 1 +// AARCH64-BE:#define __LDBL_HAS_INFINITY__ 1 +// AARCH64-BE:#define __LDBL_HAS_QUIET_NAN__ 1 +// AARCH64-BE:#define __LDBL_MANT_DIG__ 113 +// AARCH64-BE:#define __LDBL_MAX_10_EXP__ 4932 +// AARCH64-BE:#define __LDBL_MAX_EXP__ 16384 +// AARCH64-BE:#define __LDBL_MAX__ 1.18973149535723176508575932662800702e+4932L +// AARCH64-BE:#define __LDBL_MIN_10_EXP__ (-4931) +// AARCH64-BE:#define __LDBL_MIN_EXP__ (-16381) +// AARCH64-BE:#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L +// AARCH64-BE:#define __LONG_LONG_MAX__ 9223372036854775807LL +// AARCH64-BE:#define __LONG_MAX__ 9223372036854775807L +// AARCH64-BE:#define __LP64__ 1 +// AARCH64-BE:#define __POINTER_WIDTH__ 64 +// AARCH64-BE:#define __PTRDIFF_TYPE__ long int +// AARCH64-BE:#define __PTRDIFF_WIDTH__ 64 +// AARCH64-BE:#define __SCHAR_MAX__ 127 +// AARCH64-BE:#define __SHRT_MAX__ 32767 +// AARCH64-BE:#define __SIG_ATOMIC_WIDTH__ 32 +// AARCH64-BE:#define __SIZEOF_DOUBLE__ 8 +// AARCH64-BE:#define __SIZEOF_FLOAT__ 4 +// AARCH64-BE:#define __SIZEOF_INT128__ 16 +// AARCH64-BE:#define __SIZEOF_INT__ 4 +// AARCH64-BE:#define __SIZEOF_LONG_DOUBLE__ 16 +// AARCH64-BE:#define __SIZEOF_LONG_LONG__ 8 +// AARCH64-BE:#define __SIZEOF_LONG__ 8 +// AARCH64-BE:#define __SIZEOF_POINTER__ 8 +// AARCH64-BE:#define __SIZEOF_PTRDIFF_T__ 8 +// AARCH64-BE:#define __SIZEOF_SHORT__ 2 +// AARCH64-BE:#define __SIZEOF_SIZE_T__ 8 +// AARCH64-BE:#define __SIZEOF_WCHAR_T__ 4 +// AARCH64-BE:#define __SIZEOF_WINT_T__ 4 +// AARCH64-BE:#define __SIZE_MAX__ 18446744073709551615UL +// AARCH64-BE:#define __SIZE_TYPE__ long unsigned int +// AARCH64-BE:#define __SIZE_WIDTH__ 64 +// AARCH64-BE:#define __UINTMAX_TYPE__ long unsigned int +// AARCH64-BE:#define __USER_LABEL_PREFIX__ _ +// AARCH64-BE:#define __WCHAR_MAX__ 4294967295U +// AARCH64-BE:#define __WCHAR_TYPE__ unsigned int +// AARCH64-BE:#define __WCHAR_UNSIGNED__ 1 +// AARCH64-BE:#define __WCHAR_WIDTH__ 32 +// AARCH64-BE:#define __WINT_TYPE__ int +// AARCH64-BE:#define __WINT_WIDTH__ 32 +// AARCH64-BE:#define __aarch64__ 1 +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-netbsd < /dev/null | FileCheck -check-prefix AARCH64-NETBSD %s // // AARCH64-NETBSD:#define _LP64 1 +// AARCH64-NETBSD-NOT:#define __AARCH64EB__ 1 // AARCH64-NETBSD:#define __AARCH64EL__ 1 +// AARCH64-NETBSD-NOT:#define __AARCH_BIG_ENDIAN 1 // AARCH64-NETBSD:#define __ARM_64BIT_STATE 1 // AARCH64-NETBSD:#define __ARM_ARCH 8 // AARCH64-NETBSD:#define __ARM_ARCH_ISA_A64 1 +// AARCH64-NETBSD-NOT:#define __ARM_BIG_ENDIAN 1 // AARCH64-NETBSD:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ // AARCH64-NETBSD:#define __CHAR16_TYPE__ unsigned short // AARCH64-NETBSD:#define __CHAR32_TYPE__ unsigned int @@ -410,7 +518,7 @@ // AARCH64-NETBSD:#define __WINT_TYPE__ int // AARCH64-NETBSD:#define __WINT_WIDTH__ 32 // AARCH64-NETBSD:#define __aarch64__ 1 -// + // RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-none < /dev/null | FileCheck -check-prefix ARM %s // // ARM-NOT:#define _LP64