[PATCH] D40490: [mips] Add warnings for using dsp and msa flags with inapropriate MIPS revisions

Simon Dardis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 4 02:51:13 PST 2017


sdardis added inline comments.


================
Comment at: lib/Target/Mips/MipsSubtarget.cpp:130-131
+
+  // Used to avoid printing dsp warnings multiple times.
+  static bool DspWarningPrinted = false;
+
----------------
Hoist this to a static member variable of MipsSubtarget, rather than a function static variable.


================
Comment at: lib/Target/Mips/MipsSubtarget.cpp:132-164
+
+  if (hasDSPR2() && !DspWarningPrinted) {
+    if (hasMips64() && !hasMips64r2()) {
+      errs() << "warning: the 'dspr2' extension requires MIPS64 revision 2 or "
+             << "greater\n";
+      DspWarningPrinted = true;
+    } else if (hasMips32() && !hasMips32r2()) {
----------------
Change the message of "the 'msa' extension" to "the 'msa' ASE".


================
Comment at: lib/Target/Mips/MipsSubtarget.cpp:145-149
+      errs() << "warning: the 'dsp' extension requires MIPS64 revision 2 or "
+             << "greater\n";
+      DspWarningPrinted = true;
+    } else if (hasMips32() && !hasMips32r2()) {
+      errs() << "warning: the 'dsp' extension requires MIPS32 revision 2 or "
----------------
Change the message of "the 'msa' extension" to "the 'msa' ASE".


================
Comment at: lib/Target/Mips/MipsSubtarget.cpp:155
+
+  // Used to avoid printing msa warnings multiple times.
+  static bool MSAWarningPrinted = false;
----------------
See my comment about DspWarningPrinted.


================
Comment at: test/CodeGen/Mips/dsp_msa_warning.ll:2-29
+; RUN: llc -march=mips -mattr=+mips32r2 -mattr=+msa -mattr=+fp64 < %s 2>&1 | \
+; RUN:   FileCheck %s -check-prefix=msa_32
+; RUN: llc -march=mips64 -mattr=+mips64r2 -mattr=+msa < %s 2>&1 | \
+; RUN:   FileCheck %s  -check-prefix=msa_64
+; RUN: llc -march=mips -mattr=+mips32r5 -mattr=+msa -mattr=+fp64 < %s 2>&1 | \
+; RUN:   FileCheck %s -check-prefix=msa_32_no_warning
+; RUN: llc -march=mips64 -mattr=+mips64r5 -mattr=+msa < %s 2>&1 | \
----------------
Check prefixes should be in capital letters, to ensure they stand out.


https://reviews.llvm.org/D40490





More information about the llvm-commits mailing list