diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 26 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 662 | ||||
-rw-r--r-- | test/llvm_autogenerated/memory-addr64.s | 23 | ||||
-rw-r--r-- | test/llvm_autogenerated/memory-addr64.wast | 20 | ||||
m--------- | test/spec | 0 |
5 files changed, 348 insertions, 383 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 6ccd642ae..728215893 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -73,7 +73,7 @@ void test_core() { constF64Bits = BinaryenConst(module, BinaryenLiteralFloat64Bits(0xffff12345678abcdLL)); const char* switchValueNames[] = { "the-value" }; - const char* switchBodyNames[] = { "the-body" }; + const char* switchBodyNames[] = { "the-nothing" }; BinaryenExpressionRef callOperands2[] = { makeInt32(module, 13), makeFloat64(module, 3.7) }; BinaryenExpressionRef callOperands4[] = { makeInt32(module, 13), makeInt64(module, 37), makeFloat32(module, 1.3f), makeFloat64(module, 3.7) }; @@ -81,7 +81,7 @@ void test_core() { BinaryenType params[4] = { BinaryenInt32(), BinaryenInt64(), BinaryenFloat32(), BinaryenFloat64() }; BinaryenFunctionTypeRef iiIfF = BinaryenAddFunctionType(module, "iiIfF", BinaryenInt32(), params, 4); - BinaryenExpressionRef bodyList[] = { + BinaryenExpressionRef valueList[] = { // Unary makeUnary(module, BinaryenClz(), 1), makeUnary(module, BinaryenCtz(), 2), @@ -160,16 +160,19 @@ void test_core() { BinaryenLoop(module, NULL, "in2", makeInt32(module, 0)), BinaryenLoop(module, NULL, NULL, makeInt32(module, 0)), BinaryenBreak(module, "the-value", makeInt32(module, 0), makeInt32(module, 1)), - BinaryenBreak(module, "the-body", makeInt32(module, 2), NULL), + BinaryenBreak(module, "the-nothing", makeInt32(module, 2), NULL), BinaryenBreak(module, "the-value", NULL, makeInt32(module, 3)), - BinaryenBreak(module, "the-body", NULL, NULL), + BinaryenBreak(module, "the-nothing", NULL, NULL), BinaryenSwitch(module, switchValueNames, 1, "the-value", makeInt32(module, 0), makeInt32(module, 1)), - BinaryenSwitch(module, switchBodyNames, 1, "the-body", makeInt32(module, 2), NULL), + BinaryenSwitch(module, switchBodyNames, 1, "the-nothing", makeInt32(module, 2), NULL), BinaryenUnary(module, BinaryenEqZ(), // check the output type of the call node BinaryenCall(module, "kitchen-sinker", callOperands4, 4, BinaryenInt32()) ), BinaryenUnary(module, BinaryenEqZ(), // check the output type of the call node - BinaryenCallImport(module, "an-imported", callOperands2, 2, BinaryenFloat32()) + BinaryenUnary(module, + BinaryenTruncSFloat32ToInt32(), + BinaryenCallImport(module, "an-imported", callOperands2, 2, BinaryenFloat32()) + ) ), BinaryenUnary(module, BinaryenEqZ(), // check the output type of the call node BinaryenCallIndirect(module, makeInt32(module, 2449), callOperands4, 4, iiIfF) @@ -183,16 +186,17 @@ void test_core() { BinaryenStore(module, 4, 0, 0, makeInt32(module, 10), makeInt32(module, 11)), BinaryenStore(module, 8, 2, 4, makeInt32(module, 110), makeInt64(module, 111)), BinaryenSelect(module, makeInt32(module, 1), makeInt32(module, 3), makeInt32(module, 5)), - BinaryenReturn(module, NULL), - BinaryenReturn(module, makeFloat32(module, 1)), + BinaryenReturn(module, makeInt32(module, 1337)), // TODO: Host BinaryenNop(module), BinaryenUnreachable(module), }; - // Make the main body of the function. one block with a return value, one without - BinaryenExpressionRef value = BinaryenBlock(module, "the-value", bodyList, sizeof(bodyList) / sizeof(BinaryenExpressionRef)); - BinaryenExpressionRef body = BinaryenBlock(module, "the-body", &value, 1); + // Make the main body of the function. and one block with a return value, one without + BinaryenExpressionRef value = BinaryenBlock(module, "the-value", valueList, sizeof(valueList) / sizeof(BinaryenExpressionRef)); + BinaryenExpressionRef nothing = BinaryenBlock(module, "the-nothing", &value, 1); + BinaryenExpressionRef bodyList[] = { nothing, makeInt32(module, 42) }; + BinaryenExpressionRef body = BinaryenBlock(module, "the-body", bodyList, 2); // Create the function BinaryenType localTypes[] = { BinaryenInt32() }; diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index e36e9ba14..c4fb6a4af 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -19,340 +19,344 @@ BinaryenFloat64: 4 (func $kitchen-sinker (type $iiIfF) (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32) (local $4 i32) (block $the-body - (block $the-value - (i32.clz - (i32.const -10) - ) - (i64.ctz - (i64.const -22) - ) - (i32.popcnt - (i32.const -10) - ) - (f32.neg - (f32.const -33.61199951171875) - ) - (f64.abs - (f64.const -9005.841) - ) - (f32.ceil - (f32.const -33.61199951171875) - ) - (f64.floor - (f64.const -9005.841) - ) - (f32.trunc - (f32.const -33.61199951171875) - ) - (f32.nearest - (f32.const -33.61199951171875) - ) - (f64.sqrt - (f64.const -9005.841) - ) - (i32.eqz - (i32.const -10) - ) - (i64.extend_s/i32 - (i32.const -10) - ) - (i64.extend_u/i32 - (i32.const -10) - ) - (i32.wrap/i64 - (i64.const -22) - ) - (i32.trunc_s/f32 - (f32.const -33.61199951171875) - ) - (i64.trunc_s/f32 - (f32.const -33.61199951171875) - ) - (i32.trunc_u/f32 - (f32.const -33.61199951171875) - ) - (i64.trunc_u/f32 - (f32.const -33.61199951171875) - ) - (i32.trunc_s/f64 - (f64.const -9005.841) - ) - (i64.trunc_s/f64 - (f64.const -9005.841) - ) - (i32.trunc_u/f64 - (f64.const -9005.841) - ) - (i64.trunc_u/f64 - (f64.const -9005.841) - ) - (i32.reinterpret/f32 - (f32.const -33.61199951171875) - ) - (i64.reinterpret/f64 - (f64.const -9005.841) - ) - (f32.convert_s/i32 - (i32.const -10) - ) - (f64.convert_s/i32 - (i32.const -10) - ) - (f32.convert_u/i32 - (i32.const -10) - ) - (f64.convert_u/i32 - (i32.const -10) - ) - (f32.convert_s/i64 - (i64.const -22) - ) - (f64.convert_s/i64 - (i64.const -22) - ) - (f32.convert_u/i64 - (i64.const -22) - ) - (f64.convert_u/i64 - (i64.const -22) - ) - (f64.promote/f32 - (f32.const -33.61199951171875) - ) - (f32.demote/f64 - (f64.const -9005.841) - ) - (f32.reinterpret/i32 - (i32.const -10) - ) - (f64.reinterpret/i64 - (i64.const -22) - ) - (i32.add - (i32.const -10) - (i32.const -11) - ) - (f64.sub - (f64.const -9005.841) - (f64.const -9007.333) - ) - (i32.div_s - (i32.const -10) - (i32.const -11) - ) - (i64.div_u - (i64.const -22) - (i64.const -23) - ) - (i64.rem_s - (i64.const -22) - (i64.const -23) - ) - (i32.rem_u - (i32.const -10) - (i32.const -11) - ) - (i32.and - (i32.const -10) - (i32.const -11) - ) - (i64.or - (i64.const -22) - (i64.const -23) - ) - (i32.xor - (i32.const -10) - (i32.const -11) - ) - (i64.shl - (i64.const -22) - (i64.const -23) - ) - (i64.shr_u - (i64.const -22) - (i64.const -23) - ) - (i32.shr_s - (i32.const -10) - (i32.const -11) - ) - (i32.rotl - (i32.const -10) - (i32.const -11) - ) - (i64.rotr - (i64.const -22) - (i64.const -23) - ) - (f32.div - (f32.const -33.61199951171875) - (f32.const -62.5) - ) - (f64.copysign - (f64.const -9005.841) - (f64.const -9007.333) - ) - (f32.min - (f32.const -33.61199951171875) - (f32.const -62.5) - ) - (f64.max - (f64.const -9005.841) - (f64.const -9007.333) - ) - (i32.eq - (i32.const -10) - (i32.const -11) - ) - (f32.ne - (f32.const -33.61199951171875) - (f32.const -62.5) - ) - (i32.lt_s - (i32.const -10) - (i32.const -11) - ) - (i64.lt_u - (i64.const -22) - (i64.const -23) - ) - (i64.le_s - (i64.const -22) - (i64.const -23) - ) - (i32.le_u - (i32.const -10) - (i32.const -11) - ) - (i64.gt_s - (i64.const -22) - (i64.const -23) - ) - (i32.gt_u - (i32.const -10) - (i32.const -11) - ) - (i32.ge_s - (i32.const -10) - (i32.const -11) - ) - (i64.ge_u - (i64.const -22) - (i64.const -23) - ) - (f32.lt - (f32.const -33.61199951171875) - (f32.const -62.5) - ) - (f64.le - (f64.const -9005.841) - (f64.const -9007.333) - ) - (f64.gt - (f64.const -9005.841) - (f64.const -9007.333) - ) - (f32.ge - (f32.const -33.61199951171875) - (f32.const -62.5) - ) - (block - ) - (if - (i32.const 1) - (i32.const 2) - (i32.const 3) - ) - (if - (i32.const 4) - (i32.const 5) - ) - (loop $out $in - (i32.const 0) - ) - (loop $in2 - (i32.const 0) - ) - (loop - (i32.const 0) - ) - (br_if $the-value - (i32.const 1) - (i32.const 0) - ) - (br_if $the-body - (i32.const 2) - ) - (br $the-value - (i32.const 3) - ) - (br $the-body) - (br_table $the-value $the-value - (i32.const 1) - (i32.const 0) - ) - (br_table $the-body $the-body - (i32.const 2) - ) - (i32.eqz - (call $kitchen-sinker - (i32.const 13) - (i64.const 37) - (f32.const 1.2999999523162842) - (f64.const 3.7) + (block $the-nothing + (block $the-value + (i32.clz + (i32.const -10) ) - ) - (f32.eqz - (call_import $an-imported - (i32.const 13) - (f64.const 3.7) + (i64.ctz + (i64.const -22) ) - ) - (i32.eqz - (call_indirect $iiIfF - (i32.const 2449) - (i32.const 13) - (i64.const 37) - (f32.const 1.2999999523162842) - (f64.const 3.7) + (i32.popcnt + (i32.const -10) ) + (f32.neg + (f32.const -33.61199951171875) + ) + (f64.abs + (f64.const -9005.841) + ) + (f32.ceil + (f32.const -33.61199951171875) + ) + (f64.floor + (f64.const -9005.841) + ) + (f32.trunc + (f32.const -33.61199951171875) + ) + (f32.nearest + (f32.const -33.61199951171875) + ) + (f64.sqrt + (f64.const -9005.841) + ) + (i32.eqz + (i32.const -10) + ) + (i64.extend_s/i32 + (i32.const -10) + ) + (i64.extend_u/i32 + (i32.const -10) + ) + (i32.wrap/i64 + (i64.const -22) + ) + (i32.trunc_s/f32 + (f32.const -33.61199951171875) + ) + (i64.trunc_s/f32 + (f32.const -33.61199951171875) + ) + (i32.trunc_u/f32 + (f32.const -33.61199951171875) + ) + (i64.trunc_u/f32 + (f32.const -33.61199951171875) + ) + (i32.trunc_s/f64 + (f64.const -9005.841) + ) + (i64.trunc_s/f64 + (f64.const -9005.841) + ) + (i32.trunc_u/f64 + (f64.const -9005.841) + ) + (i64.trunc_u/f64 + (f64.const -9005.841) + ) + (i32.reinterpret/f32 + (f32.const -33.61199951171875) + ) + (i64.reinterpret/f64 + (f64.const -9005.841) + ) + (f32.convert_s/i32 + (i32.const -10) + ) + (f64.convert_s/i32 + (i32.const -10) + ) + (f32.convert_u/i32 + (i32.const -10) + ) + (f64.convert_u/i32 + (i32.const -10) + ) + (f32.convert_s/i64 + (i64.const -22) + ) + (f64.convert_s/i64 + (i64.const -22) + ) + (f32.convert_u/i64 + (i64.const -22) + ) + (f64.convert_u/i64 + (i64.const -22) + ) + (f64.promote/f32 + (f32.const -33.61199951171875) + ) + (f32.demote/f64 + (f64.const -9005.841) + ) + (f32.reinterpret/i32 + (i32.const -10) + ) + (f64.reinterpret/i64 + (i64.const -22) + ) + (i32.add + (i32.const -10) + (i32.const -11) + ) + (f64.sub + (f64.const -9005.841) + (f64.const -9007.333) + ) + (i32.div_s + (i32.const -10) + (i32.const -11) + ) + (i64.div_u + (i64.const -22) + (i64.const -23) + ) + (i64.rem_s + (i64.const -22) + (i64.const -23) + ) + (i32.rem_u + (i32.const -10) + (i32.const -11) + ) + (i32.and + (i32.const -10) + (i32.const -11) + ) + (i64.or + (i64.const -22) + (i64.const -23) + ) + (i32.xor + (i32.const -10) + (i32.const -11) + ) + (i64.shl + (i64.const -22) + (i64.const -23) + ) + (i64.shr_u + (i64.const -22) + (i64.const -23) + ) + (i32.shr_s + (i32.const -10) + (i32.const -11) + ) + (i32.rotl + (i32.const -10) + (i32.const -11) + ) + (i64.rotr + (i64.const -22) + (i64.const -23) + ) + (f32.div + (f32.const -33.61199951171875) + (f32.const -62.5) + ) + (f64.copysign + (f64.const -9005.841) + (f64.const -9007.333) + ) + (f32.min + (f32.const -33.61199951171875) + (f32.const -62.5) + ) + (f64.max + (f64.const -9005.841) + (f64.const -9007.333) + ) + (i32.eq + (i32.const -10) + (i32.const -11) + ) + (f32.ne + (f32.const -33.61199951171875) + (f32.const -62.5) + ) + (i32.lt_s + (i32.const -10) + (i32.const -11) + ) + (i64.lt_u + (i64.const -22) + (i64.const -23) + ) + (i64.le_s + (i64.const -22) + (i64.const -23) + ) + (i32.le_u + (i32.const -10) + (i32.const -11) + ) + (i64.gt_s + (i64.const -22) + (i64.const -23) + ) + (i32.gt_u + (i32.const -10) + (i32.const -11) + ) + (i32.ge_s + (i32.const -10) + (i32.const -11) + ) + (i64.ge_u + (i64.const -22) + (i64.const -23) + ) + (f32.lt + (f32.const -33.61199951171875) + (f32.const -62.5) + ) + (f64.le + (f64.const -9005.841) + (f64.const -9007.333) + ) + (f64.gt + (f64.const -9005.841) + (f64.const -9007.333) + ) + (f32.ge + (f32.const -33.61199951171875) + (f32.const -62.5) + ) + (block + ) + (if + (i32.const 1) + (i32.const 2) + (i32.const 3) + ) + (if + (i32.const 4) + (i32.const 5) + ) + (loop $out $in + (i32.const 0) + ) + (loop $in2 + (i32.const 0) + ) + (loop + (i32.const 0) + ) + (br_if $the-value + (i32.const 1) + (i32.const 0) + ) + (br_if $the-nothing + (i32.const 2) + ) + (br $the-value + (i32.const 3) + ) + (br $the-nothing) + (br_table $the-value $the-value + (i32.const 1) + (i32.const 0) + ) + (br_table $the-nothing $the-nothing + (i32.const 2) + ) + (i32.eqz + (call $kitchen-sinker + (i32.const 13) + (i64.const 37) + (f32.const 1.2999999523162842) + (f64.const 3.7) + ) + ) + (i32.eqz + (i32.trunc_s/f32 + (call_import $an-imported + (i32.const 13) + (f64.const 3.7) + ) + ) + ) + (i32.eqz + (call_indirect $iiIfF + (i32.const 2449) + (i32.const 13) + (i64.const 37) + (f32.const 1.2999999523162842) + (f64.const 3.7) + ) + ) + (get_local $0) + (set_local $0 + (i32.const 101) + ) + (i32.load + (i32.const 1) + ) + (i64.load8_s offset=2 align=4 + (i32.const 8) + ) + (f32.load + (i32.const 2) + ) + (f64.load offset=2 + (i32.const 9) + ) + (i32.store + (i32.const 10) + (i32.const 11) + ) + (i64.store offset=2 align=4 + (i32.const 110) + (i64.const 111) + ) + (select + (i32.const 3) + (i32.const 5) + (i32.const 1) + ) + (return + (i32.const 1337) + ) + (nop) + (unreachable) ) - (get_local $0) - (set_local $0 - (i32.const 101) - ) - (i32.load - (i32.const 1) - ) - (i64.load8_s offset=2 align=4 - (i32.const 8) - ) - (f32.load - (i32.const 2) - ) - (f64.load offset=2 - (i32.const 9) - ) - (i32.store - (i32.const 10) - (i32.const 11) - ) - (i64.store offset=2 align=4 - (i32.const 110) - (i64.const 111) - ) - (select - (i32.const 3) - (i32.const 5) - (i32.const 1) - ) - (return) - (return - (f32.const 1) - ) - (nop) - (unreachable) ) + (i32.const 42) ) ) (func $starter (type $v) diff --git a/test/llvm_autogenerated/memory-addr64.s b/test/llvm_autogenerated/memory-addr64.s deleted file mode 100644 index 7a8ca3e8e..000000000 --- a/test/llvm_autogenerated/memory-addr64.s +++ /dev/null @@ -1,23 +0,0 @@ - .text - .file "/s/llvm/llvm/test/CodeGen/WebAssembly/memory-addr64.ll" - .globl memory_size - .type memory_size,@function -memory_size: - .result i64 - memory_size $push0= - return $pop0 - .endfunc -.Lfunc_end0: - .size memory_size, .Lfunc_end0-memory_size - - .globl grow_memory - .type grow_memory,@function -grow_memory: - .param i64 - grow_memory $0 - return - .endfunc -.Lfunc_end1: - .size grow_memory, .Lfunc_end1-grow_memory - - diff --git a/test/llvm_autogenerated/memory-addr64.wast b/test/llvm_autogenerated/memory-addr64.wast deleted file mode 100644 index b9b52d85f..000000000 --- a/test/llvm_autogenerated/memory-addr64.wast +++ /dev/null @@ -1,20 +0,0 @@ -(module - (memory 1 - (segment 4 "\10\04\00\00") - ) - (export "memory" memory) - (export "memory_size" $memory_size) - (export "grow_memory" $grow_memory) - (func $memory_size (result i64) - (return - (current_memory) - ) - ) - (func $grow_memory (param $$0 i64) - (grow_memory - (get_local $$0) - ) - (return) - ) -) -;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] } diff --git a/test/spec b/test/spec -Subproject 3b4a2a969b104915cbc6695c83810f72769ff1b +Subproject 613dd58acfcc97c500dd6a77d88c716225db6e8 |