[X86] Add 'sahf' to getHostCPUFeatures so -march=native will pick it up correctly.
authorCraig Topper <craig.topper@intel.com>
Sat, 17 Feb 2018 16:52:49 +0000 (16:52 +0000)
committerCraig Topper <craig.topper@intel.com>
Sat, 17 Feb 2018 16:52:49 +0000 (16:52 +0000)
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

llvm/lib/Support/Host.cpp

index 695683efa6257d7692c40c981b9fefe4082a929f..7945aa5e525254007cdb8ede7d131f5e1d0f7da3 100644 (file)
@@ -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);