Skip to content

Commit

Permalink
[X86] Add 'sahf' to getHostCPUFeatures so -march=native will pick it …
Browse files Browse the repository at this point in the history
…up correctly.

Summary: We probably mostly get this right due to family/model/stepping mapping to CPU names. But we should detect it explicitly.

Reviewers: RKSimon, echristo, dim, spatel

Reviewed By: dim

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D43418

llvm-svn: 325439
  • Loading branch information
topperc committed Feb 17, 2018
1 parent 47952b0 commit 8d02be3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions llvm/lib/Support/Host.cpp
Expand Up @@ -1206,6 +1206,7 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features) {

bool HasExtLeaf1 = MaxExtLevel >= 0x80000001 &&
!getX86CpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX);
Features["sahf"] = HasExtLeaf1 && ((ECX >> 0) & 1);
Features["lzcnt"] = HasExtLeaf1 && ((ECX >> 5) & 1);
Features["sse4a"] = HasExtLeaf1 && ((ECX >> 6) & 1);
Features["prfchw"] = HasExtLeaf1 && ((ECX >> 8) & 1);
Expand Down

0 comments on commit 8d02be3

Please sign in to comment.