summaryrefslogtreecommitdiff
path: root/test/wasm2asm/reinterpret.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/wasm2asm/reinterpret.wast')
-rw-r--r--test/wasm2asm/reinterpret.wast24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/wasm2asm/reinterpret.wast b/test/wasm2asm/reinterpret.wast
new file mode 100644
index 000000000..816fb90a3
--- /dev/null
+++ b/test/wasm2asm/reinterpret.wast
@@ -0,0 +1,24 @@
+(module
+ (func $dummy)
+
+ (func (export "i32_roundtrip") (param $0 i32) (result i32)
+ (i32.eq (i32.reinterpret (f32.reinterpret (get_local $0))) (get_local $0)))
+ (func (export "i64_roundtrip") (param $0 i64) (result i32)
+ (i64.eq (i64.reinterpret (f64.reinterpret (get_local $0))) (get_local $0)))
+)
+
+(assert_return (invoke "i32_roundtrip" (i32.const 0))
+ (i32.const 1))
+(assert_return (invoke "i32_roundtrip" (i32.const 1))
+ (i32.const 1))
+(assert_return (invoke "i32_roundtrip" (i32.const 100))
+ (i32.const 1))
+(assert_return (invoke "i32_roundtrip" (i32.const 10000))
+ (i32.const 1))
+
+(assert_return (invoke "i64_roundtrip" (i32.const 0) (i32.const 0))
+ (i32.const 1))
+(assert_return (invoke "i64_roundtrip" (i32.const 1) (i32.const 0))
+ (i32.const 1))
+(assert_return (invoke "i64_roundtrip" (i32.const 0) (i32.const 1))
+ (i32.const 1))