r178414 - Add support for gcc-compatible -mfprnd -mno-fprnd PPC options

Hal Finkel hfinkel at anl.gov
Sat Mar 30 06:47:44 PDT 2013


Author: hfinkel
Date: Sat Mar 30 08:47:44 2013
New Revision: 178414

URL: http://llvm.org/viewvc/llvm-project?rev=178414&view=rev
Log:
Add support for gcc-compatible -mfprnd -mno-fprnd PPC options

gcc provides -mfprnd and -mno-fprnd for controlling the fprnd target
feature; support these options as well.

Modified:
    cfe/trunk/include/clang/Driver/Options.td
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/ppc-features.cpp

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=178414&r1=178413&r2=178414&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Sat Mar 30 08:47:44 2013
@@ -834,6 +834,8 @@ def mabi_EQ : Joined<["-"], "mabi=">, Gr
 def march_EQ : Joined<["-"], "march=">, Group<m_Group>;
 def maltivec : Flag<["-"], "maltivec">, Alias<faltivec>;
 def mno_altivec : Flag<["-"], "mno-altivec">, Alias<fno_altivec>;
+def mfprnd : Flag<["-"], "mfprnd">, Group<m_Group>;
+def mno_fprnd : Flag<["-"], "mno-fprnd">, Group<m_Group>;
 def mmfcrf : Flag<["-"], "mmfcrf">, Group<m_Group>;
 def mno_mfcrf : Flag<["-"], "mno-mfcrf">, Group<m_Group>;
 def mpopcntd : Flag<["-"], "mpopcntd">, Group<m_Group>;

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=178414&r1=178413&r2=178414&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Mar 30 08:47:44 2013
@@ -1029,8 +1029,8 @@ void PPCTargetInfo::getDefaultFeatures(l
 bool PPCTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
                                          StringRef Name,
                                          bool Enabled) const {
-  if (Name == "altivec" || Name == "mfocrf" || Name == "popcntd" ||
-      Name == "qpx") {
+  if (Name == "altivec" || Name == "fprnd" || Name == "mfocrf" ||
+      Name == "popcntd" || Name == "qpx") {
     Features[Name] = Enabled;
     return true;
   }

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=178414&r1=178413&r2=178414&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sat Mar 30 08:47:44 2013
@@ -1101,6 +1101,10 @@ void Clang::AddPPCTargetArgs(const ArgLi
                    options::OPT_faltivec, options::OPT_fno_altivec,
                    "altivec");
 
+  AddTargetFeature(Args, CmdArgs,
+                   options::OPT_mfprnd, options::OPT_mno_fprnd,
+                   "fprnd");
+
   // Note that gcc calls this mfcrf and LLVM calls this mfocrf.
   AddTargetFeature(Args, CmdArgs,
                    options::OPT_mmfcrf, options::OPT_mno_mfcrf,

Modified: cfe/trunk/test/Driver/ppc-features.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ppc-features.cpp?rev=178414&r1=178413&r2=178414&view=diff
==============================================================================
--- cfe/trunk/test/Driver/ppc-features.cpp (original)
+++ cfe/trunk/test/Driver/ppc-features.cpp Sat Mar 30 08:47:44 2013
@@ -80,3 +80,9 @@
 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-popcntd -mpopcntd -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-POPCNTD %s
 // CHECK-POPCNTD: "-target-feature" "+popcntd"
 
+// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-fprnd -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOFPRND %s
+// CHECK-NOFPRND: "-target-feature" "-fprnd"
+
+// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-fprnd -mfprnd -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-FPRND %s
+// CHECK-FPRND: "-target-feature" "+fprnd"
+





More information about the cfe-commits mailing list