[clang] 0d14656 - [mips] Set __OCTEON__ macros
Simon Atanasyan via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 5 01:11:14 PST 2019
Author: Simon Atanasyan
Date: 2019-11-05T12:10:58+03:00
New Revision: 0d14656b9d8ca38b8ea321c7047eaeec43c5b2ef
URL: https://github.com/llvm/llvm-project/commit/0d14656b9d8ca38b8ea321c7047eaeec43c5b2ef
DIFF: https://github.com/llvm/llvm-project/commit/0d14656b9d8ca38b8ea321c7047eaeec43c5b2ef.diff
LOG: [mips] Set __OCTEON__ macros
Added:
Modified:
clang/lib/Basic/Targets/Mips.cpp
clang/test/Preprocessor/init.c
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/Mips.cpp b/clang/lib/Basic/Targets/Mips.cpp
index 4ca7f08af823..9b35bbcb7638 100644
--- a/clang/lib/Basic/Targets/Mips.cpp
+++ b/clang/lib/Basic/Targets/Mips.cpp
@@ -189,6 +189,9 @@ void MipsTargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("_MIPS_ARCH", "\"" + CPU + "\"");
Builder.defineMacro("_MIPS_ARCH_" + StringRef(CPU).upper());
+ if (StringRef(CPU).startswith("octeon"))
+ Builder.defineMacro("__OCTEON__");
+
// These shouldn't be defined for MIPS-I but there's no need to check
// for that since MIPS-I isn't supported.
Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c
index 4e79077687c7..f80e4de9e5eb 100644
--- a/clang/test/Preprocessor/init.c
+++ b/clang/test/Preprocessor/init.c
@@ -4839,6 +4839,7 @@
// MIPS-ARCH-OCTEON:#define _MIPS_ARCH "octeon"
// MIPS-ARCH-OCTEON:#define _MIPS_ARCH_OCTEON 1
// MIPS-ARCH-OCTEON:#define _MIPS_ISA _MIPS_ISA_MIPS64
+// MIPS-ARCH-OCTEON:#define __OCTEON__ 1
// MIPS-ARCH-OCTEON:#define __mips_isa_rev 2
//
// Check MIPS float ABI macros
More information about the cfe-commits
mailing list