[llvm] r207973 - Select bdver2 instead of bdver1 if TBM support is present on models < 0x10.

Kaelyn Takata rikka at google.com
Mon May 5 09:32:10 PDT 2014


Author: rikka
Date: Mon May  5 11:32:10 2014
New Revision: 207973

URL: http://llvm.org/viewvc/llvm-project?rev=207973&view=rev
Log:
Select bdver2 instead of bdver1 if TBM support is present on models < 0x10.

Tested that the right -target-cpu is set in the clang -cc1 command line
when running "clang -march=native -E -v - </dev/null" on both an FX-8150
and an FX-8350. Both are family 15h; the FX-8150 (Bulldozer processor)
reports a model number of 1, and the FX-8350 (Piledriver processor)
reports a model number of 2.

Modified:
    llvm/trunk/lib/Support/Host.cpp

Modified: llvm/trunk/lib/Support/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Host.cpp?rev=207973&r1=207972&r2=207973&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Host.cpp (original)
+++ llvm/trunk/lib/Support/Host.cpp Mon May  5 11:32:10 2014
@@ -223,6 +223,7 @@ StringRef sys::getHostCPUName() {
                  (EBX & 0x20);
   GetX86CpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX);
   bool Em64T = (EDX >> 29) & 0x1;
+  bool HasTBM = (ECX >> 21) & 0x1;
 
   if (memcmp(text.c, "GenuineIntel", 12) == 0) {
     switch (Family) {
@@ -439,7 +440,7 @@ StringRef sys::getHostCPUName() {
           return "bdver4"; // 50h-6Fh: Excavator
         if (Model >= 0x30)
           return "bdver3"; // 30h-3Fh: Steamroller
-        if (Model >= 0x10)
+        if (Model >= 0x10 || HasTBM)
           return "bdver2"; // 10h-1Fh: Piledriver
         return "bdver1";   // 00h-0Fh: Bulldozer
       case 22:





More information about the llvm-commits mailing list