Add PPC A2Q core and BG/Q preprocessor definitions

The a2q core is the variant of the a2 core used on the BG/Q supercomputers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174151 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 4d0a833..4647970 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -661,7 +661,9 @@
     ArchDefine603   = 1 << 4,
     ArchDefine604   = 1 << 5,
     ArchDefinePwr4  = 1 << 6,
-    ArchDefinePwr6  = 1 << 7
+    ArchDefinePwr6  = 1 << 7,
+    ArchDefineA2    = 1 << 8,
+    ArchDefineA2q   = 1 << 9
   } ArchDefineTypes;
 
   virtual bool setCPU(const std::string &Name) {
@@ -686,6 +688,7 @@
       .Case("970", true)
       .Case("g5", true)
       .Case("a2", true)
+      .Case("a2q", true)
       .Case("e500mc", true)
       .Case("e5500", true)
       .Case("pwr6", true)
@@ -894,6 +897,8 @@
     .Case("pwr6",  ArchDefinePwr6 | ArchDefinePpcgr | ArchDefinePpcsq)
     .Case("pwr7",  ArchDefineName | ArchDefinePwr6 | ArchDefinePpcgr
                      | ArchDefinePpcsq)
+    .Case("a2",    ArchDefineA2)
+    .Case("a2q",   ArchDefineName | ArchDefineA2 | ArchDefineA2q)
     .Default(ArchDefineNone);
 
   if (defs & ArchDefineName)
@@ -913,7 +918,20 @@
   if (defs & ArchDefinePwr6) {
     Builder.defineMacro("_ARCH_PWR5");
     Builder.defineMacro("_ARCH_PWR6");
-  }  
+  }
+  if (defs & ArchDefineA2)
+    Builder.defineMacro("_ARCH_A2");
+  if (defs & ArchDefineA2q) {
+    Builder.defineMacro("_ARCH_A2Q");
+    Builder.defineMacro("_ARCH_QP");
+  }
+
+  if (getTriple().getVendor() == llvm::Triple::BGQ) {
+    Builder.defineMacro("__bg__");
+    Builder.defineMacro("__THW_BLUEGENE__");
+    Builder.defineMacro("__bgq__");
+    Builder.defineMacro("__TOS_BGQ__");
+  }
 }
 
 void PPCTargetInfo::getDefaultFeatures(llvm::StringMap<bool> &Features) const {