summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcheck.py3
-rw-r--r--src/wasm-interpreter.h8
-rw-r--r--src/wasm-s-parser.h5
3 files changed, 10 insertions, 6 deletions
diff --git a/check.py b/check.py
index 3ec0d6544..c428ec5ea 100755
--- a/check.py
+++ b/check.py
@@ -81,7 +81,8 @@ print '\n[ checking wasm-shell spec testcases... ]\n'
if len(requested) == 0:
#spec_tests = [] # XXX [os.path.join('spec', t) for t in sorted(os.listdir(os.path.join('test', 'spec')))]
- spec_tests = [os.path.join('spec', t + '.wast') for t in ['address', 'conversions']]
+ # 'address' : filed issue, test looks invalid
+ spec_tests = [os.path.join('spec', t + '.wast') for t in ['conversions']]
else:
spec_tests = requested[:]
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index 586715b77..5d9bf89b0 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -386,10 +386,10 @@ public:
}
}
case ReinterpretFloat: return curr->type == i32 ? Flow(Literal(value.reinterpreti32())) : Flow(Literal(value.reinterpreti64()));
- case ConvertUInt32: return Flow(Literal(double(uint32_t(value.geti32()))));
- case ConvertSInt32: return Flow(Literal(double(int32_t(value.geti32()))));
- case ConvertUInt64: return Flow(Literal(double((uint64_t)value.geti64())));
- case ConvertSInt64: return Flow(Literal(double(value.geti64())));
+ case ConvertUInt32: return curr->type == f32 ? Flow(Literal(float(uint32_t(value.geti32())))) : Flow(Literal(double(uint32_t(value.geti32()))));
+ case ConvertSInt32: return curr->type == f32 ? Flow(Literal(float(int32_t(value.geti32())))) : Flow(Literal(double(int32_t(value.geti32()))));
+ case ConvertUInt64: return curr->type == f32 ? Flow(Literal(float((uint64_t)value.geti64()))) : Flow(Literal(double((uint64_t)value.geti64())));
+ case ConvertSInt64: return curr->type == f32 ? Flow(Literal(float(value.geti64()))) : Flow(Literal(double(value.geti64())));
case PromoteFloat32: return Flow(Literal(double(value.getf32())));
case DemoteFloat64: return Flow(Literal(float(value.getf64())));
case ReinterpretInt: return curr->type == f32 ? Flow(Literal(value.reinterpretf32())) : Flow(Literal(value.reinterpretf64()));
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index e1c87c893..df0427e08 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -296,7 +296,10 @@ public:
if (op[1] == 'o') {
if (op[2] == 'p') return makeBinary(s, BinaryOp::CopySign, type);
if (op[2] == 'n') {
- if (op[3] == 'v') return makeConvert(s, op[8] == 'u' ? ConvertOp::ConvertUInt32 : ConvertOp::ConvertSInt32, type);
+ if (op[3] == 'v') {
+ if (op[8] == 's') return makeConvert(s, op[11] == '3' ? ConvertOp::ConvertSInt32 : ConvertOp::ConvertSInt64, type);
+ if (op[8] == 'u') return makeConvert(s, op[11] == '3' ? ConvertOp::ConvertUInt32 : ConvertOp::ConvertUInt64, type);
+ }
if (op[3] == 's') return makeConst(s, type);
}
}