Switch default to new x86_64 backend.
This PR switches the default backend on x86, for both the `cranelift-codegen` crate and for Wasmtime, to the new (`MachInst`-style, `VCode`-based) backend that has been under development and testing for some time now. The old backend is still available by default in builds with the `old-x86-backend` feature, or by requesting `BackendVariant::Legacy` from the appropriate APIs. As part of that switch, it adds some more runtime-configurable plumbing to the testing infrastructure so that tests can be run using the appropriate backend. `clif-util test` is now capable of parsing a backend selector option from filetests and instantiating the correct backend. CI has been updated so that the old x86 backend continues to run its tests, just as we used to run the new x64 backend separately. At some point, we will remove the old x86 backend entirely, once we are satisfied that the new backend has not caused any unforeseen issues and we do not need to revert.
This commit is contained in:
42
build.rs
42
build.rs
@@ -155,11 +155,8 @@ fn write_testsuite_tests(
|
||||
let testname = extract_name(path);
|
||||
|
||||
writeln!(out, "#[test]")?;
|
||||
if experimental_x64_should_panic(testsuite, &testname, strategy) {
|
||||
writeln!(
|
||||
out,
|
||||
r#"#[cfg_attr(feature = "experimental_x64", should_panic)]"#
|
||||
)?;
|
||||
if x64_should_panic(testsuite, &testname, strategy) {
|
||||
writeln!(out, r#"#[should_panic]"#)?;
|
||||
} else if ignore(testsuite, &testname, strategy) {
|
||||
writeln!(out, "#[ignore]")?;
|
||||
} else if pooling {
|
||||
@@ -186,10 +183,10 @@ fn write_testsuite_tests(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// For experimental_x64 backend features that are not supported yet, mark tests as panicking, so
|
||||
/// For x64 backend features that are not supported yet, mark tests as panicking, so
|
||||
/// they stop "passing" once the features are properly implemented.
|
||||
fn experimental_x64_should_panic(testsuite: &str, testname: &str, strategy: &str) -> bool {
|
||||
if !cfg!(feature = "experimental_x64") || strategy != "Cranelift" {
|
||||
fn x64_should_panic(testsuite: &str, testname: &str, strategy: &str) -> bool {
|
||||
if !platform_is_x64() || strategy != "Cranelift" {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -222,12 +219,11 @@ fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool {
|
||||
_ => (),
|
||||
},
|
||||
"Cranelift" => match (testsuite, testname) {
|
||||
// TODO(#1886): Ignore reference types tests if this isn't x64,
|
||||
// because Cranelift only supports reference types on x64.
|
||||
("reference_types", _) => {
|
||||
return env::var("CARGO_CFG_TARGET_ARCH").unwrap() != "x86_64";
|
||||
("simd", _) if cfg!(feature = "old-x86-backend") => return true, // skip all SIMD tests on old backend.
|
||||
// These are only implemented on x64.
|
||||
("simd", "simd_i64x2_arith2") | ("simd", "simd_boolean") => {
|
||||
return !platform_is_x64() || cfg!(feature = "old-x86-backend")
|
||||
}
|
||||
|
||||
// These are new instructions that are not really implemented in any backend.
|
||||
("simd", "simd_i8x16_arith2")
|
||||
| ("simd", "simd_conversions")
|
||||
@@ -240,22 +236,6 @@ fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool {
|
||||
| ("simd", "simd_i64x2_extmul_i32x4")
|
||||
| ("simd", "simd_int_to_int_extend") => return true,
|
||||
|
||||
// These are only implemented on x64.
|
||||
("simd", "simd_i64x2_arith2") | ("simd", "simd_boolean") => {
|
||||
return !cfg!(feature = "experimental_x64")
|
||||
}
|
||||
|
||||
// These are only implemented on aarch64 and x64.
|
||||
("simd", "simd_i64x2_cmp")
|
||||
| ("simd", "simd_f32x4_pmin_pmax")
|
||||
| ("simd", "simd_f64x2_pmin_pmax")
|
||||
| ("simd", "simd_f32x4_rounding")
|
||||
| ("simd", "simd_f64x2_rounding")
|
||||
| ("simd", "simd_i32x4_dot_i16x8") => {
|
||||
return !(cfg!(feature = "experimental_x64")
|
||||
|| env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "aarch64")
|
||||
}
|
||||
|
||||
_ => {}
|
||||
},
|
||||
_ => panic!("unrecognized strategy"),
|
||||
@@ -263,3 +243,7 @@ fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool {
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
fn platform_is_x64() -> bool {
|
||||
env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "x86_64"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user