[PATCH] D43418: [X86] Add 'sahf' to getHostCPUFeatures so -march=native will pick it up correctly.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 16 15:39:01 PST 2018


craig.topper created this revision.
craig.topper added reviewers: RKSimon, echristo, dim, spatel.

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


https://reviews.llvm.org/D43418

Files:
  lib/Support/Host.cpp


Index: lib/Support/Host.cpp
===================================================================
--- lib/Support/Host.cpp
+++ lib/Support/Host.cpp
@@ -1206,6 +1206,7 @@
 
   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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43418.134750.patch
Type: text/x-patch
Size: 532 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180216/c2ab4b99/attachment.bin>


More information about the llvm-commits mailing list