r263596 - Myriad: define __myriad2 macro automatically
Douglas Katzman via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 15 15:34:02 PDT 2016
Author: dougk
Date: Tue Mar 15 17:34:02 2016
New Revision: 263596
URL: http://llvm.org/viewvc/llvm-project?rev=263596&view=rev
Log:
Myriad: define __myriad2 macro automatically
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Driver/myriad-toolchain.c
cfe/trunk/test/Preprocessor/predefined-arch-macros.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=263596&r1=263595&r2=263596&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Mar 15 17:34:02 2016
@@ -6031,7 +6031,9 @@ public:
CK_NIAGARA,
CK_NIAGARA2,
CK_NIAGARA3,
- CK_NIAGARA4
+ CK_NIAGARA4,
+ CK_MYRIAD2_1,
+ CK_MYRIAD2_2
} CPU = CK_GENERIC;
enum CPUGeneration {
@@ -6050,6 +6052,8 @@ public:
case CK_SPARCLITE86X:
case CK_SPARCLET:
case CK_TSC701:
+ case CK_MYRIAD2_1:
+ case CK_MYRIAD2_2:
return CG_V8;
case CK_V9:
case CK_ULTRASPARC:
@@ -6080,6 +6084,9 @@ public:
.Case("niagara2", CK_NIAGARA2)
.Case("niagara3", CK_NIAGARA3)
.Case("niagara4", CK_NIAGARA4)
+ .Case("myriad2", CK_MYRIAD2_1)
+ .Case("myriad2.1", CK_MYRIAD2_1)
+ .Case("myriad2.2", CK_MYRIAD2_2)
.Default(CK_GENERIC);
}
@@ -6177,6 +6184,20 @@ public:
}
break;
}
+ if (getTriple().getVendor() == llvm::Triple::Myriad) {
+ switch (CPU) {
+ case CK_MYRIAD2_1:
+ Builder.defineMacro("__myriad2", "1");
+ Builder.defineMacro("__myriad2__", "1");
+ break;
+ case CK_MYRIAD2_2:
+ Builder.defineMacro("__myriad2", "2");
+ Builder.defineMacro("__myriad2__", "2");
+ break;
+ default:
+ break;
+ }
+ }
}
};
Modified: cfe/trunk/test/Driver/myriad-toolchain.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/myriad-toolchain.c?rev=263596&r1=263595&r2=263596&view=diff
==============================================================================
--- cfe/trunk/test/Driver/myriad-toolchain.c (original)
+++ cfe/trunk/test/Driver/myriad-toolchain.c Tue Mar 15 17:34:02 2016
@@ -36,10 +36,10 @@
// As such, we test only for a trailing quote in its rendering.
// The same goes for "moviAsm".
-// RUN: %clang -target shave-myriad -mcpu=myriad1 -c -### %s -isystem somewhere -Icommon -Wa,-yippee 2>&1 \
+// RUN: %clang -target shave-myriad -mcpu=myriad2.2 -c -### %s -isystem somewhere -Icommon -Wa,-yippee 2>&1 \
// RUN: | FileCheck %s -check-prefix=MOVICOMPILE
-// MOVICOMPILE: moviCompile{{(.exe)?}}" "-S" "-fno-exceptions" "-DMYRIAD2" "-mcpu=myriad1" "-isystem" "somewhere" "-I" "common"
-// MOVICOMPILE: moviAsm{{(.exe)?}}" "-no6thSlotCompression" "-cv:myriad1" "-noSPrefixing" "-a"
+// MOVICOMPILE: moviCompile{{(.exe)?}}" "-S" "-fno-exceptions" "-DMYRIAD2" "-mcpu=myriad2.2" "-isystem" "somewhere" "-I" "common"
+// MOVICOMPILE: moviAsm{{(.exe)?}}" "-no6thSlotCompression" "-cv:myriad2.2" "-noSPrefixing" "-a"
// MOVICOMPILE: "-yippee" "-i:somewhere" "-i:common" "-elf"
// RUN: %clang -target shave-myriad -c -### %s -DEFINE_ME -UNDEFINE_ME 2>&1 \
Modified: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/predefined-arch-macros.c?rev=263596&r1=263595&r2=263596&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c (original)
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c Tue Mar 15 17:34:02 2016
@@ -1903,8 +1903,17 @@
// RUN: %clang -E -dM %s -o - 2>&1 \
// RUN: -target sparcel-unknown-linux \
// RUN: | FileCheck %s -check-prefix=CHECK_SPARCEL
-//
+// RUN: %clang -E -dM %s -o - -target sparcel-myriad -mcpu=myriad2 2>&1 \
+// RUN: | FileCheck %s -check-prefix=CHECK_MYRIAD2-1 -check-prefix=CHECK_SPARCEL
+// RUN: %clang -E -dM %s -o - -target sparcel-myriad -mcpu=myriad2.1 2>&1 \
+// RUN: | FileCheck %s -check-prefix=CHECK_MYRIAD2-1 -check-prefix=CHECK_SPARCEL
+// RUN: %clang -E -dM %s -o - -target sparcel-myriad -mcpu=myriad2.2 2>&1 \
+// RUN: | FileCheck %s -check-prefix=CHECK_MYRIAD2-2 -check-prefix=CHECK_SPARCEL
// CHECK_SPARCEL: #define __LITTLE_ENDIAN__ 1
+// CHECK_MYRIAD2-1: #define __myriad2 1
+// CHECK_MYRIAD2-1: #define __myriad2__ 1
+// CHECK_MYRIAD2-2: #define __myriad2 2
+// CHECK_MYRIAD2-2: #define __myriad2__ 2
// CHECK_SPARCEL: #define __sparc 1
// CHECK_SPARCEL: #define __sparc__ 1
// CHECK_SPARCEL: #define __sparcv8 1
More information about the cfe-commits
mailing list