Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion binary-leb128.wast
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@
"\41\00" ;; i32.const 0
"\41\03" ;; i32.const 3
"\36" ;; i32.store
"\03" ;; alignment 2
"\02" ;; alignment 2
"\82\80\80\80\10" ;; offset 2 with unused bits set
"\0b" ;; end
)
Expand Down
33 changes: 31 additions & 2 deletions binary.wast
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@
(assert_malformed (module binary "\00asm" "\01\00\00\00" "\ff\00\01\00") "malformed section id")


;; Type section with signed LEB128 encoded type
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\01" ;; Type section id
"\05" ;; Type section length
"\01" ;; Types vector length
"\e0\7f" ;; Malformed functype, -0x20 in signed LEB128 encoding
"\00\00"
)
"integer representation too long"
)


;; call_indirect reserved byte equal to zero.
(assert_malformed
(module binary
Expand Down Expand Up @@ -773,8 +787,23 @@
"\09\07\02" ;; elem with inconsistent segment count (2 declared, 1 given)
"\00\41\00\0b\01\00" ;; elem 0
;; "\00\41\00\0b\01\00" ;; elem 1 (missed)
"\0a\04\01" ;; code section
"\02\00\0b" ;; function body
)
"unexpected end"
)

;; 2 elem segment declared, 1.5 given
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\01\04\01" ;; type section
"\60\00\00" ;; type 0
"\03\02\01\00" ;; func section
"\04\04\01" ;; table section
"\70\00\01" ;; table 0
"\09\07\02" ;; elem with inconsistent segment count (2 declared, 1 given)
"\00\41\00\0b\01\00" ;; elem 0
"\00\41\00" ;; elem 1 (partial)
;; "\0b\01\00" ;; elem 1 (missing part)
)
"unexpected end"
)
Expand Down
63 changes: 63 additions & 0 deletions data.wast
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,69 @@
"unknown memory"
)

;; Data segment with memory index 1 (only memory 0 available)
(assert_invalid
(module binary
"\00asm" "\01\00\00\00"
"\05\03\01" ;; memory section
"\00\00" ;; memory 0
"\0b\06\01" ;; data section
"\01\41\00\0b" ;; data segment 0 for memory 1
"\00" ;; empty vec(byte)
)
"unknown memory 1"
)

;; Data segment with memory index 1 (no memory section)
(assert_invalid
(module binary
"\00asm" "\01\00\00\00"
"\0b\06\01" ;; data section
"\01\41\00\0b" ;; data segment 0 for memory 1
"\00" ;; empty vec(byte)
)
"unknown memory 1"
)

;; Data segment with memory index 1 and vec(byte) as above,
;; only memory 0 available.
(assert_invalid
(module binary
"\00asm" "\01\00\00\00"
"\05\03\01" ;; memory section
"\00\00" ;; memory 0
"\0b\44\01" ;; data section
"\01" ;; memory index
"\41\00\0b" ;; offset constant expression
"\3e" ;; vec(byte) length
"\00\01\02\03\04\05\06\07\08\09\0a\0b\0c\0d\0e\0f"
"\10\11\12\13\14\15\16\17\18\19\1a\1b\1c\1d\1e\1f"
"\20\21\22\23\24\25\26\27\28\29\2a\2b\2c\2d\2e\2f"
"\30\31\32\33\34\35\36\37\38\39\3a\3b\3c\3d"
)
"unknown memory 1"
)

;; Data segment with memory index 1 and specially crafted vec(byte) after.
;; This is to detect incorrect validation where memory index is interpreted
;; as a flag followed by "\41" interpreted as the size of vec(byte)
;; with the expected number of bytes following.
(assert_invalid
(module binary
"\00asm" "\01\00\00\00"
"\0b\44\01" ;; data section
"\01" ;; memory index
"\41\00\0b" ;; offset constant expression
"\3e" ;; vec(byte) length
"\00\01\02\03\04\05\06\07\08\09\0a\0b\0c\0d\0e\0f"
"\10\11\12\13\14\15\16\17\18\19\1a\1b\1c\1d\1e\1f"
"\20\21\22\23\24\25\26\27\28\29\2a\2b\2c\2d\2e\2f"
"\30\31\32\33\34\35\36\37\38\39\3a\3b\3c\3d"
)
"unknown memory 1"
)


;; Invalid offsets

(assert_invalid
Expand Down
110 changes: 110 additions & 0 deletions proposals/simd/simd_i32x4_dot_i16x8.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
;; Tests for i32x4 arithmetic operations on major boundary values and all special values.


(module
(func (export "i32x4.dot_i16x8_s") (param v128 v128) (result v128) (i32x4.dot_i16x8_s (local.get 0) (local.get 1)))
)


;; i32x4.dot_i16x8_s
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 0 0 0 0 0 0 0 0)
(v128.const i16x8 0 0 0 0 0 0 0 0))
(v128.const i32x4 0 0 0 0))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 0 0 0 0 0 0 0 0)
(v128.const i16x8 1 1 1 1 1 1 1 1))
(v128.const i32x4 0 0 0 0))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 1 1 1 1 1 1 1 1)
(v128.const i16x8 1 1 1 1 1 1 1 1))
(v128.const i32x4 2 2 2 2))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 0 0 0 0 0 0 0 0)
(v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1))
(v128.const i32x4 0 0 0 0))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 1 1 1 1 1 1 1 1)
(v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1))
(v128.const i32x4 -2 -2 -2 -2))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1)
(v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1))
(v128.const i32x4 2 2 2 2))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 16383 16383 16383 16383 16383 16383 16383 16383)
(v128.const i16x8 16384 16384 16384 16384 16384 16384 16384 16384))
(v128.const i32x4 536838144 536838144 536838144 536838144))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 16384 16384 16384 16384 16384 16384 16384 16384)
(v128.const i16x8 16384 16384 16384 16384 16384 16384 16384 16384))
(v128.const i32x4 536870912 536870912 536870912 536870912))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -16383 -16383 -16383 -16383 -16383 -16383 -16383 -16383)
(v128.const i16x8 -16384 -16384 -16384 -16384 -16384 -16384 -16384 -16384))
(v128.const i32x4 536838144 536838144 536838144 536838144))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -16384 -16384 -16384 -16384 -16384 -16384 -16384 -16384)
(v128.const i16x8 -16384 -16384 -16384 -16384 -16384 -16384 -16384 -16384))
(v128.const i32x4 536870912 536870912 536870912 536870912))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -16385 -16385 -16385 -16385 -16385 -16385 -16385 -16385)
(v128.const i16x8 -16384 -16384 -16384 -16384 -16384 -16384 -16384 -16384))
(v128.const i32x4 536903680 536903680 536903680 536903680))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 32765 32765 32765 32765 32765 32765 32765 32765)
(v128.const i16x8 1 1 1 1 1 1 1 1))
(v128.const i32x4 65530 65530 65530 65530))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 32766 32766 32766 32766 32766 32766 32766 32766)
(v128.const i16x8 1 1 1 1 1 1 1 1))
(v128.const i32x4 65532 65532 65532 65532))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 32768 32768 32768 32768 32768 32768 32768 32768)
(v128.const i16x8 1 1 1 1 1 1 1 1))
(v128.const i32x4 -65536 -65536 -65536 -65536))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -32766 -32766 -32766 -32766 -32766 -32766 -32766 -32766)
(v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1))
(v128.const i32x4 65532 65532 65532 65532))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767)
(v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1))
(v128.const i32x4 65534 65534 65534 65534))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768)
(v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1))
(v128.const i32x4 65536 65536 65536 65536))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 32767 32767 32767 32767 32767 32767 32767 32767)
(v128.const i16x8 32767 32767 32767 32767 32767 32767 32767 32767))
(v128.const i32x4 2147352578 2147352578 2147352578 2147352578))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768)
(v128.const i16x8 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768))
(v128.const i32x4 2147483648 2147483648 2147483648 2147483648))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768)
(v128.const i16x8 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767))
(v128.const i32x4 2147418112 2147418112 2147418112 2147418112))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 65535 65535 65535 65535 65535 65535 65535 65535)
(v128.const i16x8 0 0 0 0 0 0 0 0))
(v128.const i32x4 0 0 0 0))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 65535 65535 65535 65535 65535 65535 65535 65535)
(v128.const i16x8 1 1 1 1 1 1 1 1))
(v128.const i32x4 -2 -2 -2 -2))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 65535 65535 65535 65535 65535 65535 65535 65535)
(v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1))
(v128.const i32x4 2 2 2 2))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 65535 65535 65535 65535 65535 65535 65535 65535)
(v128.const i16x8 32767 32767 32767 32767 32767 32767 32767 32767))
(v128.const i32x4 -65534 -65534 -65534 -65534))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 65535 65535 65535 65535 65535 65535 65535 65535)
(v128.const i16x8 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768))
(v128.const i32x4 65536 65536 65536 65536))
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 65535 65535 65535 65535 65535 65535 65535 65535)
(v128.const i16x8 65535 65535 65535 65535 65535 65535 65535 65535))
(v128.const i32x4 2 2 2 2))

;; type check
(assert_invalid (module (func (result v128) (i32x4.dot_i16x8_s (i32.const 0) (f32.const 0.0)))) "type mismatch")

;; Test operation with empty argument

(assert_invalid
(module
(func $i32x4.dot_i16x8_s-1st-arg-empty (result v128)
(i32x4.dot_i16x8_s (v128.const i32x4 0 0 0 0))
)
)
"type mismatch"
)
(assert_invalid
(module
(func $i32x4.dot_i16x8_s-arg-empty (result v128)
(i32x4.dot_i16x8_s)
)
)
"type mismatch"
)

Loading