v8/test/mjsunit/wasm/bulk-memory-spec/memory_fill.wast
Ben Smith 3c7bc08aec [wasm][bulk-memory] Add bulk memory spec tests
These are added as mjsunit tests for now since they haven't been merged
to the spec repo. When that happens, the wasm-spec-tests testsuite can
be updated to include these tests, and the tests in this directory can
be removed.

This CL also adds the test/mjsunit/wasm/bulk-memory-spec directory to a
list of directories that aren't checked for copyright (since these files
are auto-generated).

Bug: v8:7747
Change-Id: I906f2ca45f497a6728f94afb9b3330971e1d3fd5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1600363
Commit-Queue: Ben Smith <binji@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Sergiy Belozorov <sergiyb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61395}
2019-05-10 01:40:42 +00:00

674 lines
18 KiB
Plaintext

;;
;; Generated by ../meta/generate_memory_fill.js
;;
(module
(memory 1 1)
(func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
(loop $cont
(if (i32.eq (local.get $from) (local.get $to))
(then
(return (i32.const -1))))
(if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
(then
(local.set $from (i32.add (local.get $from) (i32.const 1)))
(br $cont))))
(return (local.get $from)))
(func (export "test")
(memory.fill (i32.const 0xFF00) (i32.const 0x55) (i32.const 256))))
(invoke "test")
(assert_return (invoke "checkRange" (i32.const 0) (i32.const 65280) (i32.const 0))
(i32.const -1))
(assert_return (invoke "checkRange" (i32.const 65280) (i32.const 65536) (i32.const 85))
(i32.const -1))
(module
(memory 1 1)
(func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
(loop $cont
(if (i32.eq (local.get $from) (local.get $to))
(then
(return (i32.const -1))))
(if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
(then
(local.set $from (i32.add (local.get $from) (i32.const 1)))
(br $cont))))
(return (local.get $from)))
(func (export "test")
(memory.fill (i32.const 0xFF00) (i32.const 0x55) (i32.const 257))))
(assert_trap (invoke "test") "out of bounds memory access")
(module
(memory 1 1)
(func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
(loop $cont
(if (i32.eq (local.get $from) (local.get $to))
(then
(return (i32.const -1))))
(if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
(then
(local.set $from (i32.add (local.get $from) (i32.const 1)))
(br $cont))))
(return (local.get $from)))
(func (export "test")
(memory.fill (i32.const 0xFFFFFF00) (i32.const 0x55) (i32.const 257))))
(assert_trap (invoke "test") "out of bounds memory access")
(module
(memory 1 1)
(func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
(loop $cont
(if (i32.eq (local.get $from) (local.get $to))
(then
(return (i32.const -1))))
(if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
(then
(local.set $from (i32.add (local.get $from) (i32.const 1)))
(br $cont))))
(return (local.get $from)))
(func (export "test")
(memory.fill (i32.const 0x12) (i32.const 0x55) (i32.const 0))))
(invoke "test")
(assert_return (invoke "checkRange" (i32.const 0) (i32.const 65536) (i32.const 0))
(i32.const -1))
(module
(memory 1 1)
(func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
(loop $cont
(if (i32.eq (local.get $from) (local.get $to))
(then
(return (i32.const -1))))
(if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
(then
(local.set $from (i32.add (local.get $from) (i32.const 1)))
(br $cont))))
(return (local.get $from)))
(func (export "test")
(memory.fill (i32.const 0x10000) (i32.const 0x55) (i32.const 0))))
(invoke "test")
(module
(memory 1 1)
(func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
(loop $cont
(if (i32.eq (local.get $from) (local.get $to))
(then
(return (i32.const -1))))
(if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
(then
(local.set $from (i32.add (local.get $from) (i32.const 1)))
(br $cont))))
(return (local.get $from)))
(func (export "test")
(memory.fill (i32.const 0x1) (i32.const 0xAA) (i32.const 0xFFFE))))
(invoke "test")
(assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0))
(i32.const -1))
(assert_return (invoke "checkRange" (i32.const 1) (i32.const 65535) (i32.const 170))
(i32.const -1))
(assert_return (invoke "checkRange" (i32.const 65535) (i32.const 65536) (i32.const 0))
(i32.const -1))
(module
(memory 1 1)
(func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
(loop $cont
(if (i32.eq (local.get $from) (local.get $to))
(then
(return (i32.const -1))))
(if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
(then
(local.set $from (i32.add (local.get $from) (i32.const 1)))
(br $cont))))
(return (local.get $from)))
(func (export "test")
(memory.fill (i32.const 0x12) (i32.const 0x55) (i32.const 10))
(memory.fill (i32.const 0x15) (i32.const 0xAA) (i32.const 4))))
(invoke "test")
(assert_return (invoke "checkRange" (i32.const 0) (i32.const 18) (i32.const 0))
(i32.const -1))
(assert_return (invoke "checkRange" (i32.const 18) (i32.const 21) (i32.const 85))
(i32.const -1))
(assert_return (invoke "checkRange" (i32.const 21) (i32.const 25) (i32.const 170))
(i32.const -1))
(assert_return (invoke "checkRange" (i32.const 25) (i32.const 28) (i32.const 85))
(i32.const -1))
(assert_return (invoke "checkRange" (i32.const 28) (i32.const 65536) (i32.const 0))
(i32.const -1))
(assert_invalid
(module
(func (export "testfn")
(memory.fill (i32.const 10) (i32.const 20) (i32.const 30))))
"unknown memory 0")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (i32.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (i32.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (i32.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (f32.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (f32.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (f32.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (f32.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (i64.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (i64.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (i64.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (i64.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (f64.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (f64.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (f64.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i32.const 10) (f64.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (i32.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (i32.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (i32.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (i32.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (f32.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (f32.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (f32.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (f32.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (i64.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (i64.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (i64.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (i64.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (f64.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (f64.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (f64.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f32.const 10) (f64.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (i32.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (i32.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (i32.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (i32.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (f32.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (f32.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (f32.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (f32.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (i64.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (i64.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (i64.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (i64.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (f64.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (f64.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (f64.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (i64.const 10) (f64.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (i32.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (i32.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (i32.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (i32.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (f32.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (f32.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (f32.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (f32.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (i64.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (i64.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (i64.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (i64.const 20) (f64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (f64.const 20) (i32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (f64.const 20) (f32.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (f64.const 20) (i64.const 30))))
"type mismatch")
(assert_invalid
(module
(memory 1 1)
(func (export "testfn")
(memory.fill (f64.const 10) (f64.const 20) (f64.const 30))))
"type mismatch")
(module
(memory 1 1 )
(func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
(loop $cont
(if (i32.eq (local.get $from) (local.get $to))
(then
(return (i32.const -1))))
(if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
(then
(local.set $from (i32.add (local.get $from) (i32.const 1)))
(br $cont))))
(return (local.get $from)))
(func (export "run") (param $offs i32) (param $val i32) (param $len i32)
(memory.fill (local.get $offs) (local.get $val) (local.get $len))))
(assert_trap (invoke "run" (i32.const 65280) (i32.const 37) (i32.const 512))
"out of bounds")
(assert_return (invoke "checkRange" (i32.const 65280) (i32.const 65536) (i32.const 37))
(i32.const -1))
(assert_return (invoke "checkRange" (i32.const 0) (i32.const 65280) (i32.const 0))
(i32.const -1))
(module
(memory 1 1 )
(func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
(loop $cont
(if (i32.eq (local.get $from) (local.get $to))
(then
(return (i32.const -1))))
(if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
(then
(local.set $from (i32.add (local.get $from) (i32.const 1)))
(br $cont))))
(return (local.get $from)))
(func (export "run") (param $offs i32) (param $val i32) (param $len i32)
(memory.fill (local.get $offs) (local.get $val) (local.get $len))))
(assert_trap (invoke "run" (i32.const 65279) (i32.const 37) (i32.const 514))
"out of bounds")
(assert_return (invoke "checkRange" (i32.const 65279) (i32.const 65536) (i32.const 37))
(i32.const -1))
(assert_return (invoke "checkRange" (i32.const 0) (i32.const 65279) (i32.const 0))
(i32.const -1))
(module
(memory 1 1 )
(func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
(loop $cont
(if (i32.eq (local.get $from) (local.get $to))
(then
(return (i32.const -1))))
(if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
(then
(local.set $from (i32.add (local.get $from) (i32.const 1)))
(br $cont))))
(return (local.get $from)))
(func (export "run") (param $offs i32) (param $val i32) (param $len i32)
(memory.fill (local.get $offs) (local.get $val) (local.get $len))))
(assert_trap (invoke "run" (i32.const 65279) (i32.const 37) (i32.const 4294967295))
"out of bounds")
(assert_return (invoke "checkRange" (i32.const 65279) (i32.const 65536) (i32.const 37))
(i32.const -1))
(assert_return (invoke "checkRange" (i32.const 0) (i32.const 65279) (i32.const 0))
(i32.const -1))