]> granicus.if.org Git - clang/commitdiff
[Hexagon] Add support for Hexagon V66
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Wed, 5 Dec 2018 21:38:35 +0000 (21:38 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Wed, 5 Dec 2018 21:38:35 +0000 (21:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348415 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Options.td
lib/Basic/Targets/Hexagon.cpp
lib/Driver/ToolChains/Hexagon.cpp
test/Driver/hexagon-hvx.c
test/Driver/hexagon-toolchain-elf.c
test/Preprocessor/hexagon-predefines.c

index e52ae219cdd7e65e684bc7c09d88b6d144d6b433..cde7d80507768ffaa89e39ea625de9439cacea0a 100644 (file)
@@ -2708,6 +2708,8 @@ def mv62 : Flag<["-"], "mv62">, Group<m_hexagon_Features_Group>,
   Alias<mcpu_EQ>, AliasArgs<["hexagonv62"]>;
 def mv65 : Flag<["-"], "mv65">, Group<m_hexagon_Features_Group>,
   Alias<mcpu_EQ>, AliasArgs<["hexagonv65"]>;
+def mv66 : Flag<["-"], "mv66">, Group<m_hexagon_Features_Group>,
+  Alias<mcpu_EQ>, AliasArgs<["hexagonv66"]>;
 def mhexagon_hvx : Flag<["-"], "mhvx">, Group<m_hexagon_Features_HVX_Group>,
   HelpText<"Enable Hexagon Vector eXtensions">;
 def mhexagon_hvx_EQ : Joined<["-"], "mhvx=">,
index c0ce959312a6e1d5412d1cbce320870a0141d4b5..94e1388e381e0d7758945d7343865462e0ece291 100644 (file)
@@ -48,6 +48,9 @@ void HexagonTargetInfo::getTargetDefines(const LangOptions &Opts,
   } else if (CPU == "hexagonv65") {
     Builder.defineMacro("__HEXAGON_V65__");
     Builder.defineMacro("__HEXAGON_ARCH__", "65");
+  } else if (CPU == "hexagonv66") {
+    Builder.defineMacro("__HEXAGON_V66__");
+    Builder.defineMacro("__HEXAGON_ARCH__", "66");
   }
 
   if (hasFeature("hvx-length64b")) {
@@ -145,7 +148,7 @@ struct CPUSuffix {
 static constexpr CPUSuffix Suffixes[] = {
     {{"hexagonv5"},  {"5"}},  {{"hexagonv55"}, {"55"}},
     {{"hexagonv60"}, {"60"}}, {{"hexagonv62"}, {"62"}},
-    {{"hexagonv65"}, {"65"}},
+    {{"hexagonv65"}, {"65"}}, {{"hexagonv66"}, {"66"}},
 };
 
 const char *HexagonTargetInfo::getHexagonCPUSuffix(StringRef Name) {
index 8778a1a30fd20ffe9bc5f10c6b1b586e4b716187..68eea27b2f13c128957dddd0f4552073644b6a2f 100644 (file)
@@ -32,6 +32,7 @@ static StringRef getDefaultHvxLength(StringRef Cpu) {
       .Case("v60", "64b")
       .Case("v62", "64b")
       .Case("v65", "64b")
+      .Case("v66", "128b")
       .Default("128b");
 }
 
index 70699ce3df52316c90beac81696d0c30abe30d43..4642aef81a3195b916aeb1dde4efca7f8b4b0cc1 100644 (file)
@@ -2,6 +2,10 @@
 // Tests for the hvx features and warnings.
 // -----------------------------------------------------------------------------
 
+// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv66 -mhvx \
+// RUN:  2>&1 | FileCheck -check-prefix=CHECKHVX166 %s
+// CHECKHVX166: "-target-feature" "+hvxv66"
+
 // RUN: %clang -c %s -### -target hexagon-unknown-elf -mv65 -mhvx \
 // RUN:  2>&1 | FileCheck -check-prefix=CHECKHVX165 %s
 // CHECKHVX165: "-target-feature" "+hvxv65"
@@ -69,6 +73,9 @@
 // RUN: %clang -c %s -### -target hexagon-unknown-elf -mv60 -mhvx \
 // RUN:  -mhvx-length=64B 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-64B %s
 // CHECK-HVXLENGTH-64B: "-target-feature" "+hvx{{.*}}" "-target-feature" "+hvx-length64b"
+// The default mode on v66 and future archs is 128B.
+// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv66 -mhvx \
+// RUN:  2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-128B %s
 // RUN: %clang -c %s -### -target hexagon-unknown-elf -mv62 -mhvx -mhvx-length=128B\
 // RUN:  2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-128B %s
 // CHECK-HVXLENGTH-128B: "-target-feature" "+hvx{{.*}}" "-target-feature" "+hvx-length128b"
index 96fa968ee521692a049a645b48af7ea045ece8e8..a7eeca0fdb12a32365cc415111ac54a95630ad0e 100644 (file)
 
 // RUN: %clang -### -target hexagon-unknown-elf \
 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
-// RUN:   -O3 \
+// RUN:   -mcpu=hexagonv66 \
 // RUN:   %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK026 %s
-// CHECK026-NOT: "-ffp-contract=fast"
-// CHECK026: {{hexagon-link|ld}}
+// CHECK026: "-cc1" {{.*}} "-target-cpu" "hexagonv66"
+// CHECK026: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v66/crt0
 
 // RUN: %clang -### -target hexagon-unknown-elf \
 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
-// RUN:   -O3 -ffp-contract=off \
+// RUN:   -O3 \
 // RUN:   %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK027 %s
 // CHECK027-NOT: "-ffp-contract=fast"
 // CHECK027: {{hexagon-link|ld}}
 
+// RUN: %clang -### -target hexagon-unknown-elf \
+// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
+// RUN:   -O3 -ffp-contract=off \
+// RUN:   %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK028 %s
+// CHECK028-NOT: "-ffp-contract=fast"
+// CHECK028: {{hexagon-link|ld}}
+
 // -----------------------------------------------------------------------------
 // Test Linker related args
 // -----------------------------------------------------------------------------
index fe87262ae63578082475a9dc822ba6c51418a5db..1d122c0e8275b543d5fd6a5eeacfc22cdece8033 100644 (file)
@@ -34,6 +34,8 @@
 // CHECK-V65: #define __hexagon__ 1
 
 // The HVX flags are explicitly defined by the driver.
+// For v60,v62,v65 - 64B mode is default
+// For v66 and future archs - 128B is default
 // RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv60 \
 // RUN: -target-feature +hvxv60 -target-feature +hvx-length64b %s | FileCheck \
 // RUN: %s -check-prefix CHECK-V60HVX-64B
 // CHECK-V60HVX-128B: #define __HVX_LENGTH__ 128
 // CHECK-V60HVX-128B: #define __HVX__ 1
 // CHECK-V60HVX-128B: #define __hexagon__ 1
+
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv66 \
+// RUN: -target-feature +hvxv66 -target-feature +hvx-length64b %s | FileCheck \
+// RUN: %s -check-prefix CHECK-V66HVX-64B
+// CHECK-V66HVX-64B: #define __HEXAGON_ARCH__ 66
+// CHECK-V66HVX-64B: #define __HEXAGON_V66__ 1
+// CHECK-V66HVX-64B-NOT: #define __HVXDBL__ 1
+// CHECK-V66HVX-64B: #define __HVX_ARCH__ 66
+// CHECK-V66HVX-64B: #define __HVX_LENGTH__ 64
+// CHECK-V66HVX-64B: #define __HVX__ 1
+// CHECK-V66HVX-64B: #define __hexagon__ 1
+
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv66 \
+// RUN: -target-feature +hvxv66 -target-feature +hvx-length128b %s | FileCheck \
+// RUN: %s -check-prefix CHECK-V66HVX-128B
+// CHECK-V66HVX-128B: #define __HEXAGON_ARCH__ 66
+// CHECK-V66HVX-128B: #define __HEXAGON_V66__ 1
+// CHECK-V66HVX-128B: #define __HVXDBL__ 1
+// CHECK-V66HVX-128B: #define __HVX_ARCH__ 66
+// CHECK-V66HVX-128B: #define __HVX_LENGTH__ 128
+// CHECK-V66HVX-128B: #define __HVX__ 1
+// CHECK-V66HVX-128B: #define __hexagon__ 1