[feat]: Adding the plumbing necessary for the singlepass to choose between different simd instruction sets. Partial work on supporting SSE4.2

This commit is contained in:
R2D2
2022-01-30 10:55:26 +01:00
parent 67be3eaa51
commit b32b5cfa53
6 changed files with 928 additions and 315 deletions

View File

@ -68,11 +68,15 @@ impl Compiler for SinglepassCompiler {
target.triple().architecture.to_string(),
));
}
if !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()));
}
@ -127,7 +131,7 @@ impl Compiler for SinglepassCompiler {
}
let machine = match target.triple().architecture {
Architecture::X86_64 => MachineX86_64::new(),
Architecture::X86_64 => MachineX86_64::new(Some(simd_arch)),
_ => unimplemented!(),
};
let mut generator = FuncGen::new(