[PATCH] [Mips] Generate warning for invalid combination of '-mnan' and '-march' options.

Daniel Sanders daniel.sanders at imgtec.com
Fri Mar 13 10:24:01 PDT 2015


================
Comment at: lib/Basic/Targets.cpp:5729
@@ +5728,3 @@
+        .Case("mips5", true)
+        .Case("mips32", true)
+        .Case("mips64", true)
----------------
petarj wrote:
> According to the documentation, Has2008 field in FIR Register is optional as of R3. So, if I understand this correctly, mips32r2 always uses legacy encoding. Is that correct? If so, should we add mips32r2 case as well?
That's my understanding. Although it's worth pointing out that we also accept microMIPS in mips32r2 at the moment even though it was added in mips32r3 as far as I know.

For -mnan, I think we should add mips32r2 to the legacy-only list and explain the reason to anyone who asks about it.

================
Comment at: lib/Basic/Targets.cpp:5962-5974
@@ -5949,5 +5961,15 @@
         HasFP64 = false;
-      else if (*it == "+nan2008")
-        IsNan2008 = true;
-      else if (*it == "-nan2008")
-        IsNan2008 = false;
+      else if (*it == "+nan2008") {
+        if (hasOnlyNaNLegacyEncoding()) {
+          unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Warning,
+                    "the '%0' architecture does not support '-mnan=2008'");
+          Diags.Report(DiagID) << CPU;
+        } else
+          IsNan2008 = true;
+      } else if (*it == "-nan2008") {
+        if (hasOnlyNaN2008Encoding()) {
+          unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Warning,
+                    "the '%0' architecture does not support '-mnan=legacy'");
+          Diags.Report(DiagID) << CPU;
+        } else
+          IsNan2008 = false;
----------------
The diagnostics should mention that we're ignoring the request.

================
Comment at: test/CodeGen/mips-unsupported-nan.c:8
@@ +7,3 @@
+
+// CHECK-WARNING: warning: the '{{mips.*}}' architecture does not support '-mnan={{2008|legacy}}'
+// CHECK-LEGACY: float 0x7FF4000000000000
----------------
We should check that the right warning is emitted for the right cases.

http://reviews.llvm.org/D8170

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list