summaryrefslogtreecommitdiff
path: root/test/wasm2js/i64-rotate.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/wasm2js/i64-rotate.wast')
-rw-r--r--test/wasm2js/i64-rotate.wast70
1 files changed, 70 insertions, 0 deletions
diff --git a/test/wasm2js/i64-rotate.wast b/test/wasm2js/i64-rotate.wast
new file mode 100644
index 000000000..7de93b381
--- /dev/null
+++ b/test/wasm2js/i64-rotate.wast
@@ -0,0 +1,70 @@
+;; Testing i64 rotates
+
+(module
+ (func $dummy)
+
+ (func (export "rotl") (param $0 i64) (param $1 i64) (param $2 i64) (result i32)
+ (i64.eq (i64.rotl (get_local $0) (get_local $1)) (get_local $2)))
+ (func (export "rotr") (param $0 i64) (param $1 i64) (param $2 i64) (result i32)
+ (i64.eq (i64.rotr (get_local $0) (get_local $1)) (get_local $2)))
+)
+
+(assert_return (invoke "rotl" (i32.const 0) (i32.const 0)
+ (i32.const 0) (i32.const 0)
+ (i32.const 0) (i32.const 0))
+ (i32.const 1))
+(assert_return (invoke "rotl" (i32.const 1) (i32.const 0)
+ (i32.const 1) (i32.const 0)
+ (i32.const 2) (i32.const 0))
+ (i32.const 1))
+(assert_return (invoke "rotl" (i32.const 1) (i32.const 0)
+ (i32.const 31) (i32.const 0)
+ (i32.const 2147483648) (i32.const 0))
+ (i32.const 1))
+(assert_return (invoke "rotl" (i32.const 1) (i32.const 0)
+ (i32.const 32) (i32.const 0)
+ (i32.const 0) (i32.const 1))
+ (i32.const 1))
+(assert_return (invoke "rotl" (i32.const 1) (i32.const 0)
+ (i32.const 33) (i32.const 0)
+ (i32.const 0) (i32.const 2))
+ (i32.const 1))
+
+(assert_return (invoke "rotl" (i32.const 1) (i32.const 1)
+ (i32.const 1) (i32.const 0)
+ (i32.const 2) (i32.const 2))
+ (i32.const 1))
+(assert_return (invoke "rotl" (i32.const 1) (i32.const 1)
+ (i32.const 31) (i32.const 0)
+ (i32.const 2147483648) (i32.const 2147483648))
+ (i32.const 1))
+(assert_return (invoke "rotl" (i32.const 1) (i32.const 1)
+ (i32.const 32) (i32.const 0)
+ (i32.const 1) (i32.const 1))
+ (i32.const 1))
+(assert_return (invoke "rotl" (i32.const 1) (i32.const 1)
+ (i32.const 33) (i32.const 0)
+ (i32.const 2) (i32.const 2))
+ (i32.const 1))
+
+
+(assert_return (invoke "rotr" (i32.const 0) (i32.const 0)
+ (i32.const 0) (i32.const 0)
+ (i32.const 0) (i32.const 0))
+ (i32.const 1))
+(assert_return (invoke "rotr" (i32.const 1) (i32.const 0)
+ (i32.const 1) (i32.const 0)
+ (i32.const 0) (i32.const 2147483648))
+ (i32.const 1))
+(assert_return (invoke "rotr" (i32.const 1) (i32.const 0)
+ (i32.const 31) (i32.const 0)
+ (i32.const 0) (i32.const 2))
+ (i32.const 1))
+(assert_return (invoke "rotr" (i32.const 1) (i32.const 0)
+ (i32.const 32) (i32.const 0)
+ (i32.const 0) (i32.const 1))
+ (i32.const 1))
+(assert_return (invoke "rotr" (i32.const 1) (i32.const 0)
+ (i32.const 33) (i32.const 0)
+ (i32.const 2147483648) (i32.const 0))
+ (i32.const 1))