[PATCH] ARMv7A Cleanup

Renato Golin renato.golin at linaro.org
Tue Sep 3 04:56:39 PDT 2013


Hi doug.gregor,

This is a cleanup of the ARMv7A CPUs and their options and features.

- Adding Cortex-A12 and A5 and making sure all cores are in all lists. (I'm not sure I got them all).
- Changing "v7" to "v7a", "7" to "7A" on v7A CPUs.
- Forced "vfp3" to A8/A9, added "vfp4" for A15 and fixed the NEON feature check
- Adding "armv7l" Arch, that seems popular with Linux distros

I'm not sure how to add tests for all these things, pointers welcome!

http://llvm-reviews.chandlerc.com/D1579

Files:
  lib/Basic/Targets.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/Tools.cpp
  test/Driver/arch.c

Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -3612,10 +3612,12 @@
   void getDefaultFeatures(llvm::StringMap<bool> &Features) const {
     if (CPU == "arm1136jf-s" || CPU == "arm1176jzf-s" || CPU == "mpcore")
       Features["vfp2"] = true;
-    else if (CPU == "cortex-a8" || CPU == "cortex-a15" ||
-             CPU == "cortex-a9" || CPU == "cortex-a9-mp")
+    else if (CPU == "cortex-a8" || CPU == "cortex-a9" ||
+             CPU == "cortex-a9-mp") {
+      Features["vfp3"] = true;
       Features["neon"] = true;
-    else if (CPU == "swift" || CPU == "cortex-a7") {
+    } else if (CPU == "swift" || CPU == "cortex-a5" ||
+               CPU == "cortex-a7" || CPU == "cortex-a15") {
       Features["vfp4"] = true;
       Features["neon"] = true;
     }
@@ -3666,7 +3668,7 @@
         .Case("arm", true)
         .Case("softfloat", SoftFloat)
         .Case("thumb", IsThumb)
-        .Case("neon", FPU == NeonFPU && !SoftFloat && 
+        .Case("neon", (FPU & NeonFPU) && !SoftFloat &&
               StringRef(getCPUDefineSuffix(CPU)).startswith("7"))    
         .Default(false);
   }
@@ -3688,7 +3690,7 @@
       .Cases("arm1136jf-s", "mpcorenovfp", "mpcore", "6K")
       .Cases("arm1156t2-s", "arm1156t2f-s", "6T2")
       .Cases("cortex-a5", "cortex-a7", "cortex-a8", "7A")
-      .Cases("cortex-a9", "cortex-a15", "7A")
+      .Cases("cortex-a9", "cortex-a12", "cortex-a15", "7A")
       .Case("cortex-r5", "7R")
       .Case("cortex-a9-mp", "7F")
       .Case("swift", "7S")
@@ -3699,7 +3701,8 @@
   }
   static const char *getCPUProfile(StringRef Name) {
     return llvm::StringSwitch<const char*>(Name)
-      .Cases("cortex-a8", "cortex-a9", "A")
+      .Cases("cortex-a5", "cortex-a7", "cortex-a8", "A")
+      .Cases("cortex-a9", "cortex-a12", "cortex-a15", "A")
       .Cases("cortex-m3", "cortex-m4", "cortex-m0", "M")
       .Case("cortex-r5", "R")
       .Default("");
Index: lib/Driver/ToolChain.cpp
===================================================================
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -237,8 +237,8 @@
     .Cases("arm1136j-s",  "arm1136jf-s",  "arm1176jz-s", "v6")
     .Cases("arm1176jzf-s",  "mpcorenovfp",  "mpcore", "v6")
     .Cases("arm1156t2-s",  "arm1156t2f-s", "v6t2")
-    .Cases("cortex-a5", "cortex-a7", "cortex-a8", "v7")
-    .Cases("cortex-a9", "cortex-a15", "v7")
+    .Cases("cortex-a5", "cortex-a7", "cortex-a8", "v7a")
+    .Cases("cortex-a9", "cortex-a12", "cortex-a15", "v7a")
     .Case("cortex-r5", "v7r")
     .Case("cortex-m0", "v6m")
     .Case("cortex-m3", "v7m")
Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -112,6 +112,7 @@
     .Cases("armv7k", "armv7-k", "armv7k")
     .Cases("armv7m", "armv7-m", "armv7m")
     .Cases("armv7s", "armv7-s", "armv7s")
+    .Cases("armv7l", "armv7-l", "armv7l")
     .Cases("armv8", "armv8a", "armv8-a", "armv8")
     .Default(0);
 }
@@ -124,7 +125,9 @@
     .Case("xscale", "xscale")
     .Cases("arm1136j-s", "arm1136jf-s", "arm1176jz-s", "arm1176jzf-s", "armv6")
     .Case("cortex-m0", "armv6m")
-    .Cases("cortex-a8", "cortex-r4", "cortex-a9", "cortex-a15", "armv7")
+    .Cases("cortex-a5", "cortex-a7", "cortex-a8", "armv7a")
+    .Cases("cortex-a9", "cortex-a12", "cortex-a15", "armv7a")
+    .Case("cortex-r4", "armv7r")
     .Case("cortex-a9-mp", "armv7f")
     .Case("cortex-m3", "armv7m")
     .Case("cortex-m4", "armv7em")
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -458,8 +458,8 @@
     .Cases("arm1136j-s",  "arm1136jf-s",  "arm1176jz-s", "v6")
     .Cases("arm1176jzf-s",  "mpcorenovfp",  "mpcore", "v6")
     .Cases("arm1156t2-s",  "arm1156t2f-s", "v6t2")
-    .Cases("cortex-a5", "cortex-a7", "cortex-a8", "v7")
-    .Cases("cortex-a9", "cortex-a15", "v7")
+    .Cases("cortex-a5", "cortex-a7", "cortex-a8", "v7a")
+    .Cases("cortex-a9", "cortex-a12", "cortex-a15", "v7a")
     .Case("cortex-r5", "v7r")
     .Case("cortex-m0", "v6m")
     .Case("cortex-m3", "v7m")
Index: test/Driver/arch.c
===================================================================
--- test/Driver/arch.c
+++ test/Driver/arch.c
@@ -1,5 +1,5 @@
 // RUN: %clang -target armv7a-unknown-linux-gnueabi -S -emit-llvm %s -o - | FileCheck %s --check-prefix=V7
 // RUN: %clang -target armv8a-unknown-linux-gnueabi -S -emit-llvm %s -o - | FileCheck %s --check-prefix=V8
 
-// V7: target triple = "armv7-unknown-linux-gnueabi"
+// V7: target triple = "armv7a-unknown-linux-gnueabi"
 // V8: target triple = "armv8-unknown-linux-gnueabi"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1579.1.patch
Type: text/x-patch
Size: 4795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130903/2cbb9e58/attachment.bin>


More information about the cfe-commits mailing list