Commit 785bd43b authored by Deepti Gandluri's avatar Deepti Gandluri Committed by Commit Bot

[wasm] Enable sign extension operations in the interpreter

Change-Id: I204a021ffc8b120ffe232e3f5db924e54c6d980e
Reviewed-on: https://chromium-review.googlesource.com/1083337Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53478}
parent dc6819ec
......@@ -2300,6 +2300,18 @@ class ThreadImpl {
Push(WasmValue(ExecuteI64ReinterpretF64(val)));
break;
}
#define SIGN_EXTENSION_CASE(name, wtype, ntype) \
case kExpr##name: { \
ntype val = static_cast<ntype>(Pop().to<wtype>()); \
Push(WasmValue(static_cast<wtype>(val))); \
break; \
}
SIGN_EXTENSION_CASE(I32SExtendI8, int32_t, int8_t);
SIGN_EXTENSION_CASE(I32SExtendI16, int32_t, int16_t);
SIGN_EXTENSION_CASE(I64SExtendI8, int64_t, int8_t);
SIGN_EXTENSION_CASE(I64SExtendI16, int64_t, int16_t);
SIGN_EXTENSION_CASE(I64SExtendI32, int64_t, int32_t);
#undef SIGN_EXTENSION_CASE
case kNumericPrefix: {
++len;
if (!ExecuteNumericOp(opcode, &decoder, code, pc, len)) return;
......
......@@ -11,7 +11,7 @@ namespace internal {
namespace wasm {
// TODO(gdeepti): Enable tests to run in the interpreter.
WASM_COMPILED_EXEC_TEST(I32SExtendI8) {
WASM_EXEC_TEST(I32SExtendI8) {
EXPERIMENTAL_FLAG_SCOPE(se);
WasmRunner<int32_t, int32_t> r(execution_mode);
BUILD(r, WASM_I32_SIGN_EXT_I8(WASM_GET_LOCAL(0)));
......@@ -22,7 +22,7 @@ WASM_COMPILED_EXEC_TEST(I32SExtendI8) {
CHECK_EQ(-0x80, r.Call(0x80));
}
WASM_COMPILED_EXEC_TEST(I32SExtendI16) {
WASM_EXEC_TEST(I32SExtendI16) {
EXPERIMENTAL_FLAG_SCOPE(se);
WasmRunner<int32_t, int32_t> r(execution_mode);
BUILD(r, WASM_I32_SIGN_EXT_I16(WASM_GET_LOCAL(0)));
......@@ -33,7 +33,7 @@ WASM_COMPILED_EXEC_TEST(I32SExtendI16) {
CHECK_EQ(-0x8000, r.Call(0x8000));
}
WASM_COMPILED_EXEC_TEST(I64SExtendI8) {
WASM_EXEC_TEST(I64SExtendI8) {
EXPERIMENTAL_FLAG_SCOPE(se);
WasmRunner<int64_t, int64_t> r(execution_mode);
BUILD(r, WASM_I64_SIGN_EXT_I8(WASM_GET_LOCAL(0)));
......@@ -44,7 +44,7 @@ WASM_COMPILED_EXEC_TEST(I64SExtendI8) {
CHECK_EQ(-0x80, r.Call(0x80));
}
WASM_COMPILED_EXEC_TEST(I64SExtendI16) {
WASM_EXEC_TEST(I64SExtendI16) {
EXPERIMENTAL_FLAG_SCOPE(se);
WasmRunner<int64_t, int64_t> r(execution_mode);
BUILD(r, WASM_I64_SIGN_EXT_I16(WASM_GET_LOCAL(0)));
......@@ -55,7 +55,7 @@ WASM_COMPILED_EXEC_TEST(I64SExtendI16) {
CHECK_EQ(-0x8000, r.Call(0x8000));
}
WASM_COMPILED_EXEC_TEST(I64SExtendI32) {
WASM_EXEC_TEST(I64SExtendI32) {
EXPERIMENTAL_FLAG_SCOPE(se);
WasmRunner<int64_t, int64_t> r(execution_mode);
BUILD(r, WASM_I64_SIGN_EXT_I32(WASM_GET_LOCAL(0)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment