[clang] 45293b5 - MIPS/Clang: handleTargetFeatures, add +fp64 if +msa and no other +-fp (#92728)
via cfe-commits
cfe-commits at lists.llvm.org
Tue May 21 05:14:51 PDT 2024
Author: YunQiang Su
Date: 2024-05-21T20:14:46+08:00
New Revision: 45293b5edb7f320bc1b14b6ce8ac90ed111baa53
URL: https://github.com/llvm/llvm-project/commit/45293b5edb7f320bc1b14b6ce8ac90ed111baa53
DIFF: https://github.com/llvm/llvm-project/commit/45293b5edb7f320bc1b14b6ce8ac90ed111baa53.diff
LOG: MIPS/Clang: handleTargetFeatures, add +fp64 if +msa and no other +-fp (#92728)
Commit: d59bc6b5c75384aa0b1e78cc85e17e8acaccebaf
Clang/MIPS: Add +fp64 if MSA and no explicit -mfp option (#91949)
added +fp64 for `clang`, while not for `clang -cc1`. So
clang -cc1 -triple=mips -target-feature +msa -S
will emit an asm source file without ".module fp=64".
Added:
Modified:
clang/lib/Basic/Targets/Mips.h
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/Mips.h b/clang/lib/Basic/Targets/Mips.h
index f76c6ece8bf48..b6f110249fa78 100644
--- a/clang/lib/Basic/Targets/Mips.h
+++ b/clang/lib/Basic/Targets/Mips.h
@@ -324,6 +324,7 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo {
FPMode = getDefaultFPMode();
bool OddSpregGiven = false;
bool StrictAlign = false;
+ bool FpGiven = false;
for (const auto &Feature : Features) {
if (Feature == "+single-float")
@@ -348,13 +349,16 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo {
HasMSA = true;
else if (Feature == "+nomadd4")
DisableMadd4 = true;
- else if (Feature == "+fp64")
+ else if (Feature == "+fp64") {
FPMode = FP64;
- else if (Feature == "-fp64")
+ FpGiven = true;
+ } else if (Feature == "-fp64") {
FPMode = FP32;
- else if (Feature == "+fpxx")
+ FpGiven = true;
+ } else if (Feature == "+fpxx") {
FPMode = FPXX;
- else if (Feature == "+nan2008")
+ FpGiven = true;
+ } else if (Feature == "+nan2008")
IsNan2008 = true;
else if (Feature == "-nan2008")
IsNan2008 = false;
@@ -381,6 +385,11 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo {
if (StrictAlign)
HasUnalignedAccess = false;
+ if (HasMSA && !FpGiven) {
+ FPMode = FP64;
+ Features.push_back("+fp64");
+ }
+
setDataLayout();
return true;
More information about the cfe-commits
mailing list