summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/spec/select.wast
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/wasm/spec/select.wast
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/wasm/spec/select.wast')
-rw-r--r--js/src/jit-test/tests/wasm/spec/select.wast57
1 files changed, 57 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/spec/select.wast b/js/src/jit-test/tests/wasm/spec/select.wast
new file mode 100644
index 000000000..a2406017f
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/spec/select.wast
@@ -0,0 +1,57 @@
+(module
+ (func (export "select_i32") (param $lhs i32) (param $rhs i32) (param $cond i32) (result i32)
+ (select (get_local $lhs) (get_local $rhs) (get_local $cond)))
+
+ (func (export "select_i64") (param $lhs i64) (param $rhs i64) (param $cond i32) (result i64)
+ (select (get_local $lhs) (get_local $rhs) (get_local $cond)))
+
+ (func (export "select_f32") (param $lhs f32) (param $rhs f32) (param $cond i32) (result f32)
+ (select (get_local $lhs) (get_local $rhs) (get_local $cond)))
+
+ (func (export "select_f64") (param $lhs f64) (param $rhs f64) (param $cond i32) (result f64)
+ (select (get_local $lhs) (get_local $rhs) (get_local $cond)))
+
+ ;; Check that both sides of the select are evaluated
+ (func (export "select_trap_l") (param $cond i32) (result i32)
+ (select (unreachable) (i32.const 0) (get_local $cond)))
+ (func (export "select_trap_r") (param $cond i32) (result i32)
+ (select (i32.const 0) (unreachable) (get_local $cond)))
+)
+
+(assert_return (invoke "select_i32" (i32.const 1) (i32.const 2) (i32.const 1)) (i32.const 1))
+(assert_return (invoke "select_i64" (i64.const 2) (i64.const 1) (i32.const 1)) (i64.const 2))
+(assert_return (invoke "select_f32" (f32.const 1) (f32.const 2) (i32.const 1)) (f32.const 1))
+(assert_return (invoke "select_f64" (f64.const 1) (f64.const 2) (i32.const 1)) (f64.const 1))
+
+(assert_return (invoke "select_i32" (i32.const 1) (i32.const 2) (i32.const 0)) (i32.const 2))
+(assert_return (invoke "select_i32" (i32.const 2) (i32.const 1) (i32.const 0)) (i32.const 1))
+(assert_return (invoke "select_i64" (i64.const 2) (i64.const 1) (i32.const -1)) (i64.const 2))
+(assert_return (invoke "select_i64" (i64.const 2) (i64.const 1) (i32.const 0xf0f0f0f0)) (i64.const 2))
+
+(assert_return (invoke "select_f32" (f32.const nan) (f32.const 1) (i32.const 1)) (f32.const nan))
+(assert_return (invoke "select_f32" (f32.const nan:0x20304) (f32.const 1) (i32.const 1)) (f32.const nan:0x20304))
+(assert_return (invoke "select_f32" (f32.const nan) (f32.const 1) (i32.const 0)) (f32.const 1))
+(assert_return (invoke "select_f32" (f32.const nan:0x20304) (f32.const 1) (i32.const 0)) (f32.const 1))
+(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan) (i32.const 1)) (f32.const 2))
+(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan:0x20304) (i32.const 1)) (f32.const 2))
+(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan) (i32.const 0)) (f32.const nan))
+(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan:0x20304) (i32.const 0)) (f32.const nan:0x20304))
+
+(assert_return (invoke "select_f64" (f64.const nan) (f64.const 1) (i32.const 1)) (f64.const nan))
+(assert_return (invoke "select_f64" (f64.const nan:0x20304) (f64.const 1) (i32.const 1)) (f64.const nan:0x20304))
+(assert_return (invoke "select_f64" (f64.const nan) (f64.const 1) (i32.const 0)) (f64.const 1))
+(assert_return (invoke "select_f64" (f64.const nan:0x20304) (f64.const 1) (i32.const 0)) (f64.const 1))
+(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan) (i32.const 1)) (f64.const 2))
+(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan:0x20304) (i32.const 1)) (f64.const 2))
+(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan) (i32.const 0)) (f64.const nan))
+(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan:0x20304) (i32.const 0)) (f64.const nan:0x20304))
+
+(assert_trap (invoke "select_trap_l" (i32.const 1)) "unreachable executed")
+(assert_trap (invoke "select_trap_l" (i32.const 0)) "unreachable executed")
+(assert_trap (invoke "select_trap_r" (i32.const 1)) "unreachable executed")
+(assert_trap (invoke "select_trap_r" (i32.const 0)) "unreachable executed")
+
+(assert_invalid
+ (module (func $arity-0 (select (nop) (nop) (i32.const 1))))
+ "type mismatch"
+)