diff --git a/ml-proto/TestingTodo.md b/ml-proto/TestingTodo.md index 39026d9eb6..063fbc64b3 100644 --- a/ml-proto/TestingTodo.md +++ b/ml-proto/TestingTodo.md @@ -6,6 +6,7 @@ welcome. Misc semantics: - ~~test that linear memory is little-endian for all integers and floats~~ + - test that 8-bit, 16-bit, and 32-bit atomic operations are lock-free (is this possible?) - test that unaligned and misaligned accesses work, even if slow - ~~test that runaway recursion traps~~ - test that too-big linear memory resize fails appropriately @@ -16,22 +17,26 @@ Misc semantics: Operator semantics: - test that promote/demote, sext/trunc, zext/trunc is bit-preserving if not NaN - ~~test that clz/ctz handle zero~~ - - test that numbers slightly outside of the int32 range round into the int32 range in floating-to-int32 conversion + - ~~test that numbers slightly outside of the int32 range round into the int32 range in floating-to-int32 conversion~~ - ~~test that neg, abs, copysign, reinterpretcast, store+load, set+get, preserve the sign bit and significand bits of NaN and don't canonicalize~~ - ~~test that shifts don't mask their shift count. 32 is particularly nice to test.~~ - - test that `page_size` returns something sane [(power of 2?)](https://github.com/WebAssembly/design/pull/296) + - test that `page_size` returns a power of 2 - ~~test that arithmetic operands are evaluated left-to-right~~ + - test that call and store operands are evaluated left-to-right too - ~~test that add/sub/mul/wrap/wrapping-store silently wrap on overflow~~ - ~~test that sdiv/udiv/srem/urem trap on divide-by-zero~~ - ~~test that sdiv traps on overflow~~ - ~~test that srem doesn't trap when the corresponding sdiv would overflow~~ - ~~test that float-to-integer conversion traps on overflow and invalid~~ - ~~test that unsigned operations are properly unsigned~~ + - ~~test that signed integer div rounds toward zero~~ + - ~~test that signed integer mod has the sign of the dividend~~ Floating point semantics: - ~~test for round-to-nearest rounding~~ - ~~test for ties-to-even rounding~~ - ~~test that all operations with floating point inputs correctly handle all their NaN, -0, 0, Infinity, and -Infinity special cases~~ + - ~~test that signaling NaN is indistinguishable from quiet NaN~~ - ~~test that all operations that can overflow produce Infinity and with the correct sign~~ - ~~test that all operations that can divide by zero produce Infinity with the correct sign~~ - ~~test that all operations that can have an invalid produce NaN~~ @@ -40,6 +45,7 @@ Floating point semantics: - ~~test that signalling NaN doesn't cause weirdness~~ - ~~test that signalling/quiet NaNs can have sign bits and payloads in literals~~ - test that conversion from int32/int64 to float32 rounds correctly + - test that [relaxed optimizations](https://gcc.gnu.org/wiki/FloatingPointMath) are not done Linear memory semantics: - test that loading from null works @@ -50,37 +56,43 @@ Linear memory semantics: - test that loadwithoffset traps in overflow cases - test that newly allocated memory is zeroed - test that resize_memory does a full 32-bit unsigned check for page_size divisibility + - test that load/store addreses are full int32 (or int64), and not OCaml int + - test that when allocating 4GiB, accessing index -1 fails Function pointer semantics: - test that function pointers work [correctly](https://github.com/WebAssembly/design/issues/89) Expression optimizer bait: - - test that `a+1>n is not folded to x + +(module + (func $i32.no_fold_shl_shr_s (param $x i32) (result i32) + (i32.shr_s (i32.shl (get_local $x) (i32.const 1)) (i32.const 1))) + (export "i32.no_fold_shl_shr_s" $i32.no_fold_shl_shr_s) + (func $i32.no_fold_shl_shr_u (param $x i32) (result i32) + (i32.shr_u (i32.shl (get_local $x) (i32.const 1)) (i32.const 1))) + (export "i32.no_fold_shl_shr_u" $i32.no_fold_shl_shr_u) + + (func $i64.no_fold_shl_shr_s (param $x i64) (result i64) + (i64.shr_s (i64.shl (get_local $x) (i64.const 1)) (i64.const 1))) + (export "i64.no_fold_shl_shr_s" $i64.no_fold_shl_shr_s) + (func $i64.no_fold_shl_shr_u (param $x i64) (result i64) + (i64.shr_u (i64.shl (get_local $x) (i64.const 1)) (i64.const 1))) + (export "i64.no_fold_shl_shr_u" $i64.no_fold_shl_shr_u) +) + +(assert_return (invoke "i32.no_fold_shl_shr_s" (i32.const 0x80000000)) (i32.const 0)) +(assert_return (invoke "i32.no_fold_shl_shr_u" (i32.const 0x80000000)) (i32.const 0)) +(assert_return (invoke "i64.no_fold_shl_shr_s" (i64.const 0x8000000000000000)) (i64.const 0)) +(assert_return (invoke "i64.no_fold_shl_shr_u" (i64.const 0x8000000000000000)) (i64.const 0)) + +;; Test that x>>n<