MIPS: Define __mips_dsp_rev / __mips_dspr2 / __mips_dsp macros
if -mdsp or -mdspr2 options are provided. llvm-svn: 159774
This commit is contained in:
parent
8de7955f35
commit
9780e4a2bb
|
@ -3603,6 +3603,9 @@ class MipsTargetInfoBase : public TargetInfo {
|
||||||
enum MipsFloatABI {
|
enum MipsFloatABI {
|
||||||
HardFloat, SingleFloat, SoftFloat
|
HardFloat, SingleFloat, SoftFloat
|
||||||
} FloatABI;
|
} FloatABI;
|
||||||
|
enum DspRevEnum {
|
||||||
|
NoDSP, DSP1, DSP2
|
||||||
|
} DspRev;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string ABI;
|
std::string ABI;
|
||||||
|
@ -3615,6 +3618,7 @@ public:
|
||||||
CPU(CPUStr),
|
CPU(CPUStr),
|
||||||
IsMips16(false),
|
IsMips16(false),
|
||||||
FloatABI(HardFloat),
|
FloatABI(HardFloat),
|
||||||
|
DspRev(NoDSP),
|
||||||
ABI(ABIStr)
|
ABI(ABIStr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -3648,6 +3652,20 @@ public:
|
||||||
if (IsMips16)
|
if (IsMips16)
|
||||||
Builder.defineMacro("__mips16", Twine(1));
|
Builder.defineMacro("__mips16", Twine(1));
|
||||||
|
|
||||||
|
switch (DspRev) {
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
case DSP1:
|
||||||
|
Builder.defineMacro("__mips_dsp_rev", Twine(1));
|
||||||
|
Builder.defineMacro("__mips_dsp", Twine(1));
|
||||||
|
break;
|
||||||
|
case DSP2:
|
||||||
|
Builder.defineMacro("__mips_dsp_rev", Twine(2));
|
||||||
|
Builder.defineMacro("__mips_dspr2", Twine(1));
|
||||||
|
Builder.defineMacro("__mips_dsp", Twine(1));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
Builder.defineMacro("_MIPS_SZPTR", Twine(getPointerWidth(0)));
|
Builder.defineMacro("_MIPS_SZPTR", Twine(getPointerWidth(0)));
|
||||||
Builder.defineMacro("_MIPS_SZINT", Twine(getIntWidth()));
|
Builder.defineMacro("_MIPS_SZINT", Twine(getIntWidth()));
|
||||||
Builder.defineMacro("_MIPS_SZLONG", Twine(getLongWidth()));
|
Builder.defineMacro("_MIPS_SZLONG", Twine(getLongWidth()));
|
||||||
|
@ -3729,6 +3747,7 @@ public:
|
||||||
virtual void HandleTargetFeatures(std::vector<std::string> &Features) {
|
virtual void HandleTargetFeatures(std::vector<std::string> &Features) {
|
||||||
IsMips16 = false;
|
IsMips16 = false;
|
||||||
FloatABI = HardFloat;
|
FloatABI = HardFloat;
|
||||||
|
DspRev = NoDSP;
|
||||||
|
|
||||||
for (std::vector<std::string>::iterator it = Features.begin(),
|
for (std::vector<std::string>::iterator it = Features.begin(),
|
||||||
ie = Features.end(); it != ie; ++it) {
|
ie = Features.end(); it != ie; ++it) {
|
||||||
|
@ -3738,6 +3757,10 @@ public:
|
||||||
FloatABI = SoftFloat;
|
FloatABI = SoftFloat;
|
||||||
else if (*it == "+mips16")
|
else if (*it == "+mips16")
|
||||||
IsMips16 = true;
|
IsMips16 = true;
|
||||||
|
else if (*it == "+dsp")
|
||||||
|
DspRev = std::max(DspRev, DSP1);
|
||||||
|
else if (*it == "+dspr2")
|
||||||
|
DspRev = std::max(DspRev, DSP2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove front-end specific option.
|
// Remove front-end specific option.
|
||||||
|
|
|
@ -888,6 +888,20 @@
|
||||||
// RUN: | FileCheck -check-prefix NOMIPS16 %s
|
// RUN: | FileCheck -check-prefix NOMIPS16 %s
|
||||||
// NOMIPS16-NOT:#define __mips16 1
|
// NOMIPS16-NOT:#define __mips16 1
|
||||||
//
|
//
|
||||||
|
// RUN: %clang_cc1 -target-feature +dsp \
|
||||||
|
// RUN: -E -dM -triple=mips-none-none < /dev/null \
|
||||||
|
// RUN: | FileCheck -check-prefix MIPS-DSP %s
|
||||||
|
// MIPS-DSP:#define __mips_dsp 1
|
||||||
|
// MIPS-DSP:#define __mips_dsp_rev 1
|
||||||
|
// MIPS-DSP-NOT:#define __mips_dspr2 1
|
||||||
|
//
|
||||||
|
// RUN: %clang_cc1 -target-feature +dspr2 \
|
||||||
|
// RUN: -E -dM -triple=mips-none-none < /dev/null \
|
||||||
|
// RUN: | FileCheck -check-prefix MIPS-DSPR2 %s
|
||||||
|
// MIPS-DSPR2:#define __mips_dsp 1
|
||||||
|
// MIPS-DSPR2:#define __mips_dsp_rev 2
|
||||||
|
// MIPS-DSPR2:#define __mips_dspr2 1
|
||||||
|
//
|
||||||
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -check-prefix MSP430 %s
|
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -check-prefix MSP430 %s
|
||||||
//
|
//
|
||||||
// MSP430:#define MSP430 1
|
// MSP430:#define MSP430 1
|
||||||
|
|
Loading…
Reference in New Issue