cf51230881
This affects arm64 and x64. Note that we do not yet optimize these conversions. Later we will add support for merging these conversion operators into other operations during instruction selection. TEST=cctest,compiler-unittests R=jarin@chromium.org Review URL: https://codereview.chromium.org/487723002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23184 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "test/compiler-unittests/instruction-selector-unittest.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
namespace compiler {
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Conversions.
|
|
|
|
|
|
TEST_F(InstructionSelectorTest, ChangeInt32ToInt64WithParameter) {
|
|
StreamBuilder m(this, kMachInt64, kMachInt32);
|
|
m.Return(m.ChangeInt32ToInt64(m.Parameter(0)));
|
|
Stream s = m.Build();
|
|
ASSERT_EQ(1U, s.size());
|
|
EXPECT_EQ(kX64Movsxlq, s[0]->arch_opcode());
|
|
}
|
|
|
|
|
|
TEST_F(InstructionSelectorTest, ChangeUint32ToUint64WithParameter) {
|
|
StreamBuilder m(this, kMachUint64, kMachUint32);
|
|
m.Return(m.ChangeUint32ToUint64(m.Parameter(0)));
|
|
Stream s = m.Build();
|
|
ASSERT_EQ(1U, s.size());
|
|
EXPECT_EQ(kX64Movl, s[0]->arch_opcode());
|
|
}
|
|
|
|
|
|
TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithParameter) {
|
|
StreamBuilder m(this, kMachInt32, kMachInt64);
|
|
m.Return(m.TruncateInt64ToInt32(m.Parameter(0)));
|
|
Stream s = m.Build();
|
|
ASSERT_EQ(1U, s.size());
|
|
EXPECT_EQ(kX64Movl, s[0]->arch_opcode());
|
|
}
|
|
|
|
} // namespace compiler
|
|
} // namespace internal
|
|
} // namespace v8
|