forked from OSchip/llvm-project
[Hexagon] Driver/preprocessor options for Hexagon v69
This commit is contained in:
parent
5410152827
commit
1d1b5efdef
|
@ -449,6 +449,11 @@ def warn_drv_vectorize_needs_hvx : Warning<
|
|||
"auto-vectorization requires HVX, use -mhvx to enable it">,
|
||||
InGroup<OptionIgnored>;
|
||||
|
||||
def err_drv_invalid_hvx_qfloat : Error<
|
||||
"-mhvx-qfloat is not supported without a -mhvx/-mhvx= flag.">;
|
||||
def err_drv_invalid_arch_hvx_qfloat : Error<
|
||||
"-mhvx-qfloat is not supported on HVX %0.">;
|
||||
|
||||
def err_drv_module_header_wrong_kind : Error<
|
||||
"header file '%0' input type '%1' does not match type of prior input "
|
||||
"in module compilation; use '-x %2' to override">;
|
||||
|
|
|
@ -4160,6 +4160,8 @@ def mv67t : Flag<["-"], "mv67t">, Group<m_hexagon_Features_Group>,
|
|||
Alias<mcpu_EQ>, AliasArgs<["hexagonv67t"]>;
|
||||
def mv68 : Flag<["-"], "mv68">, Group<m_hexagon_Features_Group>,
|
||||
Alias<mcpu_EQ>, AliasArgs<["hexagonv68"]>;
|
||||
def mv69 : Flag<["-"], "mv69">, Group<m_hexagon_Features_Group>,
|
||||
Alias<mcpu_EQ>, AliasArgs<["hexagonv69"]>;
|
||||
def mhexagon_hvx : Flag<["-"], "mhvx">, Group<m_hexagon_Features_HVX_Group>,
|
||||
HelpText<"Enable Hexagon Vector eXtensions">;
|
||||
def mhexagon_hvx_EQ : Joined<["-"], "mhvx=">,
|
||||
|
@ -4171,6 +4173,18 @@ def mno_hexagon_hvx : Flag<["-"], "mno-hvx">,
|
|||
def mhexagon_hvx_length_EQ : Joined<["-"], "mhvx-length=">,
|
||||
Group<m_hexagon_Features_HVX_Group>, HelpText<"Set Hexagon Vector Length">,
|
||||
Values<"64B,128B">;
|
||||
def mhexagon_hvx_qfloat : Flag<["-"], "mhvx-qfloat">,
|
||||
Group<m_hexagon_Features_HVX_Group>,
|
||||
HelpText<"Enable Hexagon HVX QFloat instructions">;
|
||||
def mno_hexagon_hvx_qfloat : Flag<["-"], "mno-hvx-qfloat">,
|
||||
Group<m_hexagon_Features_HVX_Group>,
|
||||
HelpText<"Disable Hexagon HVX QFloat instructions">;
|
||||
def mhexagon_hvx_ieee_fp : Flag<["-"], "mhvx-ieee-fp">,
|
||||
Group<m_hexagon_Features_Group>,
|
||||
HelpText<"Enable Hexagon HVX IEEE floating-point">;
|
||||
def mno_hexagon_hvx_ieee_fp : Flag<["-"], "mno-hvx-ieee-fp">,
|
||||
Group<m_hexagon_Features_Group>,
|
||||
HelpText<"Disable Hexagon HVX IEEE floating-point">;
|
||||
def ffixed_r19: Flag<["-"], "ffixed-r19">,
|
||||
HelpText<"Reserve register r19 (Hexagon only)">;
|
||||
def mmemops : Flag<["-"], "mmemops">, Group<m_hexagon_Features_Group>,
|
||||
|
|
|
@ -68,6 +68,9 @@ void HexagonTargetInfo::getTargetDefines(const LangOptions &Opts,
|
|||
} else if (CPU == "hexagonv68") {
|
||||
Builder.defineMacro("__HEXAGON_V68__");
|
||||
Builder.defineMacro("__HEXAGON_ARCH__", "68");
|
||||
} else if (CPU == "hexagonv69") {
|
||||
Builder.defineMacro("__HEXAGON_V69__");
|
||||
Builder.defineMacro("__HEXAGON_ARCH__", "69");
|
||||
}
|
||||
|
||||
if (hasFeature("hvx-length64b")) {
|
||||
|
@ -128,6 +131,10 @@ bool HexagonTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
|
|||
else if (F == "+audio")
|
||||
HasAudio = true;
|
||||
}
|
||||
if (CPU.compare("hexagonv68") >= 0) {
|
||||
HasLegalHalfType = true;
|
||||
HasFloat16 = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -214,7 +221,7 @@ static constexpr CPUSuffix Suffixes[] = {
|
|||
{{"hexagonv60"}, {"60"}}, {{"hexagonv62"}, {"62"}},
|
||||
{{"hexagonv65"}, {"65"}}, {{"hexagonv66"}, {"66"}},
|
||||
{{"hexagonv67"}, {"67"}}, {{"hexagonv67t"}, {"67t"}},
|
||||
{{"hexagonv68"}, {"68"}},
|
||||
{{"hexagonv68"}, {"68"}}, {{"hexagonv69"}, {"69"}},
|
||||
};
|
||||
|
||||
const char *HexagonTargetInfo::getHexagonCPUSuffix(StringRef Name) {
|
||||
|
|
|
@ -88,6 +88,27 @@ static void handleHVXTargetFeatures(const Driver &D, const ArgList &Args,
|
|||
Args.MakeArgString(llvm::Twine("+hvx-length") + HVXLength.lower());
|
||||
Features.push_back(HVXFeature);
|
||||
}
|
||||
|
||||
// Handle -mhvx-qfloat.
|
||||
// QFloat is valid only on HVX v68/v68+ as of now.
|
||||
unsigned short CpuVer;
|
||||
Cpu.drop_front(1).getAsInteger(10, CpuVer);
|
||||
if (Arg *A = Args.getLastArg(options::OPT_mhexagon_hvx_qfloat,
|
||||
options::OPT_mno_hexagon_hvx_qfloat)) {
|
||||
if (A->getOption().matches(options::OPT_mno_hexagon_hvx_qfloat)) {
|
||||
StringRef OptName = A->getOption().getName().substr(4);
|
||||
Features.push_back(Args.MakeArgString("-" + OptName));
|
||||
return;
|
||||
}
|
||||
StringRef OptName = A->getOption().getName().substr(1);
|
||||
if (HasHVX) {
|
||||
if (CpuVer >= 68)
|
||||
Features.push_back(Args.MakeArgString("+" + OptName));
|
||||
else
|
||||
D.Diag(diag::err_drv_invalid_arch_hvx_qfloat) << Cpu;
|
||||
} else
|
||||
D.Diag(diag::err_drv_invalid_hvx_qfloat);
|
||||
}
|
||||
}
|
||||
|
||||
// Hexagon target features.
|
||||
|
@ -156,6 +177,12 @@ void hexagon::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back("-fsyntax-only");
|
||||
}
|
||||
|
||||
if (Arg *A = Args.getLastArg(options::OPT_mhexagon_hvx_ieee_fp,
|
||||
options::OPT_mno_hexagon_hvx_ieee_fp)) {
|
||||
if (A->getOption().matches(options::OPT_mhexagon_hvx_ieee_fp))
|
||||
CmdArgs.push_back("-mhvx-ieee-fp");
|
||||
}
|
||||
|
||||
if (auto G = toolchains::HexagonToolChain::getSmallDataThreshold(Args)) {
|
||||
CmdArgs.push_back(Args.MakeArgString("-gpsize=" + Twine(G.getValue())));
|
||||
}
|
||||
|
|
|
@ -1177,37 +1177,6 @@ private:
|
|||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
// V65 Silver types
|
||||
#if __Q6S_ARCH__ >= 65
|
||||
// Silver vector types are 128 bytes, and pairs are 256. The vector predicate
|
||||
// types are 16 bytes and 32 bytes for pairs.
|
||||
typedef long HEXAGON_VecPred128 __attribute__((__vector_size__(16)))
|
||||
__attribute__((aligned(128)));
|
||||
|
||||
typedef long HEXAGON_VecPred256 __attribute__((__vector_size__(32)))
|
||||
__attribute__((aligned(128)));
|
||||
|
||||
typedef long HEXAGON_Vect1024 __attribute__((__vector_size__(128)))
|
||||
__attribute__((aligned(128)));
|
||||
|
||||
typedef long HEXAGON_Vect2048 __attribute__((__vector_size__(256)))
|
||||
__attribute__((aligned(256)));
|
||||
|
||||
typedef long HEXAGON_UVect1024 __attribute__((__vector_size__(128)))
|
||||
__attribute__((aligned(4)));
|
||||
|
||||
typedef long HEXAGON_UVect2048 __attribute__((__vector_size__(256)))
|
||||
__attribute__((aligned(4)));
|
||||
|
||||
#define Q6S_VectorPredPair HEXAGON_VecPred256
|
||||
#define Q6S_VectorPred HEXAGON_VecPred128
|
||||
#define Q6S_Vector HEXAGON_Vect1024
|
||||
#define Q6S_VectorPair HEXAGON_Vect2048
|
||||
#define Q6S_UVector HEXAGON_UVect1024
|
||||
#define Q6S_UVectorPair HEXAGON_UVect2048
|
||||
|
||||
#else /* __Q6S_ARCH__ >= 65 */
|
||||
|
||||
// V65 Vector types
|
||||
#if __HVX_ARCH__ >= 65
|
||||
#if defined __HVX__ && (__HVX_LENGTH__ == 128)
|
||||
|
@ -1256,7 +1225,6 @@ private:
|
|||
#endif /* defined __HVX__ && (__HVX_LENGTH__ == 64) */
|
||||
#endif /* defined __HVX__ && (__HVX_LENGTH__ == 128) */
|
||||
#endif /* __HVX_ARCH__ >= 65 */
|
||||
#endif /* __Q6S_ARCH__ >= 65 */
|
||||
|
||||
/* Predicates */
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
// Tests for the hvx ieee fp feature and errors.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv68 -mhvx -mhvx-ieee-fp \
|
||||
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-IEEEFP %s
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv66 -mhvx=v68 -mhvx-ieee-fp \
|
||||
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-IEEEFP %s
|
||||
// CHECK-IEEEFP: "-target-feature" "+hvx-ieee-fp"
|
||||
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv68 -mhvx -mhvx-ieee-fp \
|
||||
// RUN: -mno-hvx-ieee-fp 2>&1 | FileCheck -check-prefix=CHECK-NO-IEEEFP %s
|
||||
// CHECK-NO-IEEEFP: "-target-feature" "-hvx-ieee-fp"
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
// Tests for the hvx qfloat feature and errors.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv68 -mhvx -mhvx-qfloat \
|
||||
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-QFLOAT %s
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv66 -mhvx=v68 -mhvx-qfloat \
|
||||
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-QFLOAT %s
|
||||
// CHECK-QFLOAT: "-target-feature" "+hvx-qfloat"
|
||||
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv68 -mhvx -mhvx-qfloat \
|
||||
// RUN: -mno-hvx-qfloat 2>&1 | FileCheck -check-prefix=CHECK-NO-QFLOAT %s
|
||||
// CHECK-NO-QFLOAT: "-target-feature" "-hvx-qfloat"
|
||||
|
||||
// QFloat is valid only on hvxv68 and hvxv68+.
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv68 -mhvx=v66 \
|
||||
// RUN: -mhvx-qfloat 2>&1 | FileCheck -check-prefix=CHECK-ERROR1 %s
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv66 -mhvx -mhvx-qfloat \
|
||||
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-ERROR1 %s
|
||||
// CHECK-ERROR1: error: -mhvx-qfloat is not supported on HVX v66.
|
||||
|
||||
// QFloat is valid only if HVX is enabled.
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv68 -mhvx-qfloat \
|
||||
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-ERROR2 %s
|
||||
// CHECK-ERROR2: error: -mhvx-qfloat is not supported without a -mhvx/-mhvx= flag.
|
|
@ -2,10 +2,6 @@
|
|||
// 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"
|
||||
|
@ -14,6 +10,10 @@
|
|||
// RUN: 2>&1 | FileCheck -check-prefix=CHECKHVX162 %s
|
||||
// CHECKHVX162: "-target-feature" "+hvxv62"
|
||||
|
||||
// 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: -mhvx-length=128B 2>&1 | FileCheck -check-prefix=CHECKHVX2 %s
|
||||
|
||||
|
@ -39,6 +39,17 @@
|
|||
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-NOHVX %s
|
||||
// CHECK-NOHVX-NOT: "-target-feature" "+hvx
|
||||
|
||||
// No hvx-ieee-fp target feature must be added if -mno-hvx-ieee-fp occurs last
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv69 -mhvx-ieee-fp -mno-hvx \
|
||||
// RUN: -mno-hvx-ieee-fp 2>&1 | FileCheck -check-prefix=CHECK-NOHVX-IEEE-FP %s
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv69 -mhvx-ieee-fp -mhvx \
|
||||
// RUN: -mno-hvx-ieee-fp 2>&1 | FileCheck -check-prefix=CHECK-HVX-NOHVX-IEEE-FP %s
|
||||
//
|
||||
// CHECK-NOHVX-IEEE-FP-NOT: "-target-feature" "+hvx-ieee-fp"
|
||||
// CHECK-HVX-NOHVX-IEEE-FP-NOT: "-target-feature" "+hvx-ieee-fp"
|
||||
// CHECK-HVX-NOHVX-IEEE-FP: "-target-feature" "+hvx
|
||||
// CHECK-HVX-NOHVX-IEEE-FP-NOT: "-target-feature" "+hvx-ieee-fp"
|
||||
|
||||
// Hvx target feature should be added if -mno-hvx doesn't occur last
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv62 -mno-hvx -mhvx\
|
||||
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVXFEAT %s
|
||||
|
@ -93,3 +104,15 @@
|
|||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mhvx -mhvx-length=128 \
|
||||
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-VALUE-ERROR %s
|
||||
// CHECK-HVXLENGTH-VALUE-ERROR: error: unsupported argument '{{.*}}' to option 'mhvx-length='
|
||||
|
||||
// Test -mhvx-ieee-fp flag
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv69 -mhvx-ieee-fp \
|
||||
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVXIEEEFP-LONE %s
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv69 -mhvx -mhvx-ieee-fp \
|
||||
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVXIEEEFP %s
|
||||
// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv69 -mno-hvx -mhvx-ieee-fp \
|
||||
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVXIEEEFP %s
|
||||
// CHECK-HVXIEEEFP-LONE-NOT: "-target-feature" "+hvx"
|
||||
// CHECK-HVXIEEEFP-LONE: "-target-feature" "+hvx-ieee-fp"
|
||||
// CHECK-HVXIEEEFP: "-target-feature" "+hvx-ieee-fp"
|
||||
// CHECK-HVXIEEEFP-LONE-NOT: "-target-feature" "+hvx"
|
||||
|
|
|
@ -151,6 +151,22 @@
|
|||
// CHECK02B: "-cc1" {{.*}} "-target-cpu" "hexagonv67t"
|
||||
// CHECK02B: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v67t/crt0
|
||||
|
||||
// RUN: %clang -### -target hexagon-unknown-elf \
|
||||
// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
|
||||
// RUN: -mcpu=hexagonv68 -fuse-ld=hexagon-link\
|
||||
// RUN: %s 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=CHECK02C %s
|
||||
// CHECK02C: "-cc1" {{.*}} "-target-cpu" "hexagonv68"
|
||||
// CHECK02C: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v68/crt0
|
||||
|
||||
// RUN: %clang -### -target hexagon-unknown-elf \
|
||||
// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
|
||||
// RUN: -mcpu=hexagonv69 -fuse-ld=hexagon-link\
|
||||
// RUN: %s 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=CHECK02D %s
|
||||
// CHECK02D: "-cc1" {{.*}} "-target-cpu" "hexagonv69"
|
||||
// CHECK02D: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v69/crt0
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Test Linker related args
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
|
||||
// RUN: not %clang_cc1 -triple hexagon--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix HEXAGON
|
||||
// HEXAGON: error: unknown target CPU 'not-a-cpu'
|
||||
// HEXAGON-NEXT: note: valid target CPU values are: hexagonv5, hexagonv55, hexagonv60, hexagonv62, hexagonv65, hexagonv66, hexagonv67, hexagonv67t, hexagonv68{{$}}
|
||||
// HEXAGON-NEXT: note: valid target CPU values are: hexagonv5, hexagonv55, hexagonv60, hexagonv62, hexagonv65, hexagonv66, hexagonv67, hexagonv67t, hexagonv68, hexagonv69{{$}}
|
||||
|
||||
// RUN: not %clang_cc1 -triple bpf--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix BPF
|
||||
// BPF: error: unknown target CPU 'not-a-cpu'
|
||||
|
|
|
@ -107,6 +107,17 @@
|
|||
// CHECK-V68HVX-128B: #define __HVX__ 1
|
||||
// CHECK-V68HVX-128B: #define __hexagon__ 1
|
||||
|
||||
// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv69 \
|
||||
// RUN: -target-feature +hvxv69 -target-feature +hvx-length128b %s | FileCheck \
|
||||
// RUN: %s -check-prefix CHECK-V69HVX-128B
|
||||
// CHECK-V69HVX-128B: #define __HEXAGON_ARCH__ 69
|
||||
// CHECK-V69HVX-128B: #define __HEXAGON_V69__ 1
|
||||
// CHECK-V69HVX-128B: #define __HVX_ARCH__ 69
|
||||
// CHECK-V69HVX-128B: #define __HVX_LENGTH__ 128
|
||||
// CHECK-V69HVX-128B: #define __HVX__ 1
|
||||
// CHECK-V69HVX-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
|
||||
|
|
Loading…
Reference in New Issue