diff options
Diffstat (limited to 'test')
49 files changed, 3103 insertions, 591 deletions
diff --git a/test/binaryen.js/expressions.js b/test/binaryen.js/expressions.js index 40d4194fd..71846f3c6 100644 --- a/test/binaryen.js/expressions.js +++ b/test/binaryen.js/expressions.js @@ -476,7 +476,7 @@ console.log("# GlobalSet"); console.log("# MemorySize"); (function testMemorySize() { const module = new binaryen.Module(); - + module.setMemory(1, 1, null); var type = binaryen.i32; const theMemorySize = binaryen.MemorySize(module.memory.size()); assert(theMemorySize instanceof binaryen.MemorySize); @@ -492,7 +492,7 @@ console.log("# MemorySize"); assert( theMemorySize.toText() == - "(memory.size)\n" + "(memory.size $0)\n" ); module.dispose(); @@ -501,6 +501,7 @@ console.log("# MemorySize"); console.log("# MemoryGrow"); (function testMemoryGrow() { const module = new binaryen.Module(); + module.setMemory(1, 1, null); var type = binaryen.i32; var delta = module.i32.const(1); @@ -521,7 +522,7 @@ console.log("# MemoryGrow"); assert( theMemoryGrow.toText() == - "(memory.grow\n (i32.const 2)\n)\n" + "(memory.grow $0\n (i32.const 2)\n)\n" ); module.dispose(); @@ -530,6 +531,7 @@ console.log("# MemoryGrow"); console.log("# Load"); (function testLoad() { const module = new binaryen.Module(); + module.setMemory(1, 1, null); var offset = 16; var align = 2; @@ -566,7 +568,7 @@ console.log("# Load"); assert( theLoad.toText() == - "(i64.atomic.load offset=32 align=4\n (i32.const 128)\n)\n" + "(i64.atomic.load $0 offset=32 align=4\n (i32.const 128)\n)\n" ); module.dispose(); @@ -575,6 +577,7 @@ console.log("# Load"); console.log("# Store"); (function testStore() { const module = new binaryen.Module(); + module.setMemory(1, 1, null); var offset = 16; var align = 2; @@ -615,7 +618,7 @@ console.log("# Store"); assert( theStore.toText() == - "(i64.atomic.store offset=32 align=4\n (i32.const 128)\n (i32.const 2)\n)\n" + "(i64.atomic.store $0 offset=32 align=4\n (i32.const 128)\n (i32.const 2)\n)\n" ); module.dispose(); @@ -822,6 +825,7 @@ console.log("# Return"); console.log("# AtomicRMW"); (function testAtomicRMW() { const module = new binaryen.Module(); + module.setMemory(1, 1, null); var op = binaryen.Operations.AtomicRMWAdd; var offset = 8; @@ -855,7 +859,7 @@ console.log("# AtomicRMW"); assert( theAtomicRMW.toText() == - "(i64.atomic.rmw16.sub_u offset=16\n (i32.const 4)\n (i64.const 5)\n)\n" + "(i64.atomic.rmw16.sub_u $0 offset=16\n (i32.const 4)\n (i64.const 5)\n)\n" ); module.dispose(); @@ -864,6 +868,7 @@ console.log("# AtomicRMW"); console.log("# AtomicCmpxchg"); (function testAtomicCmpxchg() { const module = new binaryen.Module(); + module.setMemory(1, 1, null); var offset = 8; var ptr = module.i32.const(2); @@ -897,7 +902,7 @@ console.log("# AtomicCmpxchg"); assert( theAtomicCmpxchg.toText() == - "(i64.atomic.rmw16.cmpxchg_u offset=16\n (i32.const 5)\n (i64.const 6)\n (i64.const 7)\n)\n" + "(i64.atomic.rmw16.cmpxchg_u $0 offset=16\n (i32.const 5)\n (i64.const 6)\n (i64.const 7)\n)\n" ); module.dispose(); @@ -906,6 +911,7 @@ console.log("# AtomicCmpxchg"); console.log("# AtomicWait"); (function testAtomicWait() { const module = new binaryen.Module(); + module.setMemory(1, 1, null); var ptr = module.i32.const(2); var expected = module.i32.const(3); @@ -935,7 +941,7 @@ console.log("# AtomicWait"); assert( theAtomicWait.toText() == - "(memory.atomic.wait64\n (i32.const 5)\n (i32.const 6)\n (i64.const 7)\n)\n" + "(memory.atomic.wait64 $0\n (i32.const 5)\n (i32.const 6)\n (i64.const 7)\n)\n" ); module.dispose(); @@ -944,6 +950,7 @@ console.log("# AtomicWait"); console.log("# AtomicNotify"); (function testAtomicNotify() { const module = new binaryen.Module(); + module.setMemory(1, 1, null); var ptr = module.i32.const(1); var notifyCount = module.i32.const(2); @@ -966,7 +973,7 @@ console.log("# AtomicNotify"); assert( theAtomicNotify.toText() == - "(memory.atomic.notify\n (i32.const 3)\n (i32.const 4)\n)\n" + "(memory.atomic.notify $0\n (i32.const 3)\n (i32.const 4)\n)\n" ); module.dispose(); @@ -1172,6 +1179,7 @@ console.log("# SIMDShift"); console.log("# SIMDLoad"); (function testSIMDLoad() { const module = new binaryen.Module(); + module.setMemory(1, 1, null); var op = binaryen.Operations.Load8x8SVec128; var offset = 16; @@ -1201,7 +1209,7 @@ console.log("# SIMDLoad"); assert( theSIMDLoad.toText() == - "(v128.load8_splat offset=32 align=4\n (i32.const 2)\n)\n" + "(v128.load8_splat $0 offset=32 align=4\n (i32.const 2)\n)\n" ); module.dispose(); @@ -1210,6 +1218,7 @@ console.log("# SIMDLoad"); console.log("# SIMDLoadStoreLane"); (function testSIMDLoadStoreLane() { const module = new binaryen.Module(); + module.setMemory(1, 1, null); var op = binaryen.Operations.Load8LaneVec128; var offset = 16; @@ -1249,7 +1258,7 @@ console.log("# SIMDLoadStoreLane"); assert( theSIMDLoadStoreLane.toText() == - "(v128.load16_lane offset=32 2\n (i32.const 2)\n (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101)\n)\n" + "(v128.load16_lane $0 offset=32 2\n (i32.const 2)\n (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101)\n)\n" ); theSIMDLoadStoreLane.op = op = binaryen.Operations.Store16LaneVec128; @@ -1263,7 +1272,7 @@ console.log("# SIMDLoadStoreLane"); assert( theSIMDLoadStoreLane.toText() == - "(v128.store16_lane offset=32 2\n (i32.const 2)\n (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101)\n)\n" + "(v128.store16_lane $0 offset=32 2\n (i32.const 2)\n (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101)\n)\n" ); module.dispose(); @@ -1272,6 +1281,7 @@ console.log("# SIMDLoadStoreLane"); console.log("# MemoryInit"); (function testMemoryInit() { const module = new binaryen.Module(); + module.setMemory(1, 1, null); var segment = 1; var dest = module.i32.const(2); @@ -1302,7 +1312,7 @@ console.log("# MemoryInit"); assert( theMemoryInit.toText() == - "(memory.init 5\n (i32.const 6)\n (i32.const 7)\n (i32.const 8)\n)\n" + "(memory.init $0 5\n (i32.const 6)\n (i32.const 7)\n (i32.const 8)\n)\n" ); module.dispose(); @@ -1338,6 +1348,7 @@ console.log("# DataDrop"); console.log("# MemoryCopy"); (function testMemoryCopy() { const module = new binaryen.Module(); + module.setMemory(1, 1, null); var dest = module.i32.const(1); var source = module.i32.const(2); @@ -1364,7 +1375,7 @@ console.log("# MemoryCopy"); assert( theMemoryCopy.toText() == - "(memory.copy\n (i32.const 4)\n (i32.const 5)\n (i32.const 6)\n)\n" + "(memory.copy $0 $0\n (i32.const 4)\n (i32.const 5)\n (i32.const 6)\n)\n" ); module.dispose(); @@ -1373,6 +1384,7 @@ console.log("# MemoryCopy"); console.log("# MemoryFill"); (function testMemoryFill() { const module = new binaryen.Module(); + module.setMemory(1, 1, null); var dest = module.i32.const(1); var value = module.i32.const(2); @@ -1399,7 +1411,7 @@ console.log("# MemoryFill"); assert( theMemoryFill.toText() == - "(memory.fill\n (i32.const 4)\n (i32.const 5)\n (i32.const 6)\n)\n" + "(memory.fill $0\n (i32.const 4)\n (i32.const 5)\n (i32.const 6)\n)\n" ); module.dispose(); diff --git a/test/binaryen.js/expressions.js.txt b/test/binaryen.js/expressions.js.txt index b9107f5c1..fbf69888a 100644 --- a/test/binaryen.js/expressions.js.txt +++ b/test/binaryen.js/expressions.js.txt @@ -65,20 +65,20 @@ ) # MemorySize -(memory.size) +(memory.size $0) # MemoryGrow -(memory.grow +(memory.grow $0 (i32.const 2) ) # Load -(i64.atomic.load offset=32 align=4 +(i64.atomic.load $0 offset=32 align=4 (i32.const 128) ) # Store -(i64.atomic.store offset=32 align=4 +(i64.atomic.store $0 offset=32 align=4 (i32.const 128) (i32.const 2) ) @@ -115,27 +115,27 @@ ) # AtomicRMW -(i64.atomic.rmw16.sub_u offset=16 +(i64.atomic.rmw16.sub_u $0 offset=16 (i32.const 4) (i64.const 5) ) # AtomicCmpxchg -(i64.atomic.rmw16.cmpxchg_u offset=16 +(i64.atomic.rmw16.cmpxchg_u $0 offset=16 (i32.const 5) (i64.const 6) (i64.const 7) ) # AtomicWait -(memory.atomic.wait64 +(memory.atomic.wait64 $0 (i32.const 5) (i32.const 6) (i64.const 7) ) # AtomicNotify -(memory.atomic.notify +(memory.atomic.notify $0 (i32.const 3) (i32.const 4) ) @@ -175,23 +175,23 @@ ) # SIMDLoad -(v128.load8_splat offset=32 align=4 +(v128.load8_splat $0 offset=32 align=4 (i32.const 2) ) # SIMDLoadStoreLane -(v128.load16_lane offset=32 2 +(v128.load16_lane $0 offset=32 2 (i32.const 2) (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101) ) -(v128.store16_lane offset=32 2 +(v128.store16_lane $0 offset=32 2 (i32.const 2) (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101) ) # MemoryInit -(memory.init 5 +(memory.init $0 5 (i32.const 6) (i32.const 7) (i32.const 8) @@ -201,14 +201,14 @@ (data.drop 2) # MemoryCopy -(memory.copy +(memory.copy $0 $0 (i32.const 4) (i32.const 5) (i32.const 6) ) # MemoryFill -(memory.fill +(memory.fill $0 (i32.const 4) (i32.const 5) (i32.const 6) diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index 59f398da9..95c2568e6 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -178,6 +178,19 @@ function test_core() { // Module creation module = new binaryen.Module(); + // Memory + module.setMemory(1, 256, "mem", [ + { + passive: false, + offset: module.i32.const(10), + data: "hello, world".split('').map(function(x) { return x.charCodeAt(0) }) + }, + { + passive: true, + offset: null, + data: "I am passive".split('').map(function(x) { return x.charCodeAt(0) }) + } + ], true); // Create a tag var tag = module.addTag("a-tag", binaryen.i32, binaryen.none); @@ -723,21 +736,6 @@ function test_core() { assert(module.getNumTables() === 1); assert(module.getNumElementSegments() === 1); - // Memory. One per module - - module.setMemory(1, 256, "mem", [ - { - passive: false, - offset: module.i32.const(10), - data: "hello, world".split('').map(function(x) { return x.charCodeAt(0) }) - }, - { - passive: true, - offset: null, - data: "I am passive".split('').map(function(x) { return x.charCodeAt(0) }) - } - ], true); - // Start function. One per module var starter = module.addFunction("starter", binaryen.none, binaryen.none, [], module.nop()); module.setStart(starter); @@ -1141,6 +1139,7 @@ function test_for_each() { function test_expression_info() { module = new binaryen.Module(); + module.setMemory(1, 1, null); // Issue #2392 console.log("getExpressionInfo(memory.grow)=" + JSON.stringify(binaryen.getExpressionInfo(module.memory.grow(1)))); diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index 2a5a05fe8..1be13aefe 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -130,10 +130,10 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (table $t0 1 funcref) (elem $e0 (i32.const 0) "$kitchen()sinker") (tag $a-tag (param i32)) + (export "mem" (memory $0)) (export "kitchen_sinker" (func "$kitchen()sinker")) (export "a-global-exp" (global $a-global)) (export "a-tag-exp" (tag $a-tag)) - (export "mem" (memory $0)) (start $starter) (func "$kitchen()sinker" (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32) (local $4 i32) @@ -2234,10 +2234,10 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (table $t0 1 funcref) (elem $e0 (i32.const 0) "$kitchen()sinker") (tag $a-tag (param i32)) + (export "mem" (memory $0)) (export "kitchen_sinker" (func "$kitchen()sinker")) (export "a-global-exp" (global $a-global)) (export "a-tag-exp" (tag $a-tag)) - (export "mem" (memory $0)) (start $starter) (func "$kitchen()sinker" (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32) (local $4 i32) diff --git a/test/binaryen.js/memory-info.js.txt b/test/binaryen.js/memory-info.js.txt index 39d1290ae..ba04d7442 100644 --- a/test/binaryen.js/memory-info.js.txt +++ b/test/binaryen.js/memory-info.js.txt @@ -3,7 +3,7 @@ true {"module":"","base":"","initial":1,"shared":false,"max":64} true {"module":"","base":"","initial":1,"shared":true,"max":64} -false +true {"module":"env","base":"memory","initial":0,"shared":false,"max":65536} -false +true {"module":"env","base":"memory","initial":0,"shared":true,"max":65536} diff --git a/test/binaryen.js/sideffects.js b/test/binaryen.js/sideffects.js index e3187041d..be5414aed 100644 --- a/test/binaryen.js/sideffects.js +++ b/test/binaryen.js/sideffects.js @@ -17,6 +17,7 @@ console.log("SideEffects.TrapsNeverHappen=" + binaryen.SideEffects.TrapsNeverHap console.log("SideEffects.Any=" + binaryen.SideEffects.Any); var module = new binaryen.Module(); +module.setMemory(1, 1, null); assert( binaryen.getSideEffects( module.i32.const(1), diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index dab64522a..cb8349f89 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -160,7 +160,7 @@ BinaryenExpressionRef makeMemoryInit(BinaryenModuleRef module) { BinaryenExpressionRef dest = makeInt32(module, 1024); BinaryenExpressionRef offset = makeInt32(module, 0); BinaryenExpressionRef size = makeInt32(module, 12); - return BinaryenMemoryInit(module, 0, dest, offset, size); + return BinaryenMemoryInit(module, 0, dest, offset, size, "0"); }; BinaryenExpressionRef makeDataDrop(BinaryenModuleRef module) { @@ -171,14 +171,14 @@ BinaryenExpressionRef makeMemoryCopy(BinaryenModuleRef module) { BinaryenExpressionRef dest = makeInt32(module, 2048); BinaryenExpressionRef source = makeInt32(module, 1024); BinaryenExpressionRef size = makeInt32(module, 12); - return BinaryenMemoryCopy(module, dest, source, size); + return BinaryenMemoryCopy(module, dest, source, size, "0", "0"); }; BinaryenExpressionRef makeMemoryFill(BinaryenModuleRef module) { BinaryenExpressionRef dest = makeInt32(module, 0); BinaryenExpressionRef value = makeInt32(module, 42); BinaryenExpressionRef size = makeInt32(module, 1024); - return BinaryenMemoryFill(module, dest, value, size); + return BinaryenMemoryFill(module, dest, value, size, "0"); }; // tests @@ -488,7 +488,8 @@ void test_core() { segmentOffsets, segmentSizes, 2, - 1); + 1, + "0"); BinaryenExpressionRef valueList[] = { // Unary @@ -784,29 +785,29 @@ void test_core() { makeSIMDShift(module, BinaryenShrUVecI64x2()), // SIMD load BinaryenSIMDLoad( - module, BinaryenLoad8SplatVec128(), 0, 1, makeInt32(module, 128)), + module, BinaryenLoad8SplatVec128(), 0, 1, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad16SplatVec128(), 16, 1, makeInt32(module, 128)), + module, BinaryenLoad16SplatVec128(), 16, 1, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad32SplatVec128(), 16, 4, makeInt32(module, 128)), + module, BinaryenLoad32SplatVec128(), 16, 4, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad64SplatVec128(), 0, 4, makeInt32(module, 128)), + module, BinaryenLoad64SplatVec128(), 0, 4, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad8x8SVec128(), 0, 8, makeInt32(module, 128)), + module, BinaryenLoad8x8SVec128(), 0, 8, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad8x8UVec128(), 0, 8, makeInt32(module, 128)), + module, BinaryenLoad8x8UVec128(), 0, 8, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad16x4SVec128(), 0, 8, makeInt32(module, 128)), + module, BinaryenLoad16x4SVec128(), 0, 8, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad16x4UVec128(), 0, 8, makeInt32(module, 128)), + module, BinaryenLoad16x4UVec128(), 0, 8, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad32x2SVec128(), 0, 8, makeInt32(module, 128)), + module, BinaryenLoad32x2SVec128(), 0, 8, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad32x2UVec128(), 0, 8, makeInt32(module, 128)), + module, BinaryenLoad32x2UVec128(), 0, 8, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad32ZeroVec128(), 0, 4, makeInt32(module, 128)), + module, BinaryenLoad32ZeroVec128(), 0, 4, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad64ZeroVec128(), 0, 8, makeInt32(module, 128)), + module, BinaryenLoad64ZeroVec128(), 0, 8, makeInt32(module, 128), "0"), // SIMD load/store lane BinaryenSIMDLoadStoreLane(module, BinaryenLoad8LaneVec128(), @@ -814,57 +815,64 @@ void test_core() { 1, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), + makeVec128(module, v128_bytes), + "0"), BinaryenSIMDLoadStoreLane(module, BinaryenLoad16LaneVec128(), 0, 2, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), + makeVec128(module, v128_bytes), + "0"), BinaryenSIMDLoadStoreLane(module, BinaryenLoad32LaneVec128(), 0, 4, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), + makeVec128(module, v128_bytes), + "0"), BinaryenSIMDLoadStoreLane(module, BinaryenLoad64LaneVec128(), 0, 8, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), - + makeVec128(module, v128_bytes), + "0"), BinaryenSIMDLoadStoreLane(module, BinaryenStore8LaneVec128(), 0, 1, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), + makeVec128(module, v128_bytes), + "0"), BinaryenSIMDLoadStoreLane(module, BinaryenStore16LaneVec128(), 0, 2, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), + makeVec128(module, v128_bytes), + "0"), BinaryenSIMDLoadStoreLane(module, BinaryenStore32LaneVec128(), 0, 4, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), + makeVec128(module, v128_bytes), + "0"), BinaryenSIMDLoadStoreLane(module, BinaryenStore64LaneVec128(), 0, 8, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), + makeVec128(module, v128_bytes), + "0"), // Other SIMD makeSIMDShuffle(module), makeSIMDTernary(module, BinaryenBitselectVec128()), @@ -914,14 +922,16 @@ void test_core() { BinaryenDrop( module, BinaryenLocalTee(module, 0, makeInt32(module, 102), BinaryenTypeInt32())), - BinaryenLoad(module, 4, 0, 0, 0, BinaryenTypeInt32(), makeInt32(module, 1)), - BinaryenLoad(module, 2, 1, 2, 1, BinaryenTypeInt64(), makeInt32(module, 8)), BinaryenLoad( - module, 4, 0, 0, 0, BinaryenTypeFloat32(), makeInt32(module, 2)), + module, 4, 0, 0, 0, BinaryenTypeInt32(), makeInt32(module, 1), "0"), + BinaryenLoad( + module, 2, 1, 2, 1, BinaryenTypeInt64(), makeInt32(module, 8), "0"), + BinaryenLoad( + module, 4, 0, 0, 0, BinaryenTypeFloat32(), makeInt32(module, 2), "0"), BinaryenLoad( - module, 8, 0, 2, 8, BinaryenTypeFloat64(), makeInt32(module, 9)), - BinaryenStore(module, 4, 0, 0, temp13, temp14, BinaryenTypeInt32()), - BinaryenStore(module, 8, 2, 4, temp15, temp16, BinaryenTypeInt64()), + module, 8, 0, 2, 8, BinaryenTypeFloat64(), makeInt32(module, 9), "0"), + BinaryenStore(module, 4, 0, 0, temp13, temp14, BinaryenTypeInt32(), "0"), + BinaryenStore(module, 8, 2, 4, temp15, temp16, BinaryenTypeInt64(), "0"), BinaryenSelect(module, temp10, temp11, temp12, BinaryenTypeAuto()), BinaryenReturn(module, makeInt32(module, 1337)), // Tail call @@ -1002,12 +1012,13 @@ void test_core() { 4, 0, temp6, - BinaryenAtomicLoad(module, 4, 0, BinaryenTypeInt32(), temp6), - BinaryenTypeInt32()), - BinaryenDrop( - module, - BinaryenAtomicWait(module, temp6, temp6, temp16, BinaryenTypeInt32())), - BinaryenDrop(module, BinaryenAtomicNotify(module, temp6, temp6)), + BinaryenAtomicLoad(module, 4, 0, BinaryenTypeInt32(), temp6, "0"), + BinaryenTypeInt32(), + "0"), + BinaryenDrop(module, + BinaryenAtomicWait( + module, temp6, temp6, temp16, BinaryenTypeInt32(), "0")), + BinaryenDrop(module, BinaryenAtomicNotify(module, temp6, temp6, "0")), BinaryenAtomicFence(module), // Tuples BinaryenTupleMake(module, tupleElements4a, 4), @@ -1022,8 +1033,8 @@ void test_core() { BinaryenPop(module, BinaryenTypeExternref()), BinaryenPop(module, iIfF), // Memory - BinaryenMemorySize(module), - BinaryenMemoryGrow(module, makeInt32(module, 0)), + BinaryenMemorySize(module, "0"), + BinaryenMemoryGrow(module, makeInt32(module, 0), "0"), // GC BinaryenI31New(module, makeInt32(module, 0)), BinaryenI31Get(module, i31refExpr, 1), @@ -1683,7 +1694,8 @@ void test_for_each() { segmentOffsets, segmentSizes, 2, - 0); + 0, + "0"); BinaryenAddGlobal(module, "a-global", BinaryenTypeInt32(), diff --git a/test/example/c-api-relooper-unreachable-if.cpp b/test/example/c-api-relooper-unreachable-if.cpp index e8bfc43bc..c63ca0204 100644 --- a/test/example/c-api-relooper-unreachable-if.cpp +++ b/test/example/c-api-relooper-unreachable-if.cpp @@ -28,13 +28,20 @@ int main() { segmentOffsets, segmentSizes, 0, - 0); + 0, + "0"); } the_relooper = RelooperCreate(the_module); expressions[1] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[2] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[3] = BinaryenStore( - the_module, 4, 0, 0, expressions[2], expressions[1], BinaryenTypeInt32()); + expressions[3] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[2], + expressions[1], + BinaryenTypeInt32(), + "0"); expressions[4] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = {expressions[3], expressions[4]}; @@ -43,8 +50,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[5]); expressions[6] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[7] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[6]); + expressions[7] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[6], "0"); expressions[8] = BinaryenLocalSet(the_module, 0, expressions[7]); relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[8]); RelooperAddBranch( @@ -66,8 +73,14 @@ int main() { the_relooper = RelooperCreate(the_module); expressions[10] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[11] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[12] = BinaryenStore( - the_module, 4, 0, 0, expressions[11], expressions[10], BinaryenTypeInt32()); + expressions[12] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[11], + expressions[10], + BinaryenTypeInt32(), + "0"); expressions[13] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = {expressions[12], expressions[13]}; @@ -76,8 +89,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[14]); expressions[15] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[16] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[15]); + expressions[16] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[15], "0"); expressions[17] = BinaryenLocalSet(the_module, 0, expressions[16]); relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[17]); RelooperAddBranch( @@ -115,8 +128,8 @@ int main() { RelooperAddBranch( relooperBlocks[1], relooperBlocks[1], expressions[0], expressions[0]); expressions[21] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[22] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[21]); + expressions[22] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[21], "0"); expressions[23] = BinaryenLocalSet(the_module, 0, expressions[22]); relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[23]); RelooperAddBranch( @@ -139,8 +152,14 @@ int main() { the_relooper = RelooperCreate(the_module); expressions[25] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[26] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[27] = BinaryenStore( - the_module, 4, 0, 0, expressions[26], expressions[25], BinaryenTypeInt32()); + expressions[27] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[26], + expressions[25], + BinaryenTypeInt32(), + "0"); expressions[28] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = {expressions[27], expressions[28]}; @@ -149,8 +168,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[29]); expressions[30] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[31] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[30]); + expressions[31] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[30], "0"); expressions[32] = BinaryenLocalSet(the_module, 0, expressions[31]); relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[32]); RelooperAddBranch( @@ -174,8 +193,14 @@ int main() { the_relooper = RelooperCreate(the_module); expressions[34] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[35] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[36] = BinaryenStore( - the_module, 4, 0, 0, expressions[35], expressions[34], BinaryenTypeInt32()); + expressions[36] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[35], + expressions[34], + BinaryenTypeInt32(), + "0"); expressions[37] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = {expressions[36], expressions[37]}; @@ -184,8 +209,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[38]); expressions[39] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[40] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[39]); + expressions[40] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[39], "0"); expressions[41] = BinaryenLocalSet(the_module, 0, expressions[40]); relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[41]); RelooperAddBranch( @@ -232,8 +257,14 @@ int main() { relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[49]); expressions[50] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); expressions[51] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[52] = BinaryenStore( - the_module, 4, 0, 0, expressions[51], expressions[50], BinaryenTypeInt32()); + expressions[52] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[51], + expressions[50], + BinaryenTypeInt32(), + "0"); expressions[53] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = {expressions[52], expressions[53]}; @@ -244,8 +275,8 @@ int main() { RelooperAddBranch( relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]); expressions[55] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[56] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[55]); + expressions[56] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[55], "0"); expressions[57] = BinaryenLocalSet(the_module, 3, expressions[56]); relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[57]); RelooperAddBranch( @@ -287,20 +318,38 @@ int main() { BinaryenBinary(the_module, 36, expressions[72], expressions[71]); expressions[74] = BinaryenUnary(the_module, 24, expressions[73]); expressions[75] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[76] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[75]); + expressions[76] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[75], "0"); expressions[77] = BinaryenConst(the_module, BinaryenLiteralInt32(128)); expressions[78] = BinaryenBinary(the_module, 1, expressions[76], expressions[77]); expressions[79] = BinaryenLocalTee(the_module, 3, expressions[78], BinaryenTypeInt32()); - expressions[80] = BinaryenStore( - the_module, 4, 0, 0, expressions[75], expressions[79], BinaryenTypeInt32()); + expressions[80] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[75], + expressions[79], + BinaryenTypeInt32(), + "0"); expressions[81] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); - expressions[82] = BinaryenStore( - the_module, 4, 0, 0, expressions[81], expressions[70], BinaryenTypeInt32()); - expressions[83] = BinaryenStore( - the_module, 4, 4, 0, expressions[81], expressions[74], BinaryenTypeInt32()); + expressions[82] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[81], + expressions[70], + BinaryenTypeInt32(), + "0"); + expressions[83] = BinaryenStore(the_module, + 4, + 4, + 0, + expressions[81], + expressions[74], + BinaryenTypeInt32(), + "0"); { BinaryenExpressionRef children[] = {expressions[60], expressions[62], @@ -313,8 +362,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[84]); expressions[85] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); - expressions[86] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[85]); + expressions[86] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[85], "0"); expressions[87] = BinaryenLocalSet(the_module, 1, expressions[86]); expressions[88] = BinaryenLocalGet(the_module, 1, BinaryenTypeInt32()); expressions[89] = BinaryenLocalSet(the_module, 4, expressions[88]); @@ -322,8 +371,14 @@ int main() { expressions[91] = BinaryenLocalSet(the_module, 5, expressions[90]); expressions[92] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); expressions[93] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[94] = BinaryenStore( - the_module, 4, 0, 0, expressions[93], expressions[92], BinaryenTypeInt32()); + expressions[94] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[93], + expressions[92], + BinaryenTypeInt32(), + "0"); expressions[95] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt32()); expressions[96] = BinaryenReturn(the_module, expressions[95]); { @@ -337,8 +392,8 @@ int main() { } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[97]); expressions[98] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); - expressions[99] = - BinaryenLoad(the_module, 4, 0, 8, 0, BinaryenTypeInt32(), expressions[98]); + expressions[99] = BinaryenLoad( + the_module, 4, 0, 8, 0, BinaryenTypeInt32(), expressions[98], "0"); RelooperAddBranch( relooperBlocks[0], relooperBlocks[1], expressions[99], expressions[0]); expressions[100] = BinaryenUnreachable(the_module); @@ -346,8 +401,8 @@ int main() { RelooperAddBranch( relooperBlocks[0], relooperBlocks[2], expressions[0], expressions[0]); expressions[101] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[102] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[101]); + expressions[102] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[101], "0"); expressions[103] = BinaryenLocalSet(the_module, 6, expressions[102]); relooperBlocks[3] = RelooperAddBlock(the_relooper, expressions[103]); RelooperAddBranch( @@ -403,8 +458,8 @@ int main() { BinaryenBinary(the_module, 36, expressions[119], expressions[118]); expressions[121] = BinaryenUnary(the_module, 24, expressions[120]); expressions[122] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[123] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[122]); + expressions[123] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[122], "0"); expressions[124] = BinaryenConst(the_module, BinaryenLiteralInt32(128)); expressions[125] = BinaryenBinary(the_module, 1, expressions[123], expressions[124]); @@ -416,7 +471,8 @@ int main() { 0, expressions[122], expressions[126], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[128] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt32()); expressions[129] = BinaryenStore(the_module, 4, @@ -424,14 +480,16 @@ int main() { 0, expressions[128], expressions[117], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[130] = BinaryenStore(the_module, 4, 4, 0, expressions[128], expressions[121], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); { BinaryenExpressionRef children[] = { expressions[115], expressions[127], expressions[129], expressions[130]}; @@ -440,8 +498,8 @@ int main() { } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[131]); expressions[132] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt32()); - expressions[133] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[132]); + expressions[133] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[132], "0"); expressions[134] = BinaryenLocalSet(the_module, 3, expressions[133]); expressions[135] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); expressions[136] = BinaryenLocalSet(the_module, 6, expressions[135]); @@ -470,7 +528,8 @@ int main() { 0, expressions[145], expressions[144], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[147] = BinaryenLocalGet(the_module, 8, BinaryenTypeInt32()); expressions[148] = BinaryenReturn(the_module, expressions[147]); { @@ -483,8 +542,8 @@ int main() { RelooperAddBranch( relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]); expressions[150] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt32()); - expressions[151] = - BinaryenLoad(the_module, 4, 0, 8, 0, BinaryenTypeInt32(), expressions[150]); + expressions[151] = BinaryenLoad( + the_module, 4, 0, 8, 0, BinaryenTypeInt32(), expressions[150], "0"); RelooperAddBranch( relooperBlocks[1], relooperBlocks[2], expressions[151], expressions[0]); expressions[152] = BinaryenUnreachable(the_module); @@ -494,8 +553,8 @@ int main() { RelooperAddBranch( relooperBlocks[2], relooperBlocks[3], expressions[0], expressions[0]); expressions[153] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[154] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[153]); + expressions[154] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[153], "0"); expressions[155] = BinaryenLocalSet(the_module, 9, expressions[154]); relooperBlocks[5] = RelooperAddBlock(the_relooper, expressions[155]); RelooperAddBranch( @@ -538,7 +597,8 @@ int main() { segmentOffsets, segmentSizes, 0, - 0); + 0, + "0"); } expressions[157] = BinaryenConst(the_module, BinaryenLiteralInt32(65535)); expressions[158] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -548,7 +608,8 @@ int main() { 0, expressions[158], expressions[157], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[160] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); expressions[161] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { @@ -598,8 +659,8 @@ int main() { BinaryenBinary(the_module, 36, expressions[182], expressions[181]); expressions[184] = BinaryenUnary(the_module, 24, expressions[183]); expressions[185] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[186] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[185]); + expressions[186] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[185], "0"); expressions[187] = BinaryenConst(the_module, BinaryenLiteralInt32(128)); expressions[188] = BinaryenBinary(the_module, 1, expressions[186], expressions[187]); @@ -611,7 +672,8 @@ int main() { 0, expressions[185], expressions[189], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[191] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); expressions[192] = BinaryenStore(the_module, 4, @@ -619,14 +681,16 @@ int main() { 0, expressions[191], expressions[180], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[193] = BinaryenStore(the_module, 4, 4, 0, expressions[191], expressions[184], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); { BinaryenExpressionRef children[] = {expressions[166], expressions[168], @@ -641,8 +705,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[194]); expressions[195] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); - expressions[196] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[195]); + expressions[196] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[195], "0"); expressions[197] = BinaryenLocalSet(the_module, 7, expressions[196]); expressions[198] = BinaryenLocalGet(the_module, 8, BinaryenTypeInt32()); expressions[199] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -652,7 +716,8 @@ int main() { 0, expressions[199], expressions[198], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[201] = BinaryenLocalGet(the_module, 7, BinaryenTypeInt32()); expressions[202] = BinaryenReturn(the_module, expressions[201]); { @@ -663,8 +728,8 @@ int main() { } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[203]); expressions[204] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); - expressions[205] = - BinaryenLoad(the_module, 4, 0, 8, 0, BinaryenTypeInt32(), expressions[204]); + expressions[205] = BinaryenLoad( + the_module, 4, 0, 8, 0, BinaryenTypeInt32(), expressions[204], "0"); RelooperAddBranch( relooperBlocks[0], relooperBlocks[1], expressions[205], expressions[0]); expressions[206] = BinaryenUnreachable(the_module); @@ -672,8 +737,8 @@ int main() { RelooperAddBranch( relooperBlocks[0], relooperBlocks[2], expressions[0], expressions[0]); expressions[207] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[208] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[207]); + expressions[208] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[207], "0"); expressions[209] = BinaryenLocalSet(the_module, 8, expressions[208]); relooperBlocks[3] = RelooperAddBlock(the_relooper, expressions[209]); RelooperAddBranch( @@ -719,7 +784,8 @@ int main() { 0, expressions[219], expressions[218], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[221] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); expressions[222] = BinaryenReturn(the_module, expressions[221]); { @@ -733,8 +799,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[223]); expressions[224] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[225] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[224]); + expressions[225] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[224], "0"); expressions[226] = BinaryenLocalSet(the_module, 4, expressions[225]); relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[226]); RelooperAddBranch( @@ -780,7 +846,8 @@ int main() { 0, expressions[241], expressions[240], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[243] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); expressions[244] = BinaryenReturn(the_module, expressions[243]); { @@ -796,8 +863,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[245]); expressions[246] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[247] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[246]); + expressions[247] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[246], "0"); expressions[248] = BinaryenLocalSet(the_module, 7, expressions[247]); relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[248]); RelooperAddBranch( @@ -848,7 +915,8 @@ int main() { 0, expressions[263], expressions[262], - BinaryenTypeInt64()); + BinaryenTypeInt64(), + "0"); expressions[265] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); expressions[266] = BinaryenReturn(the_module, expressions[265]); { @@ -864,8 +932,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[267]); expressions[268] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[269] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt64(), expressions[268]); + expressions[269] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt64(), expressions[268], "0"); expressions[270] = BinaryenLocalSet(the_module, 7, expressions[269]); relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[270]); RelooperAddBranch( diff --git a/test/example/c-api-unused-mem.cpp b/test/example/c-api-unused-mem.cpp index d395753f7..6c0fd14c1 100644 --- a/test/example/c-api-unused-mem.cpp +++ b/test/example/c-api-unused-mem.cpp @@ -29,7 +29,8 @@ int main() { segmentOffsets, segmentSizes, 0, - 0); + 0, + "0"); } the_relooper = RelooperCreate(the_module); { @@ -40,8 +41,14 @@ int main() { relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[1]); expressions[2] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[3] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[4] = BinaryenStore( - the_module, 4, 0, 0, expressions[3], expressions[2], BinaryenTypeInt32()); + expressions[4] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[3], + expressions[2], + BinaryenTypeInt32(), + "0"); expressions[5] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = {expressions[4], expressions[5]}; @@ -52,8 +59,8 @@ int main() { RelooperAddBranch( relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]); expressions[7] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[8] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[7]); + expressions[8] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[7], "0"); expressions[9] = BinaryenLocalSet(the_module, 0, expressions[8]); relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[9]); RelooperAddBranch( @@ -86,12 +93,19 @@ int main() { segmentOffsets, segmentSizes, 0, - 0); + 0, + "0"); } expressions[11] = BinaryenConst(the_module, BinaryenLiteralInt32(65535)); expressions[12] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[13] = BinaryenStore( - the_module, 4, 0, 0, expressions[12], expressions[11], BinaryenTypeInt32()); + expressions[13] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[12], + expressions[11], + BinaryenTypeInt32(), + "0"); { BinaryenExpressionRef operands[] = {0}; expressions[14] = diff --git a/test/example/relooper-fuzz.c b/test/example/relooper-fuzz.c index d953d9cf2..f0b727f4c 100644 --- a/test/example/relooper-fuzz.c +++ b/test/example/relooper-fuzz.c @@ -25,7 +25,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 27)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -45,29 +46,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -89,7 +93,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -338,7 +344,8 @@ int main() { 0, BinaryenConst(module, BinaryenLiteralInt32(8 + 4 * i)), BinaryenConst(module, BinaryenLiteralInt32(decisions[i])), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); } } full[numDecisions] = body; @@ -362,7 +369,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); assert(BinaryenModuleValidate(module)); diff --git a/test/example/relooper-fuzz1.c b/test/example/relooper-fuzz1.c index 9e49fbcd3..f481fe713 100644 --- a/test/example/relooper-fuzz1.c +++ b/test/example/relooper-fuzz1.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 30)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -337,7 +343,8 @@ int main() { 0, BinaryenConst(module, BinaryenLiteralInt32(8 + 4 * i)), BinaryenConst(module, BinaryenLiteralInt32(decisions[i])), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); } } full[numDecisions] = body; @@ -359,7 +366,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); assert(BinaryenModuleValidate(module)); diff --git a/test/example/relooper-fuzz2.c b/test/example/relooper-fuzz2.c index a48b86e2a..c179606a0 100644 --- a/test/example/relooper-fuzz2.c +++ b/test/example/relooper-fuzz2.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 27)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -266,47 +272,49 @@ int main() { b0, b1, NULL, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), + BinaryenTypeInt32(), + "0")); RelooperAddBranch( b1, b1, NULL, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), + BinaryenTypeInt32(), + "0")); { BinaryenIndex values[] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, @@ -333,9 +341,11 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 6))), - BinaryenTypeInt32())); + BinaryenTypeInt32(), + "0")); } RelooperAddBranchForSwitch( @@ -343,48 +353,50 @@ int main() { b4, NULL, 0, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), + BinaryenTypeInt32(), + "0")); RelooperAddBranchForSwitch( b3, b6, NULL, 0, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 5))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 5))), + BinaryenTypeInt32(), + "0")); RelooperAddBranch( b4, @@ -397,71 +409,74 @@ int main() { BinaryenLocalGet(module, 0, BinaryenTypeInt32()), BinaryenConst(module, BinaryenLiteralInt32(2))), BinaryenConst(module, BinaryenLiteralInt32(0))), - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 5))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 5))), + BinaryenTypeInt32(), + "0")); RelooperAddBranch( b4, b3, NULL, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 3))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 3))), + BinaryenTypeInt32(), + "0")); RelooperAddBranchForSwitch( b5, b1, NULL, 0, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), + BinaryenTypeInt32(), + "0")); { BinaryenIndex values[] = {0, 3, 6, 9, 12, 15, 18, 21, 24, 27, @@ -488,9 +503,11 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 2))), - BinaryenTypeInt32())); + BinaryenTypeInt32(), + "0")); } { @@ -519,9 +536,11 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 3))), - BinaryenTypeInt32())); + BinaryenTypeInt32(), + "0")); } RelooperAddBranchForSwitch( @@ -529,24 +548,25 @@ int main() { b2, NULL, 0, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 3))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 3))), + BinaryenTypeInt32(), + "0")); RelooperAddBranch( b7, @@ -559,70 +579,73 @@ int main() { BinaryenLocalGet(module, 0, BinaryenTypeInt32()), BinaryenConst(module, BinaryenLiteralInt32(2))), BinaryenConst(module, BinaryenLiteralInt32(0))), - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 1))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 1))), + BinaryenTypeInt32(), + "0")); RelooperAddBranch( b7, b1, NULL, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), + BinaryenTypeInt32(), + "0")); RelooperAddBranch( b8, b8, NULL, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 2))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 2))), + BinaryenTypeInt32(), + "0")); BinaryenExpressionRef body = RelooperRenderAndDispose(relooper, b0, 1); @@ -644,7 +667,8 @@ int main() { 0, BinaryenConst(module, BinaryenLiteralInt32(8 + 4 * i)), BinaryenConst(module, BinaryenLiteralInt32(decisions[i])), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); } } full[numDecisions] = body; @@ -666,7 +690,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge1.c b/test/example/relooper-merge1.c index 491839f36..f7939adc6 100644 --- a/test/example/relooper-merge1.c +++ b/test/example/relooper-merge1.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 12)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -226,7 +232,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge2.c b/test/example/relooper-merge2.c index ed5fc0f4d..be8fba500 100644 --- a/test/example/relooper-merge2.c +++ b/test/example/relooper-merge2.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 12)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -241,7 +247,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge3.c b/test/example/relooper-merge3.c index 655b4d22b..f1e3d8a54 100644 --- a/test/example/relooper-merge3.c +++ b/test/example/relooper-merge3.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 12)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -225,7 +231,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge4.c b/test/example/relooper-merge4.c index 2e5624421..b379800dd 100644 --- a/test/example/relooper-merge4.c +++ b/test/example/relooper-merge4.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 12)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -225,7 +231,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge5.c b/test/example/relooper-merge5.c index 41a36c102..d678a630e 100644 --- a/test/example/relooper-merge5.c +++ b/test/example/relooper-merge5.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 12)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -225,7 +231,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge6.c b/test/example/relooper-merge6.c index 23e639cb1..9d9d33361 100644 --- a/test/example/relooper-merge6.c +++ b/test/example/relooper-merge6.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 12)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -228,7 +234,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/lit/multi-memories-atomics64.wast b/test/lit/multi-memories-atomics64.wast new file mode 100644 index 000000000..15941b12a --- /dev/null +++ b/test/lit/multi-memories-atomics64.wast @@ -0,0 +1,704 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-as %s -all -g -o %t.wasm +;; RUN: wasm-dis %t.wasm -o - | filecheck %s + +(module + ;; CHECK: (type $0 (func)) + (type $0 (func)) + ;; CHECK: (memory $appMemory (shared i64 23 256)) + (memory $appMemory (shared i64 23 256)) + ;; CHECK: (memory $dataMemory (shared i64 23 256)) + (memory $dataMemory (shared i64 23 256)) + ;; CHECK: (memory $instrumentMemory (shared i64 23 256)) + (memory $instrumentMemory (shared i64 23 256)) + ;; CHECK: (func $atomic-loadstore + ;; CHECK-NEXT: (local $0 i64) + ;; CHECK-NEXT: (local $1 i64) + ;; CHECK-NEXT: (local $2 i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.load8_u $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.load8_u $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.load16_u $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.load16_u $instrumentMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.load $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.load $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load8_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load8_u $dataMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load16_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load16_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load32_u $instrumentMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load32_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load $instrumentMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.atomic.store $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.atomic.store $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.atomic.store8 $instrumentMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.atomic.store8 $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.atomic.store16 $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.atomic.store16 $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store8 $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store8 $instrumentMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store16 $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store16 $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store32 $instrumentMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store32 $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $atomic-loadstore (type $0) + (local $0 i64) + (local $1 i64) + (local $2 i32) + (drop + (i32.atomic.load8_u 0 offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load8_u $appMemory offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load16_u 1 offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load16_u $instrumentMemory offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load 1 offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load $appMemory offset=4 + (local.get $0) + ) + ) + (drop + (i64.atomic.load8_u + (local.get $0) + ) + ) + (drop + (i64.atomic.load8_u $dataMemory + (local.get $0) + ) + ) + (drop + (i64.atomic.load16_u + (local.get $0) + ) + ) + (drop + (i64.atomic.load16_u $appMemory + (local.get $0) + ) + ) + (drop + (i64.atomic.load32_u 2 + (local.get $0) + ) + ) + (drop + (i64.atomic.load32_u $appMemory + (local.get $0) + ) + ) + (drop + (i64.atomic.load + (local.get $0) + ) + ) + (drop + (i64.atomic.load $instrumentMemory + (local.get $0) + ) + ) + (i32.atomic.store 0 offset=4 align=4 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store $appMemory offset=4 align=4 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store8 2 offset=4 align=1 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store8 $dataMemory offset=4 align=1 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store16 0 offset=4 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store16 $dataMemory offset=4 + (local.get $0) + (local.get $2) + ) + (i64.atomic.store offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store $appMemory offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store8 1 offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store8 $instrumentMemory offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store16 offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store16 $appMemory offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store32 2 offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store32 $dataMemory offset=4 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $atomic-rmw + ;; CHECK-NEXT: (local $0 i64) + ;; CHECK-NEXT: (local $1 i64) + ;; CHECK-NEXT: (local $2 i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw.add $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw.add $instrumentMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw8.add_u $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw8.add_u $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw16.and_u $dataMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw16.and_u $instrumentMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.rmw32.or_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.rmw32.or_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw8.xchg_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw8.xchg_u $dataMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $atomic-rmw (type $0) + (local $0 i64) + (local $1 i64) + (local $2 i32) + (drop + (i32.atomic.rmw.add $dataMemory offset=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw.add 2 offset=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.add_u 0 offset=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.add_u $appMemory offset=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw16.and_u 1 align=2 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw16.and_u $instrumentMemory align=2 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i64.atomic.rmw32.or_u 0 + (local.get $0) + (local.get $1) + ) + ) + (drop + (i64.atomic.rmw32.or_u $appMemory + (local.get $0) + (local.get $1) + ) + ) + (drop + (i32.atomic.rmw8.xchg_u 0 align=1 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.xchg_u $dataMemory align=1 + (local.get $0) + (local.get $2) + ) + ) + ) + ;; CHECK: (func $atomic-cmpxchg + ;; CHECK-NEXT: (local $0 i64) + ;; CHECK-NEXT: (local $1 i64) + ;; CHECK-NEXT: (local $2 i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw.cmpxchg $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw.cmpxchg $instrumentMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw8.cmpxchg_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw8.cmpxchg_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.rmw.cmpxchg $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.rmw.cmpxchg $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.rmw32.cmpxchg_u $instrumentMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.rmw32.cmpxchg_u $dataMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $atomic-cmpxchg (type $0) + (local $0 i64) + (local $1 i64) + (local $2 i32) + (drop + (i32.atomic.rmw.cmpxchg 0 offset=4 + (local.get $0) + (local.get $2) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw.cmpxchg $instrumentMemory offset=4 + (local.get $0) + (local.get $2) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.cmpxchg_u + (local.get $0) + (local.get $2) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.cmpxchg_u $appMemory + (local.get $0) + (local.get $2) + (local.get $2) + ) + ) + (drop + (i64.atomic.rmw.cmpxchg offset=4 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (i64.atomic.rmw.cmpxchg $dataMemory offset=4 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (i64.atomic.rmw32.cmpxchg_u 2 align=4 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (i64.atomic.rmw32.cmpxchg_u $dataMemory align=4 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + ) + ;; CHECK: (func $atomic-wait-notify + ;; CHECK-NEXT: (local $0 i64) + ;; CHECK-NEXT: (local $1 i64) + ;; CHECK-NEXT: (local $2 i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait32 $dataMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait32 $instrumentMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait32 $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait32 $instrumentMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.notify $dataMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.notify $dataMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.notify $appMemory offset=24 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.notify $dataMemory offset=24 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait64 $instrumentMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait64 $instrumentMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait64 $appMemory offset=16 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait64 $appMemory offset=16 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $atomic-wait-notify (type $0) + (local $0 i64) + (local $1 i64) + (local $2 i32) + (drop + (memory.atomic.wait32 $dataMemory + (local.get $0) + (local.get $2) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait32 2 + (local.get $0) + (local.get $2) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait32 $appMemory offset=4 align=4 + (local.get $0) + (local.get $2) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait32 2 offset=4 align=4 + (local.get $0) + (local.get $2) + (local.get $1) + ) + ) + (drop + (memory.atomic.notify 1 + (local.get $0) + (local.get $2) + ) + ) + (drop + (memory.atomic.notify $dataMemory + (local.get $0) + (local.get $2) + ) + ) + (drop + (memory.atomic.notify $appMemory offset=24 align=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (memory.atomic.notify 1 offset=24 align=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (memory.atomic.wait64 $instrumentMemory + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait64 2 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait64 $appMemory align=8 offset=16 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait64 0 align=8 offset=16 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + ) + ;; CHECK: (func $atomic-fence + ;; CHECK-NEXT: (atomic.fence) + ;; CHECK-NEXT: ) + (func $atomic-fence (type $0) + (atomic.fence) + ) +) diff --git a/test/lit/multi-memories-basics.wast b/test/lit/multi-memories-basics.wast new file mode 100644 index 000000000..42b60915b --- /dev/null +++ b/test/lit/multi-memories-basics.wast @@ -0,0 +1,175 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-as %s -all -g -o %t.wasm +;; RUN: wasm-dis %t.wasm -o - | filecheck %s + +(module + ;; CHECK: (import "env" "memory" (memory $importedMemory 1 1)) + + ;; CHECK: (memory $memory1 1 500) + (memory $memory1 1 500) + ;; CHECK: (memory $memory2 1 800) + (memory $memory2 1 800) + ;; CHECK: (memory $memory3 1 400) + (memory $memory3 1 400) + (data (memory $memory1) (i32.const 0) "a" "" "bcd") + (import "env" "memory" (memory $importedMemory 1 1)) + ;; CHECK: (data (i32.const 0) "abcd") + + ;; CHECK: (func $memory.fill + ;; CHECK-NEXT: (memory.fill $memory2 + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $memory.fill + (memory.fill 1 + (i32.const 0) + (i32.const 1) + (i32.const 2) + ) + ) + ;; CHECK: (func $memory.copy + ;; CHECK-NEXT: (memory.copy $memory2 $memory3 + ;; CHECK-NEXT: (i32.const 512) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $memory.copy + (memory.copy 1 2 + (i32.const 512) + (i32.const 0) + (i32.const 12) + ) + ) + ;; CHECK: (func $memory.init + ;; CHECK-NEXT: (memory.init $memory1 0 + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (i32.const 45) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $memory.init + (memory.init 0 0 + (i32.const 0) + (i32.const 0) + (i32.const 45) + ) + ) + ;; CHECK: (func $memory.grow (result i32) + ;; CHECK-NEXT: (memory.grow $memory3 + ;; CHECK-NEXT: (i32.const 10) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $memory.grow (result i32) + (memory.grow 2 + (i32.const 10) + ) + ) + ;; CHECK: (func $memory.size (result i32) + ;; CHECK-NEXT: (memory.size $memory3) + ;; CHECK-NEXT: ) + (func $memory.size (result i32) + (memory.size 2) + ) + ;; CHECK: (func $loads + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load $memory1 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load $memory3 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load16_s $memory2 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load16_s $memory2 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load8_s $memory3 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load8_s $memory3 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load16_u $memory1 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load16_u $memory1 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load8_u $memory2 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load8_u $memory2 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $loads + (drop (i32.load 0 (i32.const 12))) + (drop (i32.load $memory3 (i32.const 12))) + (drop (i32.load16_s 1 (i32.const 12))) + (drop (i32.load16_s $memory2 (i32.const 12))) + (drop (i32.load8_s 2 (i32.const 12))) + (drop (i32.load8_s $memory3 (i32.const 12))) + (drop (i32.load16_u 0 (i32.const 12))) + (drop (i32.load16_u $memory1 (i32.const 12))) + (drop (i32.load8_u 1 (i32.const 12))) + (drop (i32.load8_u $memory2 (i32.const 12))) + ) + ;; CHECK: (func $stores + ;; CHECK-NEXT: (i32.store $memory1 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: (i32.const 115) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store $memory1 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: (i32.const 115) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store16 $memory2 + ;; CHECK-NEXT: (i32.const 20) + ;; CHECK-NEXT: (i32.const 31353) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store16 $importedMemory + ;; CHECK-NEXT: (i32.const 20) + ;; CHECK-NEXT: (i32.const 31353) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store8 $memory3 + ;; CHECK-NEXT: (i32.const 23) + ;; CHECK-NEXT: (i32.const 120) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store8 $memory3 + ;; CHECK-NEXT: (i32.const 23) + ;; CHECK-NEXT: (i32.const 120) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $stores + (i32.store 0 (i32.const 12) (i32.const 115)) + (i32.store $memory1 (i32.const 12) (i32.const 115)) + (i32.store16 1 (i32.const 20) (i32.const 31353)) + (i32.store16 $importedMemory (i32.const 20) (i32.const 31353)) + (i32.store8 2 (i32.const 23) (i32.const 120)) + (i32.store8 $memory3 (i32.const 23) (i32.const 120)) + ) +) + diff --git a/test/lit/multi-memories-simd.wast b/test/lit/multi-memories-simd.wast new file mode 100644 index 000000000..184d98876 --- /dev/null +++ b/test/lit/multi-memories-simd.wast @@ -0,0 +1,635 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-as %s -all -g -o %t.wasm +;; RUN: wasm-dis %t.wasm -o - | filecheck %s + +(module + ;; CHECK: (memory $memorya 1 1) + (memory $memorya 1 1) + ;; CHECK: (memory $memoryb 1 1) + (memory $memoryb 1 1) + ;; CHECK: (memory $memoryc 1 1) + (memory $memoryc 1 1) + ;; CHECK: (memory $memoryd 1 1) + (memory $memoryd 1 1) + ;; CHECK: (func $v128.load (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load (param $0 i32) (result v128) + (v128.load offset=0 align=16 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load2 (param $0 i32) (result v128) + (v128.load $memoryb offset=0 align=16 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load8x8_s (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load8x8_s $memoryc + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8x8_s (param $0 i32) (result v128) + (v128.load8x8_s 2 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load8x8_s2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load8x8_s $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8x8_s2 (param $0 i32) (result v128) + (v128.load8x8_s 1 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load8x8_u (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load8x8_u $memoryd + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8x8_u (param $0 i32) (result v128) + (v128.load8x8_u 3 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load8x8_u2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load8x8_u $memoryd + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8x8_u2 (param $0 i32) (result v128) + (v128.load8x8_u $memoryd + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load16x4_s (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load16x4_s $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16x4_s (param $0 i32) (result v128) + (v128.load16x4_s 0 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load16x4_s2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load16x4_s $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16x4_s2 (param $0 i32) (result v128) + (v128.load16x4_s $memoryb + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load16x4_u (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load16x4_u $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16x4_u (param $0 i32) (result v128) + (v128.load16x4_u 0 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load16x4_u2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load16x4_u $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16x4_u2 (param $0 i32) (result v128) + (v128.load16x4_u $memorya + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load32x2_s (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32x2_s $memoryc + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32x2_s (param $0 i32) (result v128) + (v128.load32x2_s 2 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load32x2_s2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32x2_s $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32x2_s2 (param $0 i32) (result v128) + (v128.load32x2_s $memoryb + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load32x2_u (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32x2_u $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32x2_u (param $0 i32) (result v128) + (v128.load32x2_u 1 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load32x2_u2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32x2_u $memoryc + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32x2_u2 (param $0 i32) (result v128) + (v128.load32x2_u $memoryc + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load8_splat (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load8_splat $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8_splat (param $0 i32) (result v128) + (v128.load8_splat 1 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load8_splat2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load8_splat $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8_splat2 (param $0 i32) (result v128) + (v128.load8_splat $memoryb + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load16_splat (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load16_splat $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16_splat (param $0 i32) (result v128) + (v128.load16_splat $memorya + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load16_splat2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load16_splat $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16_splat2 (param $0 i32) (result v128) + (v128.load16_splat 0 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load32_splat (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32_splat $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32_splat (param $0 i32) (result v128) + (v128.load32_splat 1 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load32_splat2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32_splat $memoryd + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32_splat2 (param $0 i32) (result v128) + (v128.load32_splat $memoryd + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load64_splat (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load64_splat $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_splat (param $0 i32) (result v128) + (v128.load64_splat 1 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load64_splat2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load64_splat $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_splat2 (param $0 i32) (result v128) + (v128.load64_splat $memorya + (local.get $0) + ) + ) + ;; CHECK: (func $v128.store (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store (param $0 i32) (param $1 v128) + (v128.store 0 offset=0 align=16 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store2 (param $0 i32) (param $1 v128) + (v128.store 1 offset=0 align=16 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load8_lane (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load8_lane $memorya 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8_lane (param $0 i32) (param $1 v128) (result v128) + (v128.load8_lane 0 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load8_lane2 (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load8_lane $memoryb 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8_lane2 (param $0 i32) (param $1 v128) (result v128) + (v128.load8_lane $memoryb 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load16_lane (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load16_lane $memoryb 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16_lane (param $0 i32) (param $1 v128) (result v128) + (v128.load16_lane 1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load16_lane2 (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load16_lane $memoryd 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16_lane2 (param $0 i32) (param $1 v128) (result v128) + (v128.load16_lane $memoryd 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load32_lane (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load32_lane $memorya 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32_lane (param $0 i32) (param $1 v128) (result v128) + (v128.load32_lane $memorya 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load32_lane2 (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load32_lane $memoryb 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32_lane2 (param $0 i32) (param $1 v128) (result v128) + (v128.load32_lane 1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memoryd 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memoryd 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane2 (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memoryb 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane2 (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane 1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane_align (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memorya align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane_align (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane 0 align=1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane_align2 (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memoryb align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane_align2 (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memoryb align=1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane_offset (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memoryc offset=32 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane_offset (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane 2 offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane_offset2 (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memoryb offset=32 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane_offset2 (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memoryb offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane_align_offset (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memorya offset=32 align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane_align_offset (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane align=1 offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane_align_offset2 (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memoryd offset=32 align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane_align_offset2 (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memoryd align=1 offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store8_lane (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store8_lane $memorya 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store8_lane (param $0 i32) (param $1 v128) + (v128.store8_lane 0 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store8_lane2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store8_lane $memoryd 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store8_lane2 (param $0 i32) (param $1 v128) + (v128.store8_lane $memoryd 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store16_lane (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store16_lane $memorya 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store16_lane (param $0 i32) (param $1 v128) + (v128.store16_lane $memorya 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store16_lane2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store16_lane $memoryb 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store16_lane2 (param $0 i32) (param $1 v128) + (v128.store16_lane 1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store32_lane (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store32_lane $memoryb 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store32_lane (param $0 i32) (param $1 v128) + (v128.store32_lane $memoryb 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store32_lane2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store32_lane $memoryc 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store32_lane2 (param $0 i32) (param $1 v128) + (v128.store32_lane 2 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memoryc 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane (param $0 i32) (param $1 v128) + (v128.store64_lane $memoryc 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memoryb 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane2 (param $0 i32) (param $1 v128) + (v128.store64_lane 1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane_align (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memoryb align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane_align (param $0 i32) (param $1 v128) + (v128.store64_lane $memoryb align=1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane_align2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memorya align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane_align2 (param $0 i32) (param $1 v128) + (v128.store64_lane 0 align=1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane_offset (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memoryd offset=32 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane_offset (param $0 i32) (param $1 v128) + (v128.store64_lane 3 offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane_offset2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memorya offset=32 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane_offset2 (param $0 i32) (param $1 v128) + (v128.store64_lane $memorya offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane_align_offset (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memoryb offset=32 align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane_align_offset (param $0 i32) (param $1 v128) + (v128.store64_lane 1 align=1 offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane_align_offset2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memoryd offset=32 align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane_align_offset2 (param $0 i32) (param $1 v128) + (v128.store64_lane $memoryd align=1 offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load32_zero (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32_zero $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32_zero (param $0 i32) (result v128) + (v128.load32_zero 0 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load32_zero2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32_zero $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32_zero2 (param $0 i32) (result v128) + (v128.load32_zero $memoryb + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load64_zero (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load64_zero $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_zero (param $0 i32) (result v128) + (v128.load64_zero 1 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load64_zero2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load64_zero $memoryc + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_zero2 (param $0 i32) (result v128) + (v128.load64_zero $memoryc + (local.get $0) + ) + ) +) + diff --git a/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast b/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast index 6c9a598bb..e0045579d 100644 --- a/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast +++ b/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast @@ -8,6 +8,8 @@ (type $t0 (func (param i32) (result i32))) ;; CHECK: (memory $memory 0) + ;; CHECK: (export "memory" (memory $memory)) + ;; CHECK: (export "fib" (func $fib)) ;; CHECK: (export "looped" (func $looped)) @@ -20,8 +22,6 @@ ;; CHECK: (export "t3" (func $t3)) - ;; CHECK: (export "memory" (memory $memory)) - ;; CHECK: (func $fib (; has Stack IR ;) (param $0 i32) (result i32) ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.le_s diff --git a/test/lit/passes/O4_disable-bulk-memory.wast b/test/lit/passes/O4_disable-bulk-memory.wast index 4a6293d65..8200df5a3 100644 --- a/test/lit/passes/O4_disable-bulk-memory.wast +++ b/test/lit/passes/O4_disable-bulk-memory.wast @@ -80,8 +80,8 @@ (global $global$6 i32 (i32.const 100)) ;; CHECK: (elem (i32.const 0) $null) - ;; CHECK: (export "memory" (memory $0)) - (export "memory" (memory $0)) + ;; CHECK: (export "memory" (memory $1)) + (export "memory" (memory $1)) ;; CHECK: (export "table" (table $0)) (export "table" (table $0)) ;; CHECK: (export "init" (func $assembly/index/init)) diff --git a/test/lit/wasm-split/export-name-already-exists.wast b/test/lit/wasm-split/export-name-already-exists.wast index 708929e98..83951795a 100644 --- a/test/lit/wasm-split/export-name-already-exists.wast +++ b/test/lit/wasm-split/export-name-already-exists.wast @@ -4,5 +4,6 @@ ;; CHECK: error: Export foo already exists. (module + (memory 0 0) (export "foo" (memory 0 0)) ) diff --git a/test/lit/wasm-split/instrument-in-memory.wast b/test/lit/wasm-split/instrument-in-memory.wast index 568ce2207..3a3c19d7f 100644 --- a/test/lit/wasm-split/instrument-in-memory.wast +++ b/test/lit/wasm-split/instrument-in-memory.wast @@ -7,6 +7,7 @@ (module (import "env" "foo" (func $foo)) (export "bar" (func $bar)) + (memory $0 1 1) (func $bar (call $foo) ) diff --git a/test/lit/wasm-split/merge-profiles.wast b/test/lit/wasm-split/merge-profiles.wast index fdaf6678e..2d09fefaa 100644 --- a/test/lit/wasm-split/merge-profiles.wast +++ b/test/lit/wasm-split/merge-profiles.wast @@ -22,6 +22,7 @@ ;; SPLIT-NEXT: Splitting out functions: qux{{$}} (module + (memory 0 0) (export "memory" (memory 0 0)) (export "foo" (func $foo)) (export "bar" (func $bar)) diff --git a/test/lit/wasm-split/mismatched-hashes.wast b/test/lit/wasm-split/mismatched-hashes.wast index fd3ebb8d3..347fb1746 100644 --- a/test/lit/wasm-split/mismatched-hashes.wast +++ b/test/lit/wasm-split/mismatched-hashes.wast @@ -19,5 +19,6 @@ ;; RUN: wasm-split %s --profile=%t.prof -o1 %t.1.wasm -o2 %t.2.wasm (module + (memory 0 0) (export "memory" (memory 0 0)) ) diff --git a/test/multi-memories-atomics64.wasm b/test/multi-memories-atomics64.wasm Binary files differnew file mode 100644 index 000000000..a13826285 --- /dev/null +++ b/test/multi-memories-atomics64.wasm diff --git a/test/multi-memories-atomics64.wasm.fromBinary b/test/multi-memories-atomics64.wasm.fromBinary new file mode 100644 index 000000000..565a5e63a --- /dev/null +++ b/test/multi-memories-atomics64.wasm.fromBinary @@ -0,0 +1,352 @@ +(module + (type $0 (func)) + (memory $appMemory (shared i64 23 256)) + (memory $dataMemory (shared i64 23 256)) + (memory $instrumentMemory (shared i64 23 256)) + (func $atomic-loadstore + (local $0 i64) + (local $1 i64) + (local $2 i32) + (drop + (i32.atomic.load8_u $appMemory offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load8_u $appMemory offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load16_u $dataMemory offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load16_u $instrumentMemory offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load $dataMemory offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load $appMemory offset=4 + (local.get $0) + ) + ) + (drop + (i64.atomic.load8_u $appMemory + (local.get $0) + ) + ) + (drop + (i64.atomic.load8_u $dataMemory + (local.get $0) + ) + ) + (drop + (i64.atomic.load16_u $appMemory + (local.get $0) + ) + ) + (drop + (i64.atomic.load16_u $appMemory + (local.get $0) + ) + ) + (drop + (i64.atomic.load32_u $instrumentMemory + (local.get $0) + ) + ) + (drop + (i64.atomic.load32_u $appMemory + (local.get $0) + ) + ) + (drop + (i64.atomic.load $appMemory + (local.get $0) + ) + ) + (drop + (i64.atomic.load $instrumentMemory + (local.get $0) + ) + ) + (i32.atomic.store $appMemory offset=4 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store $appMemory offset=4 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store8 $instrumentMemory offset=4 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store8 $dataMemory offset=4 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store16 $appMemory offset=4 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store16 $dataMemory offset=4 + (local.get $0) + (local.get $2) + ) + (i64.atomic.store $appMemory offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store $appMemory offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store8 $dataMemory offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store8 $instrumentMemory offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store16 $appMemory offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store16 $appMemory offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store32 $instrumentMemory offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store32 $dataMemory offset=4 + (local.get $0) + (local.get $1) + ) + ) + (func $atomic-rmw + (local $0 i64) + (local $1 i64) + (local $2 i32) + (drop + (i32.atomic.rmw.add $dataMemory offset=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw.add $instrumentMemory offset=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.add_u $appMemory offset=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.add_u $appMemory offset=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw16.and_u $dataMemory + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw16.and_u $instrumentMemory + (local.get $0) + (local.get $2) + ) + ) + (drop + (i64.atomic.rmw32.or_u $appMemory + (local.get $0) + (local.get $1) + ) + ) + (drop + (i64.atomic.rmw32.or_u $appMemory + (local.get $0) + (local.get $1) + ) + ) + (drop + (i32.atomic.rmw8.xchg_u $appMemory + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.xchg_u $dataMemory + (local.get $0) + (local.get $2) + ) + ) + ) + (func $atomic-cmpxchg + (local $0 i64) + (local $1 i64) + (local $2 i32) + (drop + (i32.atomic.rmw.cmpxchg $appMemory offset=4 + (local.get $0) + (local.get $2) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw.cmpxchg $instrumentMemory offset=4 + (local.get $0) + (local.get $2) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.cmpxchg_u $appMemory + (local.get $0) + (local.get $2) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.cmpxchg_u $appMemory + (local.get $0) + (local.get $2) + (local.get $2) + ) + ) + (drop + (i64.atomic.rmw.cmpxchg $appMemory offset=4 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (i64.atomic.rmw.cmpxchg $dataMemory offset=4 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (i64.atomic.rmw32.cmpxchg_u $instrumentMemory + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (i64.atomic.rmw32.cmpxchg_u $dataMemory + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + ) + (func $atomic-wait-notify + (local $0 i64) + (local $1 i64) + (local $2 i32) + (drop + (memory.atomic.wait32 $dataMemory + (local.get $0) + (local.get $2) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait32 $instrumentMemory + (local.get $0) + (local.get $2) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait32 $appMemory offset=4 + (local.get $0) + (local.get $2) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait32 $instrumentMemory offset=4 + (local.get $0) + (local.get $2) + (local.get $1) + ) + ) + (drop + (memory.atomic.notify $dataMemory + (local.get $0) + (local.get $2) + ) + ) + (drop + (memory.atomic.notify $dataMemory + (local.get $0) + (local.get $2) + ) + ) + (drop + (memory.atomic.notify $appMemory offset=24 + (local.get $0) + (local.get $2) + ) + ) + (drop + (memory.atomic.notify $dataMemory offset=24 + (local.get $0) + (local.get $2) + ) + ) + (drop + (memory.atomic.wait64 $instrumentMemory + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait64 $instrumentMemory + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait64 $appMemory offset=16 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait64 $appMemory offset=16 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + ) + (func $atomic-fence + (atomic.fence) + ) +) + diff --git a/test/multi-memories-basics.wasm b/test/multi-memories-basics.wasm Binary files differnew file mode 100644 index 000000000..d75c74cff --- /dev/null +++ b/test/multi-memories-basics.wasm diff --git a/test/multi-memories-basics.wasm.fromBinary b/test/multi-memories-basics.wasm.fromBinary new file mode 100644 index 000000000..62b926531 --- /dev/null +++ b/test/multi-memories-basics.wasm.fromBinary @@ -0,0 +1,117 @@ +(module + (type $none_=>_none (func)) + (type $none_=>_i32 (func (result i32))) + (import "env" "memory" (memory $importedMemory 1 1)) + (memory $memory1 1 500) + (memory $memory2 1 800) + (memory $memory3 1 400) + (data (i32.const 0) "abcd") + (func $memory.fill + (memory.fill $memory2 + (i32.const 0) + (i32.const 1) + (i32.const 2) + ) + ) + (func $memory.copy + (memory.copy $memory2 $memory3 + (i32.const 512) + (i32.const 0) + (i32.const 12) + ) + ) + (func $memory.init + (memory.init $memory1 0 + (i32.const 0) + (i32.const 0) + (i32.const 45) + ) + ) + (func $memory.grow (result i32) + (memory.grow $memory3 + (i32.const 10) + ) + ) + (func $memory.size (result i32) + (memory.size $memory3) + ) + (func $loads + (drop + (i32.load $memory1 + (i32.const 12) + ) + ) + (drop + (i32.load $memory3 + (i32.const 12) + ) + ) + (drop + (i32.load16_s $memory2 + (i32.const 12) + ) + ) + (drop + (i32.load16_s $memory2 + (i32.const 12) + ) + ) + (drop + (i32.load8_s $memory3 + (i32.const 12) + ) + ) + (drop + (i32.load8_s $memory3 + (i32.const 12) + ) + ) + (drop + (i32.load16_u $memory1 + (i32.const 12) + ) + ) + (drop + (i32.load16_u $memory1 + (i32.const 12) + ) + ) + (drop + (i32.load8_u $memory2 + (i32.const 12) + ) + ) + (drop + (i32.load8_u $memory2 + (i32.const 12) + ) + ) + ) + (func $stores + (i32.store $memory1 + (i32.const 12) + (i32.const 115) + ) + (i32.store $memory1 + (i32.const 12) + (i32.const 115) + ) + (i32.store16 $memory2 + (i32.const 20) + (i32.const 31353) + ) + (i32.store16 $importedMemory + (i32.const 20) + (i32.const 31353) + ) + (i32.store8 $memory3 + (i32.const 23) + (i32.const 120) + ) + (i32.store8 $memory3 + (i32.const 23) + (i32.const 120) + ) + ) +) + diff --git a/test/multi-memories-simd.wasm b/test/multi-memories-simd.wasm Binary files differnew file mode 100644 index 000000000..e8925efd6 --- /dev/null +++ b/test/multi-memories-simd.wasm diff --git a/test/multi-memories-simd.wasm.fromBinary b/test/multi-memories-simd.wasm.fromBinary new file mode 100644 index 000000000..48cde73c3 --- /dev/null +++ b/test/multi-memories-simd.wasm.fromBinary @@ -0,0 +1,320 @@ +(module + (type $i32_=>_v128 (func (param i32) (result v128))) + (type $i32_v128_=>_none (func (param i32 v128))) + (type $i32_v128_=>_v128 (func (param i32 v128) (result v128))) + (memory $memorya 1 1) + (memory $memoryb 1 1) + (memory $memoryc 1 1) + (memory $memoryd 1 1) + (func $v128.load (param $0 i32) (result v128) + (v128.load $memorya + (local.get $0) + ) + ) + (func $v128.load2 (param $0 i32) (result v128) + (v128.load $memoryb + (local.get $0) + ) + ) + (func $v128.load8x8_s (param $0 i32) (result v128) + (v128.load8x8_s $memoryc + (local.get $0) + ) + ) + (func $v128.load8x8_s2 (param $0 i32) (result v128) + (v128.load8x8_s $memoryb + (local.get $0) + ) + ) + (func $v128.load8x8_u (param $0 i32) (result v128) + (v128.load8x8_u $memoryd + (local.get $0) + ) + ) + (func $v128.load8x8_u2 (param $0 i32) (result v128) + (v128.load8x8_u $memoryd + (local.get $0) + ) + ) + (func $v128.load16x4_s (param $0 i32) (result v128) + (v128.load16x4_s $memorya + (local.get $0) + ) + ) + (func $v128.load16x4_s2 (param $0 i32) (result v128) + (v128.load16x4_s $memoryb + (local.get $0) + ) + ) + (func $v128.load16x4_u (param $0 i32) (result v128) + (v128.load16x4_u $memorya + (local.get $0) + ) + ) + (func $v128.load16x4_u2 (param $0 i32) (result v128) + (v128.load16x4_u $memorya + (local.get $0) + ) + ) + (func $v128.load32x2_s (param $0 i32) (result v128) + (v128.load32x2_s $memoryc + (local.get $0) + ) + ) + (func $v128.load32x2_s2 (param $0 i32) (result v128) + (v128.load32x2_s $memoryb + (local.get $0) + ) + ) + (func $v128.load32x2_u (param $0 i32) (result v128) + (v128.load32x2_u $memoryb + (local.get $0) + ) + ) + (func $v128.load32x2_u2 (param $0 i32) (result v128) + (v128.load32x2_u $memoryc + (local.get $0) + ) + ) + (func $v128.load8_splat (param $0 i32) (result v128) + (v128.load8_splat $memoryb + (local.get $0) + ) + ) + (func $v128.load8_splat2 (param $0 i32) (result v128) + (v128.load8_splat $memoryb + (local.get $0) + ) + ) + (func $v128.load16_splat (param $0 i32) (result v128) + (v128.load16_splat $memorya + (local.get $0) + ) + ) + (func $v128.load16_splat2 (param $0 i32) (result v128) + (v128.load16_splat $memorya + (local.get $0) + ) + ) + (func $v128.load32_splat (param $0 i32) (result v128) + (v128.load32_splat $memoryb + (local.get $0) + ) + ) + (func $v128.load32_splat2 (param $0 i32) (result v128) + (v128.load32_splat $memoryd + (local.get $0) + ) + ) + (func $v128.load64_splat (param $0 i32) (result v128) + (v128.load64_splat $memoryb + (local.get $0) + ) + ) + (func $v128.load64_splat2 (param $0 i32) (result v128) + (v128.load64_splat $memorya + (local.get $0) + ) + ) + (func $v128.store (param $0 i32) (param $1 v128) + (v128.store $memorya + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store2 (param $0 i32) (param $1 v128) + (v128.store $memoryb + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load8_lane (param $0 i32) (param $1 v128) (result v128) + (v128.load8_lane $memorya 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load8_lane2 (param $0 i32) (param $1 v128) (result v128) + (v128.load8_lane $memoryb 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load16_lane (param $0 i32) (param $1 v128) (result v128) + (v128.load16_lane $memoryb 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load16_lane2 (param $0 i32) (param $1 v128) (result v128) + (v128.load16_lane $memoryd 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load32_lane (param $0 i32) (param $1 v128) (result v128) + (v128.load32_lane $memorya 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load32_lane2 (param $0 i32) (param $1 v128) (result v128) + (v128.load32_lane $memoryb 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load64_lane (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memoryd 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load64_lane2 (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memoryb 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load64_lane_align (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memorya align=1 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load64_lane_align2 (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memoryb align=1 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load64_lane_offset (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memoryc offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load64_lane_offset2 (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memoryb offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load64_lane_align_offset (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memorya offset=32 align=1 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load64_lane_align_offset2 (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memoryd offset=32 align=1 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store8_lane (param $0 i32) (param $1 v128) + (v128.store8_lane $memorya 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store8_lane2 (param $0 i32) (param $1 v128) + (v128.store8_lane $memoryd 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store16_lane (param $0 i32) (param $1 v128) + (v128.store16_lane $memorya 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store16_lane2 (param $0 i32) (param $1 v128) + (v128.store16_lane $memoryb 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store32_lane (param $0 i32) (param $1 v128) + (v128.store32_lane $memoryb 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store32_lane2 (param $0 i32) (param $1 v128) + (v128.store32_lane $memoryc 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store64_lane (param $0 i32) (param $1 v128) + (v128.store64_lane $memoryc 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store64_lane2 (param $0 i32) (param $1 v128) + (v128.store64_lane $memoryb 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store64_lane_align (param $0 i32) (param $1 v128) + (v128.store64_lane $memoryb align=1 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store64_lane_align2 (param $0 i32) (param $1 v128) + (v128.store64_lane $memorya align=1 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store64_lane_offset (param $0 i32) (param $1 v128) + (v128.store64_lane $memoryd offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store64_lane_offset2 (param $0 i32) (param $1 v128) + (v128.store64_lane $memorya offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store64_lane_align_offset (param $0 i32) (param $1 v128) + (v128.store64_lane $memoryb offset=32 align=1 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.store64_lane_align_offset2 (param $0 i32) (param $1 v128) + (v128.store64_lane $memoryd offset=32 align=1 0 + (local.get $0) + (local.get $1) + ) + ) + (func $v128.load32_zero (param $0 i32) (result v128) + (v128.load32_zero $memorya + (local.get $0) + ) + ) + (func $v128.load32_zero2 (param $0 i32) (result v128) + (v128.load32_zero $memoryb + (local.get $0) + ) + ) + (func $v128.load64_zero (param $0 i32) (result v128) + (v128.load64_zero $memoryb + (local.get $0) + ) + ) + (func $v128.load64_zero2 (param $0 i32) (result v128) + (v128.load64_zero $memoryc + (local.get $0) + ) + ) +) + diff --git a/test/passes/O3_low-memory-unused_metrics.txt b/test/passes/O3_low-memory-unused_metrics.txt index d33277eb6..3bdce2921 100644 --- a/test/passes/O3_low-memory-unused_metrics.txt +++ b/test/passes/O3_low-memory-unused_metrics.txt @@ -3,6 +3,8 @@ total [funcs] : 1 [globals] : 0 [imports] : 10 + [memories] : 0 + [memory-data] : 0 [table-data] : 0 [tables] : 0 [tags] : 0 diff --git a/test/passes/converge_O3_metrics.bin.txt b/test/passes/converge_O3_metrics.bin.txt index fbf978433..4a2d8a5c1 100644 --- a/test/passes/converge_O3_metrics.bin.txt +++ b/test/passes/converge_O3_metrics.bin.txt @@ -3,6 +3,7 @@ total [funcs] : 6 [globals] : 1 [imports] : 3 + [memories] : 0 [memory-data] : 28 [table-data] : 429 [tables] : 0 @@ -229,6 +230,7 @@ total [funcs] : 6 [globals] : 0 -1 [imports] : 3 + [memories] : 0 [memory-data] : 28 [table-data] : 429 [tables] : 0 @@ -448,6 +450,7 @@ total [funcs] : 6 [globals] : 0 [imports] : 3 + [memories] : 0 [memory-data] : 28 [table-data] : 429 [tables] : 0 diff --git a/test/passes/func-metrics.txt b/test/passes/func-metrics.txt index a8b6885c4..9471e49e4 100644 --- a/test/passes/func-metrics.txt +++ b/test/passes/func-metrics.txt @@ -3,6 +3,7 @@ global [funcs] : 3 [globals] : 1 [imports] : 0 + [memories] : 1 [memory-data] : 9 [table-data] : 3 [tables] : 1 @@ -96,6 +97,7 @@ global [funcs] : 0 [globals] : 0 [imports] : 0 + [memories] : 0 [tables] : 0 [tags] : 0 [total] : 0 @@ -106,6 +108,7 @@ global [funcs] : 3 [globals] : 0 [imports] : 1 + [memories] : 0 [tables] : 0 [tags] : 0 [total] : 0 @@ -182,6 +185,7 @@ global [funcs] : 1 [globals] : 0 [imports] : 1 + [memories] : 0 [tables] : 0 [tags] : 0 [total] : 0 @@ -215,6 +219,7 @@ global [funcs] : 1 [globals] : 0 [imports] : 1 + [memories] : 0 [tables] : 0 [tags] : 0 [total] : 0 @@ -244,6 +249,7 @@ global [funcs] : 1 [globals] : 1 [imports] : 1 + [memories] : 0 [tables] : 0 [tags] : 0 [total] : 1 diff --git a/test/passes/fuzz_metrics_noprint.bin.txt b/test/passes/fuzz_metrics_noprint.bin.txt index 4c481cd8f..2df80ff72 100644 --- a/test/passes/fuzz_metrics_noprint.bin.txt +++ b/test/passes/fuzz_metrics_noprint.bin.txt @@ -3,6 +3,7 @@ total [funcs] : 50 [globals] : 7 [imports] : 4 + [memories] : 1 [memory-data] : 4 [table-data] : 17 [tables] : 1 diff --git a/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_optimize-level=3.txt b/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_optimize-level=3.txt index e94bc3531..b9624c55d 100644 --- a/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_optimize-level=3.txt +++ b/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_optimize-level=3.txt @@ -34,21 +34,21 @@ (local $temp f64) block $topmost (result f64) i32.const 8 - f64.load + f64.load $0 i32.const 16 - f64.load + f64.load $0 f64.add i32.const 16 - f64.load + f64.load $0 f64.neg f64.add i32.const 8 - f64.load + f64.load $0 f64.neg f64.add local.set $temp i32.const 24 - i32.load + i32.load $0 i32.const 0 i32.gt_s if @@ -56,7 +56,7 @@ br $topmost end i32.const 32 - f64.load + f64.load $0 f64.const 0 f64.gt if @@ -323,7 +323,7 @@ (func $i64-store32 (param $0 i32) (param $1 i64) local.get $0 local.get $1 - i64.store32 + i64.store32 $0 ) (func $return-unreachable (result i32) i32.const 1 diff --git a/test/passes/metrics_all-features.txt b/test/passes/metrics_all-features.txt index 255e809c2..bd3368b49 100644 --- a/test/passes/metrics_all-features.txt +++ b/test/passes/metrics_all-features.txt @@ -3,6 +3,7 @@ total [funcs] : 1 [globals] : 1 [imports] : 0 + [memories] : 1 [memory-data] : 9 [table-data] : 3 [tables] : 1 @@ -70,6 +71,7 @@ total [funcs] : 0 [globals] : 0 [imports] : 0 + [memories] : 0 [tables] : 0 [tags] : 0 [total] : 0 diff --git a/test/passes/metrics_strip-debug_metrics.bin.txt b/test/passes/metrics_strip-debug_metrics.bin.txt index 9760353e0..0022a8b54 100644 --- a/test/passes/metrics_strip-debug_metrics.bin.txt +++ b/test/passes/metrics_strip-debug_metrics.bin.txt @@ -3,6 +3,7 @@ total [funcs] : 1 [globals] : 0 [imports] : 0 + [memories] : 0 [tables] : 0 [tags] : 0 [total] : 1 @@ -13,6 +14,7 @@ total [funcs] : 1 [globals] : 0 [imports] : 0 + [memories] : 0 [tables] : 0 [tags] : 0 [total] : 1 diff --git a/test/passes/metrics_strip-producers_metrics.bin.txt b/test/passes/metrics_strip-producers_metrics.bin.txt index 072f7c827..428401ece 100644 --- a/test/passes/metrics_strip-producers_metrics.bin.txt +++ b/test/passes/metrics_strip-producers_metrics.bin.txt @@ -3,6 +3,7 @@ total [funcs] : 1 [globals] : 0 [imports] : 0 + [memories] : 0 [tables] : 0 [tags] : 0 [total] : 1 @@ -13,6 +14,7 @@ total [funcs] : 1 [globals] : 0 [imports] : 0 + [memories] : 0 [tables] : 0 [tags] : 0 [total] : 1 diff --git a/test/passes/print_g_metrics.bin.txt b/test/passes/print_g_metrics.bin.txt index ac035635d..2dbceb433 100644 --- a/test/passes/print_g_metrics.bin.txt +++ b/test/passes/print_g_metrics.bin.txt @@ -69,6 +69,7 @@ total [funcs] : 3 [globals] : 1 [imports] : 0 + [memories] : 0 [tables] : 0 [tags] : 0 [total] : 37 diff --git a/test/passes/sparse_matrix_liveness.bin.txt b/test/passes/sparse_matrix_liveness.bin.txt index b55f1023a..d669ee16f 100644 --- a/test/passes/sparse_matrix_liveness.bin.txt +++ b/test/passes/sparse_matrix_liveness.bin.txt @@ -3,6 +3,7 @@ total [funcs] : 1 [globals] : 0 [imports] : 0 + [memories] : 0 [tables] : 0 [tags] : 0 [total] : 4 @@ -16,6 +17,7 @@ total [funcs] : 1 [globals] : 0 [imports] : 0 + [memories] : 0 [tables] : 0 [tags] : 0 [total] : 4 diff --git a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt index ad0779876..aac1cbc83 100644 --- a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt +++ b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt @@ -3,6 +3,7 @@ total [funcs] : 12 [globals] : 6 [imports] : 5 + [memories] : 1 [memory-data] : 22 [table-data] : 4 [tables] : 1 diff --git a/test/spec/imports.wast b/test/spec/imports.wast index 43ffedaee..2ef8574e7 100644 --- a/test/spec/imports.wast +++ b/test/spec/imports.wast @@ -489,19 +489,6 @@ (assert_return (invoke "load" (i32.const 8)) (i32.const 0x100000)) (assert_trap (invoke "load" (i32.const 1000000)) "out of bounds memory access") -(assert_invalid - (module (import "" "" (memory 1)) (import "" "" (memory 1))) - "multiple memories" -) -(assert_invalid - (module (import "" "" (memory 1)) (memory 0)) - "multiple memories" -) -(assert_invalid - (module (memory 0) (memory 0)) - "multiple memories" -) - (module (import "test" "memory-2-inf" (memory 2))) (module (import "test" "memory-2-inf" (memory 1))) (module (import "test" "memory-2-inf" (memory 0))) diff --git a/test/spec/memory.wast b/test/spec/memory.wast index 3c426450a..c4e932b0e 100644 --- a/test/spec/memory.wast +++ b/test/spec/memory.wast @@ -5,9 +5,6 @@ (module (memory 1 256)) (module (memory 0 65536)) -(assert_invalid (module (memory 0) (memory 0)) "multiple memories") -(assert_invalid (module (memory (import "spectest" "memory") 0) (memory 0)) "multiple memories") - (module (memory (data)) (func (export "memsize") (result i32) (memory.size))) (assert_return (invoke "memsize") (i32.const 0)) (module (memory (data "")) (func (export "memsize") (result i32) (memory.size))) diff --git a/test/spec/memory64.wast b/test/spec/memory64.wast index da4ba591e..683bfe211 100644 --- a/test/spec/memory64.wast +++ b/test/spec/memory64.wast @@ -5,9 +5,6 @@ (module (memory i64 1 256)) (module (memory i64 0 65536)) -(assert_invalid (module (memory i64 0) (memory i64 0)) "multiple memories") -(assert_invalid (module (memory (import "spectest" "memory") i64 0) (memory i64 0)) "multiple memories") - (module (memory i64 (data)) (func (export "memsize") (result i64) (memory.size))) (assert_return (invoke "memsize") (i64.const 0)) (module (memory i64 (data "")) (func (export "memsize") (result i64) (memory.size))) diff --git a/test/spec/multi-memories_size.wast b/test/spec/multi-memories_size.wast new file mode 100644 index 000000000..8f0e7bdc3 --- /dev/null +++ b/test/spec/multi-memories_size.wast @@ -0,0 +1,35 @@ +(module + (memory $appMemory 0) + (memory $dataMemory 2) + (memory $instrumentMemory 4) + (func (export "size") (result i32) (memory.size)) + (func (export "grow") (param $sz i32) (drop (memory.grow (local.get $sz)))) + (func (export "size1") (result i32) (memory.size 1)) + (func (export "grow1") (param $sz i32) (drop (memory.grow 1 (local.get $sz)))) + (func (export "size2") (result i32) (memory.size 2)) + (func (export "grow2") (param $sz i32) (drop (memory.grow 2 (local.get $sz)))) +) + +(assert_return (invoke "size") (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1))) +(assert_return (invoke "size") (i32.const 1)) +(assert_return (invoke "grow" (i32.const 4))) +(assert_return (invoke "size") (i32.const 5)) +(assert_return (invoke "grow" (i32.const 0))) +(assert_return (invoke "size") (i32.const 5)) + +(assert_return (invoke "size1") (i32.const 2)) +(assert_return (invoke "grow1" (i32.const 2))) +(assert_return (invoke "size1") (i32.const 4)) +(assert_return (invoke "grow1" (i32.const 4))) +(assert_return (invoke "size1") (i32.const 8)) +(assert_return (invoke "grow1" (i32.const 0))) +(assert_return (invoke "size1") (i32.const 8)) + +(assert_return (invoke "size2") (i32.const 4)) +(assert_return (invoke "grow2" (i32.const 4))) +(assert_return (invoke "size2") (i32.const 8)) +(assert_return (invoke "grow2" (i32.const 8))) +(assert_return (invoke "size2") (i32.const 16)) +(assert_return (invoke "grow2" (i32.const 0))) +(assert_return (invoke "size2") (i32.const 16)) diff --git a/test/spec/old_import.wast b/test/spec/old_import.wast index a26c16e48..eba633388 100644 --- a/test/spec/old_import.wast +++ b/test/spec/old_import.wast @@ -179,19 +179,6 @@ (assert_return (invoke "load" (i32.const 8)) (i32.const 0x100000)) (assert_trap (invoke "load" (i32.const 1000000)) "out of bounds memory access") -(assert_invalid - (module (import "" "" (memory 1)) (import "" "" (memory 1))) - "multiple memories" -) -(assert_invalid - (module (import "" "" (memory 1)) (memory 0)) - "multiple memories" -) -(assert_invalid - (module (memory 0) (memory 0)) - "multiple memories" -) - (assert_unlinkable (module (import "spectest" "unknown" (memory 1))) "unknown import" |