Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SSE 4.2 for the Singlepass compiler #2775

Merged
merged 12 commits into from Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/compiler-singlepass/Cargo.toml
Expand Up @@ -32,6 +32,8 @@ target-lexicon = { version = "0.12.2", default-features = false }
maintenance = { status = "actively-developed" }

[features]
default = ["std", "rayon"]
default = ["std", "rayon", "avx"]
std = ["wasmer-compiler/std", "wasmer-types/std"]
core = ["hashbrown", "wasmer-types/core"]
sse = []
avx = []
15 changes: 9 additions & 6 deletions lib/compiler-singlepass/src/compiler.rs
Expand Up @@ -69,13 +69,16 @@ impl Compiler for SinglepassCompiler {
))
}
}
if target.triple().architecture == Architecture::X86_64
&& !target.cpu_features().contains(CpuFeature::AVX)
{

let simd_arch = if target.cpu_features().contains(CpuFeature::AVX) {
CpuFeature::AVX
} else if target.cpu_features().contains(CpuFeature::SSE42) {
CpuFeature::SSE42
} else {
return Err(CompileError::UnsupportedTarget(
"x86_64 without AVX".to_string(),
"x86_64 without AVX or SSE 4.2".to_string(),
));
}
};
if compile_info.features.multi_value {
return Err(CompileError::UnsupportedFeature("multivalue".to_string()));
}
Expand Down Expand Up @@ -131,7 +134,7 @@ impl Compiler for SinglepassCompiler {

match target.triple().architecture {
Architecture::X86_64 => {
let machine = MachineX86_64::new();
let machine = MachineX86_64::new(Some(simd_arch));
let mut generator = FuncGen::new(
module,
&self.config,
Expand Down