diff --git a/crates/test-util/src/wast.rs b/crates/test-util/src/wast.rs index 677c5928e86b..7cfec36203a5 100644 --- a/crates/test-util/src/wast.rs +++ b/crates/test-util/src/wast.rs @@ -349,6 +349,8 @@ impl Compiler { || config.gc_types() || config.exceptions() || config.legacy_exceptions() + || (cfg!(target_arch = "aarch64") + && (config.simd() || config.threads() || config.wide_arithmetic())) } Compiler::CraneliftPulley => config.threads() || config.legacy_exceptions(), @@ -365,9 +367,7 @@ impl Compiler { || cfg!(target_arch = "riscv64") || cfg!(target_arch = "s390x") } - Compiler::Winch => { - cfg!(target_arch = "x86_64") - } + Compiler::Winch => cfg!(target_arch = "x86_64") || cfg!(target_arch = "aarch64"), Compiler::CraneliftPulley => true, } } @@ -392,6 +392,47 @@ impl WastTest { spec_proposal_from_path(&self.path) } + /// Returns whether this test should be skipped with this configuration + /// entirely, not running it at all. + /// + /// Ideally all tests should be run at all times, even if they're expected + /// to fail. This ensures that the expected failure is a controlled + /// failure, for example an error is returned, which is more desirable than + /// a panic or a segfault/crash. As implementations progress, however, + /// tests will naturally crash when an implementation is not yet complete + /// or fully finished. In the interest of still getting at least some test + /// coverage, however, this is an escape hatch to avoid running a test + /// entirely. + /// + /// Where possible avoid putting tests here. Instead add known and/or + /// expected failures to `should_fail`. Adding to `should_fail` means that + /// if a test is actually implemented then it'll require updating that + /// method to indicate that we expect success, not failure. Adding a test + /// here, however, means that someone will have to proactively review this + /// in the future to ensure that tests are removed here to start running + /// the tests. + pub fn should_skip_entirely(&self, config: &WastConfig) -> bool { + // FIXME(#8321): Winch on AArch64 is not yet fully complete. Most tests + // pass, there are some misc failures listed below, and this is a list + // of known tests that crash and thus cannot be run. + if config.compiler == Compiler::Winch && cfg!(target_arch = "aarch64") { + let unsupported = [ + // different pass/fail result in release/debug mdoe + "misc_testsuite/issue4890.wast", + "misc_testsuite/memory64/offsets.wast", + // crashes, unsure why + "misc_testsuite/table_copy_on_imported_tables.wast", + // stack checks not implemented yet + "misc_testsuite/stack_overflow.wast", + ]; + if unsupported.iter().any(|part| self.path.ends_with(part)) { + return true; + } + } + + false + } + /// Returns whether this test should fail under the specified extra /// configuration. pub fn should_fail(&self, config: &WastConfig) -> bool { @@ -470,6 +511,36 @@ impl WastTest { return true; } + // FIXME(#8321): Winch on AArch64 is not yet fully complete, these + // are currently tests that are known and expected to fail due to + // unimplemented features and/or bugs. + if cfg!(target_arch = "aarch64") { + let unsupported = [ + "misc_testsuite/call_indirect.wast", + "misc_testsuite/component-model/fused.wast", + "misc_testsuite/custom-page-sizes/custom-page-sizes.wast", + "misc_testsuite/float-round-doesnt-load-too-much.wast", + "misc_testsuite/imported-memory-copy.wast", + "misc_testsuite/issue4840.wast", + "misc_testsuite/memory-copy.wast", + "misc_testsuite/multi-memory/simple.wast", + "misc_testsuite/partial-init-memory-segment.wast", + "misc_testsuite/sink-float-but-dont-trap.wast", + "misc_testsuite/stack_overflow.wast", + "misc_testsuite/table_copy_on_imported_tables.wast", + "misc_testsuite/winch/global.wast", + "misc_testsuite/winch/select.wast", + "misc_testsuite/winch/table_fill.wast", + "misc_testsuite/winch/table_get.wast", + "misc_testsuite/winch/table_grow.wast", + "misc_testsuite/winch/table_set.wast", + "spec_testsuite/proposals/custom-page-sizes/custom-page-sizes.wast", + ]; + if unsupported.iter().any(|part| self.path.ends_with(part)) { + return true; + } + } + // SIMD on Winch requires AVX instructions. #[cfg(target_arch = "x86_64")] if !(std::is_x86_feature_detected!("avx") && std::is_x86_feature_detected!("avx2")) { diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs index 539e93d473ca..33f143124292 100644 --- a/crates/wasmtime/src/config.rs +++ b/crates/wasmtime/src/config.rs @@ -2047,10 +2047,10 @@ impl Config { // no support for simd on aarch64 unsupported |= WasmFeatures::SIMD; - // things like multi-table are technically supported on - // winch on aarch64 but this helps gate most spec tests - // by default which otherwise currently cause panics. - unsupported |= WasmFeatures::REFERENCE_TYPES; + // not implemented yet + unsupported |= WasmFeatures::WIDE_ARITHMETIC; + + // also not implemented yet. unsupported |= WasmFeatures::THREADS } diff --git a/docs/stability-wasm-proposals.md b/docs/stability-wasm-proposals.md index 403c800c2c47..2ea008ee0d38 100644 --- a/docs/stability-wasm-proposals.md +++ b/docs/stability-wasm-proposals.md @@ -111,6 +111,10 @@ For each column in the above tables, this is a further explanation of its meanin must pass at least for Cranelift on all [tier 1](./stability-tiers.md) platforms, but missing other platforms is otherwise acceptable. + > For maintainers be sure to audit the `WastTest::should_skip_entirely` + > method to ensure that there are no tests which are listed there for this + > feature. If so remove them to ensure that the test is run on CI. + * **Finished** - No open questions, design concerns, or serious known bugs. The implementation should be complete to the extent that is possible. Support must be implemented for all [tier 1](./stability-tiers.md) targets and diff --git a/tests/wast.rs b/tests/wast.rs index a5fd4a4cd324..4c97937a4afb 100644 --- a/tests/wast.rs +++ b/tests/wast.rs @@ -19,6 +19,10 @@ fn main() { let mut trials = Vec::new(); let mut add_trial = |test: &WastTest, config: WastConfig| { + if test.should_skip_entirely(&config) { + return; + } + let trial = Trial::test( format!( "{:?}/{}{}{}", diff --git a/winch/codegen/src/isa/aarch64/masm.rs b/winch/codegen/src/isa/aarch64/masm.rs index 2c1c171852b9..a4b773e86cd2 100644 --- a/winch/codegen/src/isa/aarch64/masm.rs +++ b/winch/codegen/src/isa/aarch64/masm.rs @@ -387,8 +387,12 @@ impl Masm for MacroAssembler { cc: IntCmpKind, _size: OperandSize, ) -> Result<()> { - self.asm.csel(src, dst.to_reg(), dst, Cond::from(cc)); - Ok(()) + match (src.class(), dst.to_reg().class()) { + (RegClass::Int, RegClass::Int) => { + Ok(self.asm.csel(src, dst.to_reg(), dst, Cond::from(cc))) + } + _ => Err(anyhow!(CodeGenError::invalid_operand_combination())), + } } fn add(&mut self, dst: WritableReg, lhs: Reg, rhs: RegImm, size: OperandSize) -> Result<()> {