Skip to content

Commit

Permalink
MIPS/Clang: Add more false option pairs into validateTarget (#91968)
Browse files Browse the repository at this point in the history
The option pairs include:
	-mfpxx -mips1
	-msoft-float -mmsa
	-mmsa -mabi=32 with 32bit pre-R2 CPUs
	-mfpxx -mmsa
	-mfp32 -mmsa
  • Loading branch information
wzssyqa authored May 22, 2024
1 parent 1d4772f commit 9276a03
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions clang/lib/Basic/Targets/Mips.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,34 @@ bool MipsTargetInfo::validateTarget(DiagnosticsEngine &Diags) const {
Diags.Report(diag::err_mips_fp64_req) << "-mfp64";
return false;
}
// FPXX requires mips2+
if (FPMode == FPXX && CPU == "mips1") {
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mfpxx" << CPU;
return false;
}
// -mmsa with -msoft-float makes nonsense
if (FloatABI == SoftFloat && HasMSA) {
Diags.Report(diag::err_opt_not_valid_with_opt) << "-msoft-float"
<< "-mmsa";
return false;
}
// Option -mmsa permitted on Mips32 iff revision 2 or higher is present
if (HasMSA && (CPU == "mips1" || CPU == "mips2" || getISARev() < 2) &&
ABI == "o32") {
Diags.Report(diag::err_mips_fp64_req) << "-mmsa";
return false;
}
// MSA requires FP64
if (FPMode == FPXX && HasMSA) {
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mfpxx"
<< "-mmsa";
return false;
}
if (FPMode == FP32 && HasMSA) {
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mfp32"
<< "-mmsa";
return false;
}

return true;
}

0 comments on commit 9276a03

Please sign in to comment.