[PATCH] D46314: [X86][AMD][Bulldozer] Fix Bulldozer Model 2 detection.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 1 09:36:28 PDT 2018


lebedev.ri added a comment.

In https://reviews.llvm.org/D46314#1084130, @craig.topper wrote:

> You may want to check what `__builtin_cpu_is("btver2")` and `__builtin_cpu_is("btver1")` return when compiled with gcc. They seem to have the same bad check in their library code. The gcc compiler uses feature bits not Family/Model.
>
> We also would need to fix the code in compiler-rt since it's copied from our Host.cpp.


b**d**ver1/2, not b**t**ver1/2
But yes, that is apparently broken, too:

  $ cat /tmp/test.cpp 
  #include <iostream>
  
  int main (int argc, char* argv[]) {
    std::cout << __builtin_cpu_is("bdver2") << " " << __builtin_cpu_is("bdver1") << "\n";
  return 0;
  }
  $ g++ /tmp/test.cpp 
  $ ./a.out 
  0 1
  $ clang++ /tmp/test.cpp 
  $ ./a.out 
  0 1
  $ /build/llvm-build-Clang-release/bin/clang++ /tmp/test.cpp 
  $ ./a.out 
  0 1


Repository:
  rL LLVM

https://reviews.llvm.org/D46314





More information about the llvm-commits mailing list