]> granicus.if.org Git - clang/commitdiff
[Hexagon] Define macros __HVX__ and __HVXDBL__ when appropriate
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Mon, 18 Apr 2016 18:38:11 +0000 (18:38 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Mon, 18 Apr 2016 18:38:11 +0000 (18:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266647 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/Preprocessor/hexagon-predefines.c [new file with mode: 0644]

index f9bc72dc7987b91925d9e1639c22b9d390147810..dc5f3662e3e3488a1e7218bbe3461bc15189ace1 100644 (file)
@@ -5946,6 +5946,12 @@ void HexagonTargetInfo::getTargetDefines(const LangOptions &Opts,
     Builder.defineMacro("__QDSP6_V60__");
     Builder.defineMacro("__QDSP6_ARCH__", "60");
   }
+
+  if (hasFeature("hvx")) {
+    Builder.defineMacro("__HVX__");
+    if (hasFeature("hvx-double"))
+      Builder.defineMacro("__HVXDBL__");
+  }
 }
 
 bool HexagonTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
diff --git a/test/Preprocessor/hexagon-predefines.c b/test/Preprocessor/hexagon-predefines.c
new file mode 100644 (file)
index 0000000..ba14de9
--- /dev/null
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv5 %s | FileCheck %s -check-prefix CHECK-V5
+
+// CHECK-V5: #define __HEXAGON_ARCH__ 5
+// CHECK-V5: #define __HEXAGON_V5__ 1
+// CHECK-V5: #define __hexagon__ 1
+
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv60 %s | FileCheck %s -check-prefix CHECK-V60
+
+// CHECK-V60: #define __HEXAGON_ARCH__ 60
+// CHECK-V60: #define __HEXAGON_V60__ 1
+// CHECK-V60: #define __hexagon__ 1
+
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv60 -target-feature +hvx %s | FileCheck %s -check-prefix CHECK-V60HVX
+
+// CHECK-V60HVX: #define __HEXAGON_ARCH__ 60
+// CHECK-V60HVX: #define __HEXAGON_V60__ 1
+// CHECK-V60HVX: #define __HVX__ 1
+
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv60 -target-feature +hvx-double  %s | FileCheck %s -check-prefix CHECK-V60HVXD
+
+// CHECK-V60HVXD: #define __HEXAGON_ARCH__ 60
+// CHECK-V60HVXD: #define __HEXAGON_V60__ 1
+// CHECK-V60HVXD: #define __HVXDBL__ 1
+// CHECK-V60HVXD: #define __HVX__ 1
+// CHECK-V60HVXD: #define __hexagon__ 1
+