The actual patch...

On Wed, Jan 11, 2012 at 1:48 PM, Evgeniy Stepanov
<[email protected]> wrote:
> Please review the attached patch (with a table this time).
>
> On Tue, Dec 27, 2011 at 11:59 AM, Evgeniy Stepanov
> <[email protected]> wrote:
>> Sorry, I don't see how to do it cleanly (with a reasonable amount of
>> work). If you insist, I can revisit the issue sometime next year.
>>
>> On Tue, Dec 27, 2011 at 1:37 AM, Anton Korobeynikov
>> <[email protected]> wrote:
>>>> You mean a tblgen table? I doubt it will be any shorter than this.Well, 
>>>> not surely a tblgen table. But I think it might make sense tohave such 
>>>> table for the sake of clarity.
>>> --
>>> With best regards, Anton Korobeynikov
>>> Faculty of Mathematics and Mechanics, Saint Petersburg State University
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp	(revision 147931)
+++ lib/Basic/Targets.cpp	(working copy)
@@ -2658,7 +2658,7 @@
                                  const std::string &Name,
                                  bool Enabled) const {
     if (Name == "soft-float" || Name == "soft-float-abi" ||
-        Name == "vfp2" || Name == "vfp3" || Name == "neon") {
+        Name == "vfp2" || Name == "vfp3" || Name == "neon" || Name == "d16") {
       Features[Name] = Enabled;
     } else
       return false;
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp	(revision 147931)
+++ lib/Driver/Tools.cpp	(working copy)
@@ -652,25 +652,32 @@
     StringRef FPU = A->getValue(Args);
 
     // Set the target features based on the FPU.
-    if (FPU == "fpa" || FPU == "fpe2" || FPU == "fpe3" || FPU == "maverick") {
-      // Disable any default FPU support.
-      CmdArgs.push_back("-target-feature");
-      CmdArgs.push_back("-vfp2");
-      CmdArgs.push_back("-target-feature");
-      CmdArgs.push_back("-vfp3");
-      CmdArgs.push_back("-target-feature");
-      CmdArgs.push_back("-neon");
-    } else if (FPU == "vfp") {
-      CmdArgs.push_back("-target-feature");
-      CmdArgs.push_back("+vfp2");
-    } else if (FPU == "vfp3") {
-      CmdArgs.push_back("-target-feature");
-      CmdArgs.push_back("+vfp3");
-    } else if (FPU == "neon") {
-      CmdArgs.push_back("-target-feature");
-      CmdArgs.push_back("+neon");
-    } else
-      D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
+    static const char* FPUFeatures[][7] = {
+      {"fpa",       "-vfp2", "-vfp3", "-neon", NULL},
+      {"fpe2",      "-vfp2", "-vfp3", "-neon", NULL},
+      {"fpe3",      "-vfp2", "-vfp3", "-neon", NULL},
+      {"maverick",  "-vfp2", "-vfp3", "-neon", NULL},
+      {"vfp3-d16",  "+vfp3", "+d16", "-neon", NULL},
+      {"vfpv3-d16", "+vfp3", "+d16", "-neon", NULL},
+      {"vfp",       "+vfp2", "-neon", NULL},
+      {"vfp3",      "+vfp3", "-neon", NULL},
+      {"vfpv3",     "+vfp3", "-neon", NULL},
+      {"neon",      "+neon", NULL},
+      {NULL}
+    };
+
+    for (int i = 0; i < sizeof(FPUFeatures) / sizeof(*FPUFeatures); ++i) {
+      const char** d = FPUFeatures[i];
+      if (!*d) {
+        D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
+      } else if (FPU.compare(*d++) == 0) {
+        while (*d) {
+          CmdArgs.push_back("-target-feature");
+          CmdArgs.push_back(*d++);
+        }
+        break;
+      }
+    }
   }
 
   // Setting -msoft-float effectively disables NEON because of the GCC
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to