auto-detect MCPU

Change-Id: Id38c51704c99810b2237d18c18163d9d776451bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274588
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This commit is contained in:
Mike Klein 2020-03-02 15:46:48 -06:00 committed by Skia Commit-Bot
parent 4b7052d714
commit 6a63365fee

View File

@ -1901,16 +1901,8 @@ namespace skvm {
auto mod = std::make_unique<llvm::Module>("", ctx);
// All the scary bare pointers from here on are owned by ctx or mod, I think.
const char* mcpu = "x86-64";
int K = 4;
if (true && SkCpu::Supports(SkCpu::HSW)) {
mcpu = "haswell";
K = 8;
}
if (true && SkCpu::Supports(SkCpu::SKX)) {
mcpu = "skylake-avx512";
K = 16;
}
const int K = (true && SkCpu::Supports(SkCpu::SKX)) ? 16 :
(true && SkCpu::Supports(SkCpu::HSW)) ? 8 : 4;
llvm::Type *ptr = llvm::Type::getInt8Ty(ctx)->getPointerTo(),
*i32 = llvm::Type::getInt32Ty(ctx);
@ -2298,7 +2290,7 @@ namespace skvm {
fEE = llvm::EngineBuilder(std::move(mod))
.setEngineKind(llvm::EngineKind::JIT)
.setMCPU(mcpu)
.setMCPU(llvm::sys::getHostCPUName())
.create();
if (fEE) {
fJITEntry = (void*)fEE->getFunctionAddress(debug_name);