Add patch to force nomadd4 on mips, update changelog

This commit is contained in:
Gianfranco Costamagna 2020-07-20 19:20:57 +02:00
parent ba68c9d75b
commit f227b7f7cc
3 changed files with 99 additions and 0 deletions

6
debian/changelog vendored
View File

@ -1,8 +1,14 @@
llvm-toolchain-10 (1:10.0.1~+rc4-2) UNRELEASED; urgency=medium
[ Samuel Thibault ]
* patches/hurd/hurd-cxx-paths.diff: Refresh, some of the factorization was
backported from 11 to 10.
[ Gianfranco Costamagna ]
* debian/patches/mips-force-nomadd4.patch: Apply and rebase patch to disable
nomadd4 on mips* (Closes: #964989)
- thanks Yunqiang Su <wzssyqa@gmail.com> for the patch
-- Samuel Thibault <sthibault@debian.org> Tue, 07 Jul 2020 18:39:08 +0200
llvm-toolchain-10 (1:10.0.1~+rc4-1) unstable; urgency=medium

92
debian/patches/mips-force-nomadd4.patch vendored Normal file
View File

@ -0,0 +1,92 @@
The MIPS port aims to support the Loongson 3 family of CPUs in addition
of the other MIPS CPUs. On the Loongson 3 family the MADD4 instructions
are fused, while they are not fused on the other MIPS CPUs. In order to
support both, we have to disabled those instructions.
For that, the patch below basically corresponds to the --with-madd4=no
used on the GCC side.
Index: llvm-toolchain-10-10.0.1~+rc4/clang/lib/Basic/Targets/Mips.h
===================================================================
--- llvm-toolchain-10-10.0.1~+rc4.orig/clang/lib/Basic/Targets/Mips.h
+++ llvm-toolchain-10-10.0.1~+rc4/clang/lib/Basic/Targets/Mips.h
@@ -332,6 +332,8 @@
HasMSA = true;
else if (Feature == "+nomadd4")
DisableMadd4 = true;
+ else if (Feature == "-nomadd4")
+ DisableMadd4 = false;
else if (Feature == "+fp64")
FPMode = FP64;
else if (Feature == "-fp64")
Index: llvm-toolchain-10-10.0.1~+rc4/llvm/lib/Target/Mips/MipsSubtarget.cpp
===================================================================
--- llvm-toolchain-10-10.0.1~+rc4.orig/llvm/lib/Target/Mips/MipsSubtarget.cpp
+++ llvm-toolchain-10-10.0.1~+rc4/llvm/lib/Target/Mips/MipsSubtarget.cpp
@@ -79,7 +79,7 @@
InMips16Mode(false), 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),
+ UseTCCInDIV(false), HasSym32(false), HasEVA(false), DisableMadd4(true),
HasMT(false), HasCRC(false), HasVirt(false), HasGINV(false),
UseIndirectJumpsHazard(false), StackAlignOverride(StackAlignOverride),
TM(TM), TargetTriple(TT), TSInfo(),
@@ -91,6 +91,9 @@
if (MipsArchVersion == MipsDefault)
MipsArchVersion = Mips32;
+ if (hasMips32r6() || hasMips64r6())
+ DisableMadd4 = false;
+
// Don't even attempt to generate code for MIPS-I and MIPS-V. They have not
// been tested and currently exist for the integrated assembler only.
if (MipsArchVersion == Mips1)
@@ -238,6 +241,7 @@
MipsSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS,
const TargetMachine &TM) {
std::string CPUName = MIPS_MC::selectMipsCPU(TM.getTargetTriple(), CPU);
+ SubtargetFeatures Features(FS);
// Parse features string.
ParseSubtargetFeatures(CPUName, FS);
@@ -260,6 +264,13 @@
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;
}
Index: llvm-toolchain-10-10.0.1~+rc4/llvm/lib/Target/Mips/Mips.td
===================================================================
--- llvm-toolchain-10-10.0.1~+rc4.orig/llvm/lib/Target/Mips/Mips.td
+++ llvm-toolchain-10-10.0.1~+rc4/llvm/lib/Target/Mips/Mips.td
@@ -205,7 +205,7 @@
"UseTCCInDIV", "false",
"Force the assembler to use trapping">;
-def FeatureMadd4
+def FeatureNoMadd4
: SubtargetFeature<"nomadd4", "DisableMadd4", "true",
"Disable 4-operand madd.fmt and related instructions">;
Index: llvm-toolchain-10-10.0.1~+rc4/llvm/lib/Target/Mips/MipsInstrInfo.td
===================================================================
--- llvm-toolchain-10-10.0.1~+rc4.orig/llvm/lib/Target/Mips/MipsInstrInfo.td
+++ llvm-toolchain-10-10.0.1~+rc4/llvm/lib/Target/Mips/MipsInstrInfo.td
@@ -242,7 +242,7 @@
def HasMSA : Predicate<"Subtarget->hasMSA()">,
AssemblerPredicate<"FeatureMSA">;
def HasMadd4 : Predicate<"!Subtarget->disableMadd4()">,
- AssemblerPredicate<"!FeatureMadd4">;
+ AssemblerPredicate<"!FeatureNoMadd4">;
def HasMT : Predicate<"Subtarget->hasMT()">,
AssemblerPredicate<"FeatureMT">;
def UseIndirectJumpsHazard : Predicate<"Subtarget->useIndirectJumpsHazard()">,

View File

@ -146,3 +146,4 @@ no-cgi.patch
ubuntu-groovy.diff
clang_vendor_pass_stage2.diff
remove-trailing-space-version.diff
mips-force-nomadd4.patch