[wasm] Int64 lowering for I64SExtend operations
Change-Id: I488b47a51ef79c97545576fcc7d58e9147deb664 Reviewed-on: https://chromium-review.googlesource.com/1067677 Reviewed-by: Andreas Haas <ahaas@chromium.org> Commit-Queue: Deepti Gandluri <gdeepti@chromium.org> Cr-Commit-Position: refs/heads/master@{#53285}
This commit is contained in:
parent
b07d55f5cb
commit
a88f7a94ee
@ -591,6 +591,7 @@ void Int64Lowering::LowerNode(Node* node) {
|
||||
machine()->Uint32LessThanOrEqual());
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kSignExtendWord32ToInt64:
|
||||
case IrOpcode::kChangeInt32ToInt64: {
|
||||
DCHECK_EQ(1, node->InputCount());
|
||||
Node* input = node->InputAt(0);
|
||||
@ -860,6 +861,40 @@ void Int64Lowering::LowerNode(Node* node) {
|
||||
GetReplacementLow(input)));
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kSignExtendWord8ToInt64: {
|
||||
DCHECK_EQ(1, node->InputCount());
|
||||
Node* input = node->InputAt(0);
|
||||
if (HasReplacementLow(input)) {
|
||||
input = GetReplacementLow(input);
|
||||
}
|
||||
// Sign extend low node to Int32
|
||||
input = graph()->NewNode(machine()->SignExtendWord8ToInt32(), input);
|
||||
|
||||
// We use SAR to preserve the sign in the high word.
|
||||
ReplaceNode(
|
||||
node, input,
|
||||
graph()->NewNode(machine()->Word32Sar(), input,
|
||||
graph()->NewNode(common()->Int32Constant(31))));
|
||||
node->NullAllInputs();
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kSignExtendWord16ToInt64: {
|
||||
DCHECK_EQ(1, node->InputCount());
|
||||
Node* input = node->InputAt(0);
|
||||
if (HasReplacementLow(input)) {
|
||||
input = GetReplacementLow(input);
|
||||
}
|
||||
// Sign extend low node to Int32
|
||||
input = graph()->NewNode(machine()->SignExtendWord16ToInt32(), input);
|
||||
|
||||
// We use SAR to preserve the sign in the high word.
|
||||
ReplaceNode(
|
||||
node, input,
|
||||
graph()->NewNode(machine()->Word32Sar(), input,
|
||||
graph()->NewNode(common()->Int32Constant(31))));
|
||||
node->NullAllInputs();
|
||||
break;
|
||||
}
|
||||
|
||||
default: { DefaultLowering(node); }
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ namespace v8 {
|
||||
namespace internal {
|
||||
namespace wasm {
|
||||
|
||||
// TODO(gdeepti): Enable tests to run in the interpreter.
|
||||
WASM_COMPILED_EXEC_TEST(I32SExtendI8) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(se);
|
||||
WasmRunner<int32_t, int32_t> r(execution_mode);
|
||||
@ -31,10 +32,7 @@ WASM_COMPILED_EXEC_TEST(I32SExtendI16) {
|
||||
CHECK_EQ(0x7afa, r.Call(0x7afa));
|
||||
CHECK_EQ(-0x8000, r.Call(0x8000));
|
||||
}
|
||||
// TODO(gdeepti): Enable tests to run in the interpreter, and on 32 bit
|
||||
// platforms after int64 lowering support. Add JS tests once all ops can be run
|
||||
// on 32 bit platforms.
|
||||
#if V8_TARGET_ARCH_64_BIT
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(I64SExtendI8) {
|
||||
EXPERIMENTAL_FLAG_SCOPE(se);
|
||||
WasmRunner<int64_t, int64_t> r(execution_mode);
|
||||
@ -67,7 +65,6 @@ WASM_COMPILED_EXEC_TEST(I64SExtendI32) {
|
||||
CHECK_EQ(0x7fffffff, r.Call(0x7fffffff));
|
||||
CHECK_EQ(-0x80000000LL, r.Call(0x80000000));
|
||||
}
|
||||
#endif // V8_TARGET_ARCH_64_BIT
|
||||
|
||||
} // namespace wasm
|
||||
} // namespace internal
|
||||
|
Loading…
Reference in New Issue
Block a user