mips-fpxx-enable
authorLLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>
Wed, 30 Nov 2022 14:31:52 +0000 (14:31 +0000)
committerGianfranco Costamagna <locutusofborg@debian.org>
Wed, 30 Nov 2022 14:31:52 +0000 (14:31 +0000)
===================================================================

Gbp-Pq: Topic mips
Gbp-Pq: Name mips-fpxx-enable.diff

clang/lib/Driver/ToolChains/Arch/Mips.cpp
llvm/lib/Target/Mips/MipsSubtarget.cpp

index c374d745da384daa11e8592c625ee058d881d54f..7e52eb96dabb4286ee4b21cc8f15f92a06e40e18 100644 (file)
@@ -467,10 +467,10 @@ bool mips::isFP64ADefault(const llvm::Triple &Triple, StringRef CPUName) {
 
 bool mips::isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName,
                          StringRef ABIName, mips::FloatABI FloatABI) {
-  if (Triple.getVendor() != llvm::Triple::ImaginationTechnologies &&
+/*  if (Triple.getVendor() != llvm::Triple::ImaginationTechnologies &&
       Triple.getVendor() != llvm::Triple::MipsTechnologies &&
       !Triple.isAndroid())
-    return false;
+    return false;*/
 
   if (ABIName != "32")
     return false;
index 10530cdafeed4565f6b17f45faa22d7be544bd38..0341c9aad3664aeaf648b19e0d3a352f9bbfb49a 100644 (file)
@@ -81,7 +81,7 @@ MipsSubtarget::MipsSubtarget(const Triple &TT, StringRef CPU, StringRef FS,
       InMips16HardFloat(Mips16HardFloat), InMicroMipsMode(false), HasDSP(false),
       HasDSPR2(false), HasDSPR3(false), AllowMixed16_32(Mixed16_32 || Mips_Os16),
       Os16(Mips_Os16), HasMSA(false), UseTCCInDIV(false), HasSym32(false),
-      HasEVA(false), DisableMadd4(false), HasMT(false), HasCRC(false),
+      HasEVA(false), DisableMadd4(true), HasMT(false), HasCRC(false),
       HasVirt(false), HasGINV(false), UseIndirectJumpsHazard(false),
       StackAlignOverride(StackAlignOverride), TM(TM), TargetTriple(TT),
       TSInfo(), InstrInfo(MipsInstrInfo::create(
@@ -92,6 +92,9 @@ MipsSubtarget::MipsSubtarget(const Triple &TT, StringRef CPU, StringRef FS,
   if (MipsArchVersion == MipsDefault)
     MipsArchVersion = Mips32;
 
+  if (hasMips32r6() || hasMips64r6())
+    DisableMadd4 = false;
+
   // MIPS-I has not been tested.
   if (MipsArchVersion == Mips1 && !MIPS1WarningPrinted) {
     errs() << "warning: MIPS-I support is experimental\n";
@@ -243,6 +246,7 @@ MipsSubtarget &
 MipsSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS,
                                                const TargetMachine &TM) {
   StringRef CPUName = MIPS_MC::selectMipsCPU(TM.getTargetTriple(), CPU);
+  SubtargetFeatures Features(FS);
 
   // Parse features string.
   ParseSubtargetFeatures(CPUName, /*TuneCPU*/ CPUName, FS);
@@ -265,6 +269,13 @@ MipsSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS,
     report_fatal_error("64-bit code requested on a subtarget that doesn't "
                        "support it!");
 
+  for (const std::string &Feature : Features.getFeatures()) {
+    if (Feature == "+nomadd4")
+      DisableMadd4 = true;
+    else if (Feature == "-nomadd4")
+      DisableMadd4 = false;
+  }
+
   return *this;
 }