]> granicus.if.org Git - clang/commitdiff
[mips] Pass nan2008 info to the back-end.
authorMatheus Almeida <matheus.almeida@imgtec.com>
Wed, 7 May 2014 16:16:07 +0000 (16:16 +0000)
committerMatheus Almeida <matheus.almeida@imgtec.com>
Wed, 7 May 2014 16:16:07 +0000 (16:16 +0000)
Summary: The initial support for NaN2008 was added to the back-end in r206396.

Reviewers: atanasyan

Reviewed By: atanasyan

Differential Revision: http://reviews.llvm.org/D3448

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208220 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
lib/Driver/Tools.cpp
test/Driver/mips-features.c

index 4bcdb373413a7b1f23dab642e3aa45323a155199..0e47d328b7eaf71b62ec1fd2df8678fbe247ad4c 100644 (file)
@@ -5669,9 +5669,6 @@ public:
       std::find(Features.begin(), Features.end(), "+soft-float");
     if (it != Features.end())
       Features.erase(it);
-    it = std::find(Features.begin(), Features.end(), "+nan2008");
-    if (it != Features.end())
-      Features.erase(it);
 
     setDescriptionString();
 
index b86df2acdb5893fcb104900325b842babed6e029..2ab7ea3fded1702593d0b02d8d378a1798cdc1d4 100644 (file)
@@ -1037,8 +1037,14 @@ static void getMIPSTargetFeatures(const Driver &D, const ArgList &Args,
   }
 
   if (Arg *A = Args.getLastArg(options::OPT_mnan_EQ)) {
-    if (StringRef(A->getValue()) == "2008")
+    StringRef Val = StringRef(A->getValue());
+    if (Val == "2008")
       Features.push_back("+nan2008");
+    else if (Val == "legacy")
+      Features.push_back("-nan2008");
+    else
+      D.Diag(diag::err_drv_unsupported_option_argument)
+          << A->getOption().getName() << Val;
   }
 
   AddTargetFeature(Args, Features, options::OPT_msingle_float,
index d663e6651e5341e15785da318c9988593374b29c..c21e9750b9c37ed3855c1fcd7a7e815137ffaf67 100644 (file)
 // RUN:   | FileCheck --check-prefix=CHECK-NOMFP64 %s
 // CHECK-NOMFP64: "-target-feature" "-fp64"
 //
+// -mnan=2008
+// RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN:     -mnan=legacy -mnan=2008 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NAN2008 %s
+// CHECK-NAN2008: "-target-feature" "+nan2008"
+//
+// -mnan=legacy
+// RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN:     -mnan=2008 -mnan=legacy 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NANLEGACY %s
+// CHECK-NANLEGACY: "-target-feature" "-nan2008"
+//
 // -mxgot
 // RUN: %clang -target mips-linux-gnu -### -c %s \
 // RUN:     -mno-xgot -mxgot 2>&1 \