Revert "[PowerPC][NFC] Power ISA features for Semachecking"

This reverts commit 10e0cdfc65.
This commit is contained in:
Victor Huang 2021-07-13 12:59:41 -05:00
parent eba638dbbb
commit e4585d3f4e
8 changed files with 11 additions and 49 deletions

View File

@ -9757,8 +9757,8 @@ def err_mips_builtin_requires_dspr2 : Error<
"this builtin requires 'dsp r2' ASE, please use -mdspr2">;
def err_mips_builtin_requires_msa : Error<
"this builtin requires 'msa' ASE, please use -mmsa">;
def err_ppc_builtin_only_on_arch : Error<
"this builtin is only valid on POWER%0 or later CPUs">;
def err_ppc_builtin_only_on_pwr7 : Error<
"this builtin is only valid on POWER7 or later CPUs">;
def err_ppc_invalid_use_mma_type : Error<
"invalid use of PPC MMA type">;
def err_x86_builtin_invalid_rounding : Error<

View File

@ -73,12 +73,6 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
HasROPProtect = true;
} else if (Feature == "+privileged") {
HasPrivileged = true;
} else if (Feature == "+isa-v207-instructions") {
IsISA2_07 = true;
} else if (Feature == "+isa-v30-instructions") {
IsISA3_0 = true;
} else if (Feature == "+isa-v31-instructions") {
IsISA3_1 = true;
}
// TODO: Finish this list and add an assert that we've handled them
// all.
@ -396,15 +390,6 @@ bool PPCTargetInfo::initFeatureMap(
.Case("e500", true)
.Default(false);
Features["isa-v207-instructions"] = llvm::StringSwitch<bool>(CPU)
.Case("ppc64le", true)
.Case("pwr9", true)
.Case("pwr8", true)
.Default(false);
Features["isa-v30-instructions"] =
llvm::StringSwitch<bool>(CPU).Case("pwr9", true).Default(false);
// Power10 includes all the same features as Power9 plus any features specific
// to the Power10 core.
if (CPU == "pwr10" || CPU == "power10") {
@ -461,7 +446,6 @@ void PPCTargetInfo::addP10SpecificFeatures(
Features["power10-vector"] = true;
Features["pcrelative-memops"] = true;
Features["prefix-instrs"] = true;
Features["isa-v31-instructions"] = true;
return;
}
@ -492,9 +476,6 @@ bool PPCTargetInfo::hasFeature(StringRef Feature) const {
.Case("mma", HasMMA)
.Case("rop-protect", HasROPProtect)
.Case("privileged", HasPrivileged)
.Case("isa-v207-instructions", IsISA2_07)
.Case("isa-v30-instructions", IsISA3_0)
.Case("isa-v31-instructions", IsISA3_1)
.Default(false);
}

View File

@ -74,9 +74,6 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo {
bool HasP10Vector = false;
bool HasPCRelativeMemops = false;
bool HasPrefixInstrs = false;
bool IsISA2_07 = false;
bool IsISA3_0 = false;
bool IsISA3_1 = false;
protected:
std::string ABI;

View File

@ -3275,18 +3275,10 @@ static bool isPPC_64Builtin(unsigned BuiltinID) {
}
static bool SemaFeatureCheck(Sema &S, CallExpr *TheCall,
StringRef FeatureToCheck, unsigned DiagID,
StringRef DiagArg = "") {
if (S.Context.getTargetInfo().hasFeature(FeatureToCheck))
return false;
if (DiagArg.empty())
S.Diag(TheCall->getBeginLoc(), DiagID) << TheCall->getSourceRange();
else
S.Diag(TheCall->getBeginLoc(), DiagID)
<< DiagArg << TheCall->getSourceRange();
return true;
StringRef FeatureToCheck, unsigned DiagID) {
if (!S.Context.getTargetInfo().hasFeature(FeatureToCheck))
return S.Diag(TheCall->getBeginLoc(), DiagID) << TheCall->getSourceRange();
return false;
}
bool Sema::CheckPPCBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
@ -3328,17 +3320,17 @@ bool Sema::CheckPPCBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
case PPC::BI__builtin_divde:
case PPC::BI__builtin_divdeu:
return SemaFeatureCheck(*this, TheCall, "extdiv",
diag::err_ppc_builtin_only_on_arch, "7");
diag::err_ppc_builtin_only_on_pwr7);
case PPC::BI__builtin_bpermd:
return SemaFeatureCheck(*this, TheCall, "bpermd",
diag::err_ppc_builtin_only_on_arch, "7");
diag::err_ppc_builtin_only_on_pwr7);
case PPC::BI__builtin_unpack_vector_int128:
return SemaFeatureCheck(*this, TheCall, "vsx",
diag::err_ppc_builtin_only_on_arch, "7") ||
diag::err_ppc_builtin_only_on_pwr7) ||
SemaBuiltinConstantArgRange(TheCall, 1, 0, 1);
case PPC::BI__builtin_pack_vector_int128:
return SemaFeatureCheck(*this, TheCall, "vsx",
diag::err_ppc_builtin_only_on_arch, "7");
diag::err_ppc_builtin_only_on_pwr7);
case PPC::BI__builtin_altivec_vgnb:
return SemaBuiltinConstantArgRange(TheCall, 1, 2, 7);
case PPC::BI__builtin_altivec_vec_replace_elt:

View File

@ -210,13 +210,9 @@ def FeatureSlowPOPCNTD : SubtargetFeature<"slow-popcntd","HasPOPCNTD",
def DeprecatedDST : SubtargetFeature<"", "DeprecatedDST", "true",
"Treat vector data stream cache control instructions as deprecated">;
def FeatureISA2_07 : SubtargetFeature<"isa-v207-instructions", "IsISA2_07",
"true",
"Enable instructions in ISA 2.07.">;
def FeatureISA3_0 : SubtargetFeature<"isa-v30-instructions", "IsISA3_0",
"true",
"Enable instructions in ISA 3.0.",
[FeatureISA2_07]>;
"Enable instructions in ISA 3.0.">;
def FeatureISA3_1 : SubtargetFeature<"isa-v31-instructions", "IsISA3_1",
"true",
"Enable instructions in ISA 3.1.",

View File

@ -1176,7 +1176,6 @@ def NaNsFPMath
: Predicate<"!Subtarget->getTargetMachine().Options.NoNaNsFPMath">;
def HasBPERMD : Predicate<"Subtarget->hasBPERMD()">;
def HasExtDiv : Predicate<"Subtarget->hasExtDiv()">;
def IsISA2_07 : Predicate<"Subtarget->isISA2_07()">;
def IsISA3_0 : Predicate<"Subtarget->isISA3_0()">;
def HasFPU : Predicate<"Subtarget->hasFPU()">;
def PCRelativeMemops : Predicate<"Subtarget->hasPCRelativeMemops()">;

View File

@ -126,7 +126,6 @@ void PPCSubtarget::initializeEnvironment() {
HasStoreFusion = false;
HasAddiLoadFusion = false;
HasAddisLoadFusion = false;
IsISA2_07 = false;
IsISA3_0 = false;
IsISA3_1 = false;
UseLongCalls = false;

View File

@ -146,7 +146,6 @@ protected:
bool HasStoreFusion;
bool HasAddiLoadFusion;
bool HasAddisLoadFusion;
bool IsISA2_07;
bool IsISA3_0;
bool IsISA3_1;
bool UseLongCalls;
@ -320,7 +319,6 @@ public:
bool hasHTM() const { return HasHTM; }
bool hasFloat128() const { return HasFloat128; }
bool isISA2_07() const { return IsISA2_07; }
bool isISA3_0() const { return IsISA3_0; }
bool isISA3_1() const { return IsISA3_1; }
bool useLongCalls() const { return UseLongCalls; }