[PATCH] D51939: -mcpu=native CPU detection for Cavium processors

Stefan Teleman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 11 10:25:29 PDT 2018


steleman created this revision.
steleman added a reviewer: joel_k_jones.
Herald added a subscriber: llvm-commits.

This small patch updates the CPU detection for Cavium processors when -mcpu=native was passed on compile-line.


Repository:
  rL LLVM

https://reviews.llvm.org/D51939

Files:
  lib/Support/Host.cpp


Index: lib/Support/Host.cpp
===================================================================
--- lib/Support/Host.cpp
+++ lib/Support/Host.cpp
@@ -196,6 +196,21 @@
             .Default("generic");
   }
 
+  if (Implementer == "0x42" || Implementer == "0x43") { // Broadcom | Cavium.
+    for (unsigned I = 0, E = Lines.size(); I != E; ++I) {
+      if (Lines[I].startswith("CPU part")) {
+        return StringSwitch<const char *>(Lines[I].substr(8).ltrim("\t :"))
+          .Case("0x516", "thunderx2t99")
+          .Case("0x0516", "thunderx2t99")
+          .Case("0xaf", "thunderx2t99")
+          .Case("0x0af", "thunderx2t99")
+          .Case("0xa1", "thunderxt88")
+          .Case("0x0a1", "thunderxt88")
+          .Default("generic");
+      }
+    }
+  }
+
   if (Implementer == "0x51") // Qualcomm Technologies, Inc.
     // Look for the CPU part line.
     for (unsigned I = 0, E = Lines.size(); I != E; ++I)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51939.164920.patch
Type: text/x-patch
Size: 927 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180911/a5988d9c/attachment.bin>


More information about the llvm-commits mailing list