Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions clang/include/clang/Basic/BuiltinsHexagon.td
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ class V<string version, VFeatures newer> : VFeatures {
let Features = !strconcat("v", version, "|", newer.Features);
}

let Features = "v79" in def V79 : VFeatures;
let Features = "v81" in def V81 : VFeatures;

def V79 : V<"79", V81>;
def V75 : V<"75", V79>;
def V73 : V<"73", V75>;
def V71 : V<"71", V73>;
Expand All @@ -43,8 +44,9 @@ class HVXV<string version, HVXVFeatures newer> : HVXVFeatures {
let Features = !strconcat("hvxv", version, "|", newer.Features);
}

let Features = "hvxv79" in def HVXV79 : HVXVFeatures;
let Features = "hvxv81" in def HVXV81 : HVXVFeatures;

def HVXV79 : HVXV<"79", HVXV81>;
def HVXV75 : HVXV<"75", HVXV79>;
def HVXV73 : HVXV<"73", HVXV75>;
def HVXV71 : HVXV<"71", HVXV73>;
Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -6558,6 +6558,8 @@ def mv75 : Flag<["-"], "mv75">, Group<m_hexagon_Features_Group>,
Alias<mcpu_EQ>, AliasArgs<["hexagonv75"]>;
def mv79 : Flag<["-"], "mv79">, Group<m_hexagon_Features_Group>,
Alias<mcpu_EQ>, AliasArgs<["hexagonv79"]>;
def mv81 : Flag<["-"], "mv81">, Group<m_hexagon_Features_Group>,
Alias<mcpu_EQ>, AliasArgs<["hexagonv81"]>;
def mhexagon_hvx : Flag<["-"], "mhvx">, Group<m_hexagon_Features_HVX_Group>,
HelpText<"Enable Hexagon Vector eXtensions">;
def mhexagon_hvx_EQ : Joined<["-"], "mhvx=">,
Expand Down
6 changes: 4 additions & 2 deletions clang/lib/Basic/Targets/Hexagon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ void HexagonTargetInfo::getTargetDefines(const LangOptions &Opts,
} else if (CPU == "hexagonv79") {
Builder.defineMacro("__HEXAGON_V79__");
Builder.defineMacro("__HEXAGON_ARCH__", "79");
} else if (CPU == "hexagonv81") {
Builder.defineMacro("__HEXAGON_V81__");
Builder.defineMacro("__HEXAGON_ARCH__", "81");
}

if (hasFeature("hvx-length64b")) {
Expand Down Expand Up @@ -252,8 +255,7 @@ static constexpr CPUSuffix Suffixes[] = {
{{"hexagonv68"}, {"68"}}, {{"hexagonv69"}, {"69"}},
{{"hexagonv71"}, {"71"}}, {{"hexagonv71t"}, {"71t"}},
{{"hexagonv73"}, {"73"}}, {{"hexagonv75"}, {"75"}},
{{"hexagonv79"}, {"79"}},
};
{{"hexagonv79"}, {"79"}}, {{"hexagonv81"}, {"81"}}};

std::optional<unsigned> HexagonTargetInfo::getHexagonCPURev(StringRef Name) {
StringRef Arch = Name;
Expand Down
7 changes: 7 additions & 0 deletions clang/test/Driver/hexagon-toolchain-elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@
// CHECK250: "-cc1" {{.*}} "-target-cpu" "hexagonv79"
// CHECK250: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v79/crt0

// RUN: not %clang -### --target=hexagon-unknown-elf \
// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
// RUN: -mcpu=hexagonv81 -fuse-ld=hexagon-link \
// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK260 %s
// CHECK260: "-cc1" {{.*}} "-target-cpu" "hexagonv81"
// CHECK260: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v81/crt0

// -----------------------------------------------------------------------------
// Test Linker related args
// -----------------------------------------------------------------------------
Expand Down
17 changes: 17 additions & 0 deletions clang/test/Preprocessor/hexagon-predefines.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,23 @@
// CHECK-V79HVX-128B: #define __HVX__ 1
// CHECK-V79HVX-128B: #define __hexagon__ 1

// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv81 %s\
// RUN: | FileCheck %s -check-prefix CHECK-V81
// CHECK-V81: #define __HEXAGON_ARCH__ 81
// CHECK-V81: #define __HEXAGON_PHYSICAL_SLOTS__ 4
// CHECK-V81: #define __HEXAGON_V81__ 1
// CHECK-V81: #define __hexagon__ 1

// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv81 \
// RUN: -target-feature +hvxv81 -target-feature +hvx-length128b %s | FileCheck \
// RUN: %s -check-prefix CHECK-V81HVX-128B
// CHECK-V81HVX-128B: #define __HEXAGON_ARCH__ 81
// CHECK-V81HVX-128B: #define __HEXAGON_V81__ 1
// CHECK-V81HVX-128B: #define __HVX_ARCH__ 81
// CHECK-V81HVX-128B: #define __HVX_LENGTH__ 128
// CHECK-V81HVX-128B: #define __HVX__ 1
// CHECK-V81HVX-128B: #define __hexagon__ 1

// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv67 \
// RUN: -target-feature +hvxv67 -target-feature +hvx-length128b %s | FileCheck \
// RUN: %s -check-prefix CHECK-ELF
Expand Down
14 changes: 14 additions & 0 deletions llvm/include/llvm/IR/IntrinsicsHexagonDep.td
Original file line number Diff line number Diff line change
Expand Up @@ -6832,3 +6832,17 @@ Hexagon_v32i32_v16i32v16i32_Intrinsic<"HEXAGON_V6_vsub_hf_f8">;

def int_hexagon_V6_vsub_hf_f8_128B :
Hexagon_v64i32_v32i32v32i32_Intrinsic<"HEXAGON_V6_vsub_hf_f8_128B">;

// V81 HVX Instructions.

def int_hexagon_V6_vsub_hf_mix :
Hexagon_v16i32_v16i32v16i32_Intrinsic<"HEXAGON_V6_vsub_hf_mix">;

def int_hexagon_V6_vsub_hf_mix_128B :
Hexagon_v32i32_v32i32v32i32_Intrinsic<"HEXAGON_V6_vsub_hf_mix_128B">;

def int_hexagon_V6_vsub_sf_mix :
Hexagon_v16i32_v16i32v16i32_Intrinsic<"HEXAGON_V6_vsub_sf_mix">;

def int_hexagon_V6_vsub_sf_mix_128B :
Hexagon_v32i32_v32i32v32i32_Intrinsic<"HEXAGON_V6_vsub_sf_mix_128B">;
13 changes: 13 additions & 0 deletions llvm/lib/Target/Hexagon/Hexagon.td
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ def ExtensionHVXV79: SubtargetFeature<"hvxv79", "HexagonHVXVersion",
ExtensionHVXV67, ExtensionHVXV68, ExtensionHVXV69, ExtensionHVXV71,
ExtensionHVXV73, ExtensionHVXV75]>;

def ExtensionHVXV81: SubtargetFeature<"hvxv81", "HexagonHVXVersion",
"Hexagon::ArchEnum::V81", "Hexagon HVX instructions",
[ExtensionHVXV65, ExtensionHVXV66, ExtensionHVXV67,
ExtensionHVXV68, ExtensionHVXV69, ExtensionHVXV71,
ExtensionHVXV73, ExtensionHVXV75, ExtensionHVXV79]>;

def ExtensionHVX64B: SubtargetFeature<"hvx-length64b", "UseHVX64BOps",
"true", "Hexagon HVX 64B instructions", [ExtensionHVX]>;
def ExtensionHVX128B: SubtargetFeature<"hvx-length128b", "UseHVX128BOps",
Expand Down Expand Up @@ -151,6 +157,8 @@ def UseHVXV75 : Predicate<"HST->useHVXV75Ops()">,
AssemblerPredicate<(all_of ExtensionHVXV75)>;
def UseHVXV79 : Predicate<"HST->useHVXV79Ops()">,
AssemblerPredicate<(all_of ExtensionHVXV79)>;
def UseHVXV81 : Predicate<"HST->useHVXV81Ops()">,
AssemblerPredicate<(all_of ExtensionHVXV81)>;
def UseAudio : Predicate<"HST->useAudioOps()">,
AssemblerPredicate<(all_of ExtensionAudio)>;
def UseZReg : Predicate<"HST->useZRegOps()">,
Expand Down Expand Up @@ -488,6 +496,11 @@ def : Proc<"hexagonv79", HexagonModelV79,
ArchV68, ArchV69, ArchV71, ArchV73, ArchV75, ArchV79,
FeatureCompound, FeatureDuplex, FeatureMemNoShuf, FeatureMemops,
FeatureNVJ, FeatureNVS, FeaturePackets, FeatureSmallData]>;
def : Proc<"hexagonv81", HexagonModelV81,
[ArchV65, ArchV66, ArchV67, ArchV68, ArchV69, ArchV71, ArchV73,
ArchV75, ArchV79, ArchV81,
FeatureCompound, FeatureDuplex, FeatureMemNoShuf, FeatureMemops,
FeatureNVJ, FeatureNVS, FeaturePackets, FeatureSmallData]>;

// Need to update the correct features for tiny core.
// Disable NewValueJumps since the packetizer is unable to handle a packet with
Expand Down
4 changes: 3 additions & 1 deletion llvm/lib/Target/Hexagon/HexagonDepArch.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ enum class ArchEnum {
V71,
V73,
V75,
V79
V79,
V81
};

inline std::optional<Hexagon::ArchEnum> getCpu(StringRef CPU) {
Expand All @@ -50,6 +51,7 @@ inline std::optional<Hexagon::ArchEnum> getCpu(StringRef CPU) {
.Case("hexagonv73", Hexagon::ArchEnum::V73)
.Case("hexagonv75", Hexagon::ArchEnum::V75)
.Case("hexagonv79", Hexagon::ArchEnum::V79)
.Case("hexagonv81", Hexagon::ArchEnum::V81)
.Default(std::nullopt);
}
} // namespace Hexagon
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/Hexagon/HexagonDepArch.td
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ def ArchV75: SubtargetFeature<"v75", "HexagonArchVersion", "Hexagon::ArchEnum::V
def HasV75 : Predicate<"HST->hasV75Ops()">, AssemblerPredicate<(all_of ArchV75)>;
def ArchV79: SubtargetFeature<"v79", "HexagonArchVersion", "Hexagon::ArchEnum::V79", "Enable Hexagon V79 architecture">;
def HasV79 : Predicate<"HST->hasV79Ops()">, AssemblerPredicate<(all_of ArchV79)>;
def ArchV81: SubtargetFeature<"v81", "HexagonArchVersion", "Hexagon::ArchEnum::V81", "Enable Hexagon V81 architecture">;
def HasV81 : Predicate<"HST->hasV81Ops()">, AssemblerPredicate<(all_of ArchV81)>;
Loading