summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/s2wasm.h6
-rw-r--r--src/wasm.h4
-rw-r--r--test/dot_s/memops.wast2
-rw-r--r--test/llvm_autogenerated/byval.wast2
-rw-r--r--test/llvm_autogenerated/i32-load-store-alignment.wast10
-rw-r--r--test/llvm_autogenerated/i64-load-store-alignment.wast18
-rw-r--r--test/llvm_autogenerated/load-store-i1.wast4
-rw-r--r--test/llvm_autogenerated/offset.wast8
-rw-r--r--test/llvm_autogenerated/store-trunc.wast10
-rw-r--r--test/s2wasm_known_binaryen_shell_test_failures.txt14
10 files changed, 34 insertions, 44 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h
index ac62046d8..5557cc2ff 100644
--- a/src/s2wasm.h
+++ b/src/s2wasm.h
@@ -21,6 +21,8 @@
#ifndef wasm_s2wasm_h
#define wasm_s2wasm_h
+#include <limits.h>
+
#include "wasm.h"
#include "parsing.h"
#include "asm_v_wasm.h"
@@ -649,7 +651,7 @@ class S2WasmBuilder {
skipComma();
auto curr = allocator.alloc<Load>();
curr->type = type;
- int32_t bytes = getInt()/8;
+ int32_t bytes = getInt() / CHAR_BIT;
curr->bytes = bytes > 0 ? bytes : getWasmTypeSize(type);
curr->signed_ = match("_s");
match("_u");
@@ -669,7 +671,7 @@ class S2WasmBuilder {
skipComma();
auto curr = allocator.alloc<Store>();
curr->type = type;
- int32_t bytes = getInt();
+ int32_t bytes = getInt() / CHAR_BIT;
curr->bytes = bytes > 0 ? bytes : getWasmTypeSize(type);
Name assign = getAssign();
getConst(&curr->offset);
diff --git a/src/wasm.h b/src/wasm.h
index e30a891b9..8701bd2f4 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -758,11 +758,13 @@ public:
std::ostream& doPrint(std::ostream &o, unsigned indent) {
o << '(';
prepareColor(o) << printWasmType(type) << ".store";
- if (bytes < 4) {
+ if (bytes < 4 || (type == i64 && bytes < 8)) {
if (bytes == 1) {
o << '8';
} else if (bytes == 2) {
o << "16";
+ } else if (bytes == 4) {
+ o << "32";
} else {
abort();
}
diff --git a/test/dot_s/memops.wast b/test/dot_s/memops.wast
index 54b5c0be5..e6734d474 100644
--- a/test/dot_s/memops.wast
+++ b/test/dot_s/memops.wast
@@ -79,7 +79,7 @@
(get_local $$10)
)
)
- (i32.store align=8
+ (i32.store8 align=1
(i32.add
(get_local $$10)
(get_local $$4)
diff --git a/test/llvm_autogenerated/byval.wast b/test/llvm_autogenerated/byval.wast
index 64ae7943a..cd7f83556 100644
--- a/test/llvm_autogenerated/byval.wast
+++ b/test/llvm_autogenerated/byval.wast
@@ -268,7 +268,7 @@
(get_local $$4)
)
)
- (i32.store align=4
+ (i32.store8 align=4
(i32.add
(get_local $$4)
(i32.const 32)
diff --git a/test/llvm_autogenerated/i32-load-store-alignment.wast b/test/llvm_autogenerated/i32-load-store-alignment.wast
index 9200f474f..2ff038633 100644
--- a/test/llvm_autogenerated/i32-load-store-alignment.wast
+++ b/test/llvm_autogenerated/i32-load-store-alignment.wast
@@ -126,35 +126,35 @@
(return)
)
(func $sti8_a1 (param $$0 i32) (param $$1 i32)
- (i32.store align=8
+ (i32.store8 align=1
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $sti8_a2 (param $$0 i32) (param $$1 i32)
- (i32.store align=2
+ (i32.store8 align=2
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $sti16_a1 (param $$0 i32) (param $$1 i32)
- (i32.store align=1
+ (i32.store16 align=1
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $sti16_a2 (param $$0 i32) (param $$1 i32)
- (i32.store align=16
+ (i32.store16 align=2
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $sti16_a4 (param $$0 i32) (param $$1 i32)
- (i32.store align=4
+ (i32.store16 align=4
(get_local $$0)
(get_local $$1)
)
diff --git a/test/llvm_autogenerated/i64-load-store-alignment.wast b/test/llvm_autogenerated/i64-load-store-alignment.wast
index ec57fbe27..55b620f28 100644
--- a/test/llvm_autogenerated/i64-load-store-alignment.wast
+++ b/test/llvm_autogenerated/i64-load-store-alignment.wast
@@ -178,63 +178,63 @@
(return)
)
(func $sti8_a1 (param $$0 i32) (param $$1 i64)
- (i64.store align=8
+ (i64.store8 align=1
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $sti8_a2 (param $$0 i32) (param $$1 i64)
- (i64.store align=2
+ (i64.store8 align=2
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $sti16_a1 (param $$0 i32) (param $$1 i64)
- (i64.store align=1
+ (i64.store16 align=1
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $sti16_a2 (param $$0 i32) (param $$1 i64)
- (i64.store align=16
+ (i64.store16 align=2
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $sti16_a4 (param $$0 i32) (param $$1 i64)
- (i64.store align=4
+ (i64.store16 align=4
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $sti32_a1 (param $$0 i32) (param $$1 i64)
- (i64.store align=1
+ (i64.store32 align=1
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $sti32_a2 (param $$0 i32) (param $$1 i64)
- (i64.store align=2
+ (i64.store32 align=2
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $sti32_a4 (param $$0 i32) (param $$1 i64)
- (i64.store align=32
+ (i64.store32 align=4
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $sti32_a8 (param $$0 i32) (param $$1 i64)
- (i64.store align=8
+ (i64.store32 align=8
(get_local $$0)
(get_local $$1)
)
diff --git a/test/llvm_autogenerated/load-store-i1.wast b/test/llvm_autogenerated/load-store-i1.wast
index f7754e1df..10c7c6bd6 100644
--- a/test/llvm_autogenerated/load-store-i1.wast
+++ b/test/llvm_autogenerated/load-store-i1.wast
@@ -47,7 +47,7 @@
)
)
(func $store_i32_i1 (param $$0 i32) (param $$1 i32)
- (i32.store align=8
+ (i32.store8 align=1
(get_local $$0)
(i32.and
(get_local $$1)
@@ -57,7 +57,7 @@
(return)
)
(func $store_i64_i1 (param $$0 i32) (param $$1 i64)
- (i64.store align=8
+ (i64.store8 align=1
(get_local $$0)
(i64.and
(get_local $$1)
diff --git a/test/llvm_autogenerated/offset.wast b/test/llvm_autogenerated/offset.wast
index caf0f95a2..ac9a09f9c 100644
--- a/test/llvm_autogenerated/offset.wast
+++ b/test/llvm_autogenerated/offset.wast
@@ -268,14 +268,14 @@
)
)
(func $store_i8_with_folded_offset (param $$0 i32)
- (i32.store offset=24 align=8
+ (i32.store8 offset=24 align=1
(get_local $$0)
(i32.const 0)
)
(return)
)
(func $store_i8_with_folded_gep_offset (param $$0 i32)
- (i32.store offset=24 align=8
+ (i32.store8 offset=24 align=1
(get_local $$0)
(i32.const 0)
)
@@ -333,9 +333,9 @@
(func $aggregate_return_without_merge (param $$0 i32)
(i32.store offset=8 align=4
(get_local $$0)
- (i32.store offset=12 align=16
+ (i32.store16 offset=12 align=2
(get_local $$0)
- (i32.store offset=14 align=8
+ (i32.store8 offset=14 align=1
(get_local $$0)
(i32.const 0)
)
diff --git a/test/llvm_autogenerated/store-trunc.wast b/test/llvm_autogenerated/store-trunc.wast
index dfbf5f41c..5073ae592 100644
--- a/test/llvm_autogenerated/store-trunc.wast
+++ b/test/llvm_autogenerated/store-trunc.wast
@@ -6,35 +6,35 @@
(export "trunc_i16_i64" $trunc_i16_i64)
(export "trunc_i32_i64" $trunc_i32_i64)
(func $trunc_i8_i32 (param $$0 i32) (param $$1 i32)
- (i32.store align=8
+ (i32.store8 align=1
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $trunc_i16_i32 (param $$0 i32) (param $$1 i32)
- (i32.store align=16
+ (i32.store16 align=2
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $trunc_i8_i64 (param $$0 i32) (param $$1 i64)
- (i64.store align=8
+ (i64.store8 align=1
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $trunc_i16_i64 (param $$0 i32) (param $$1 i64)
- (i64.store align=16
+ (i64.store16 align=2
(get_local $$0)
(get_local $$1)
)
(return)
)
(func $trunc_i32_i64 (param $$0 i32) (param $$1 i64)
- (i64.store align=32
+ (i64.store32 align=4
(get_local $$0)
(get_local $$1)
)
diff --git a/test/s2wasm_known_binaryen_shell_test_failures.txt b/test/s2wasm_known_binaryen_shell_test_failures.txt
index b16ed8510..6ed051690 100644
--- a/test/s2wasm_known_binaryen_shell_test_failures.txt
+++ b/test/s2wasm_known_binaryen_shell_test_failures.txt
@@ -1,26 +1,18 @@
# [trap highest > memory]
-930126-1.c.s.wast
-990222-1.c.s.wast
pr27260.c.s.wast
-simd-5.c.s.wast
# [trap final > memory]
20000519-1.c.s.wast
20000801-1.c.s.wast
-20010518-2.c.s.wast
20010915-1.c.s.wast
20020413-1.c.s.wast
20021120-3.c.s.wast
-20021219-1.c.s.wast
20030221-1.c.s.wast
-20030222-1.c.s.wast
20030916-1.c.s.wast
20031012-1.c.s.wast
20040709-1.c.s.wast
20041113-1.c.s.wast
20041214-1.c.s.wast
-20050119-1.c.s.wast
-20050203-1.c.s.wast
20050502-1.c.s.wast
20050502-2.c.s.wast
20070201-1.c.s.wast
@@ -31,7 +23,6 @@ simd-5.c.s.wast
20080502-1.c.s.wast
20080506-2.c.s.wast
20100708-1.c.s.wast
-20120808-1.c.s.wast
20121108-1.c.s.wast
920501-8.c.s.wast
920501-9.c.s.wast
@@ -48,7 +39,6 @@ memcpy-1.c.s.wast
multi-ix.c.s.wast
pr29006.c.s.wast
pr37573.c.s.wast
-pr42614.c.s.wast
pr43236.c.s.wast
pr44852.c.s.wast
pr44942.c.s.wast
@@ -58,13 +48,11 @@ pr51581-1.c.s.wast
pr51581-2.c.s.wast
pr51877.c.s.wast
pr51933.c.s.wast
-pr52760.c.s.wast
pr54471.c.s.wast
pr56205.c.s.wast
pr56837.c.s.wast
pr56866.c.s.wast
pr56982.c.s.wast
-pr57124.c.s.wast
pr57130.c.s.wast
pr60960.c.s.wast
stdarg-1.c.s.wast
@@ -96,9 +84,7 @@ va-arg-8.c.s.wast
va-arg-9.c.s.wast
# [trap offset > memory]
-20030218-1.c.s.wast
complex-7.c.s.wast
-pr30778.c.s.wast
# abort called: the tests are self-validating and call abort when they detect a
# failure. This may not be binaryen's fault (the toolchain may be emitting bad