From fc6fadfc2ed350a29a81776d9544066e779d916b Mon Sep 17 00:00:00 2001 From: pjuftring Date: Sun, 18 Oct 2015 14:13:36 +0200 Subject: [PATCH 1/2] Test that 'page_size' returns a power of 2 --- ml-proto/TestingTodo.md | 2 +- ml-proto/test/resizing.wast | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ml-proto/TestingTodo.md b/ml-proto/TestingTodo.md index 734aeafbe0..7f96dec987 100644 --- a/ml-proto/TestingTodo.md +++ b/ml-proto/TestingTodo.md @@ -20,7 +20,7 @@ Operator semantics: - ~~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 a power of 2 + - ~~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 call and argument operands of call_indirect are evaluated left-to-right, too diff --git a/ml-proto/test/resizing.wast b/ml-proto/test/resizing.wast index 14e33935e5..f38d053f60 100644 --- a/ml-proto/test/resizing.wast +++ b/ml-proto/test/resizing.wast @@ -1,6 +1,11 @@ (module (memory 0) + (export "power_of_two" $power_of_two) + (func $power_of_two (result i32) + (i32.popcnt (page_size)) + ) + (export "round_up_to_page" $round_up_to_page) (func $round_up_to_page (param i32) (result i32) (i32.and (i32.add (get_local 0) (i32.sub (page_size) (i32.const 1))) @@ -31,6 +36,7 @@ (func $size (result i32) (memory_size)) ) +(assert_return (invoke "power_of_two") (i32.const 1)) (assert_return (invoke "size") (i32.const 0)) (assert_return (invoke "size_at_least" (i32.const 0)) (i32.const 1)) (assert_trap (invoke "store_at_zero") "runtime: out of bounds memory access") From 04d36d972bf8e2b1dad5a953afd4af0fb8b11ebc Mon Sep 17 00:00:00 2001 From: pjuftring Date: Sun, 18 Oct 2015 21:04:26 +0200 Subject: [PATCH 2/2] Test that conversion to float and back isnt folded Tests that conversions from i32/i64 to f32/f64 aren't folded away. --- ml-proto/TestingTodo.md | 4 ++-- ml-proto/test/float_exprs.wast | 36 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/ml-proto/TestingTodo.md b/ml-proto/TestingTodo.md index 7f96dec987..24bc8273c3 100644 --- a/ml-proto/TestingTodo.md +++ b/ml-proto/TestingTodo.md @@ -66,8 +66,8 @@ Function pointer semantics: Expression optimizer bait: - ~~test that `a+1