[llvm] r325439 - [X86] Add 'sahf' to getHostCPUFeatures so -march=native will pick it up correctly.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 17 08:52:49 PST 2018
Author: ctopper
Date: Sat Feb 17 08:52:49 2018
New Revision: 325439
URL: http://llvm.org/viewvc/llvm-project?rev=325439&view=rev
Log:
[X86] Add 'sahf' to getHostCPUFeatures so -march=native will pick it 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
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=325439&r1=325438&r2=325439&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Host.cpp (original)
+++ llvm/trunk/lib/Support/Host.cpp Sat Feb 17 08:52:49 2018
@@ -1206,6 +1206,7 @@ bool sys::getHostCPUFeatures(StringMap<b
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);
More information about the llvm-commits
mailing list