Commit 0d0d623b authored by predrag.rudic's avatar predrag.rudic Committed by Commit bot

MIPS[64]: Implement Word[32|64]ReverseByte instruction selector unit tests

BUG=

Review-Url: https://codereview.chromium.org/2398993003
Cr-Commit-Position: refs/heads/master@{#42358}
parent 4fb60b21
......@@ -653,6 +653,12 @@ class V8_EXPORT_PRIVATE RawMachineAssembler {
Node* Float64RoundTiesEven(Node* a) {
return AddNode(machine()->Float64RoundTiesEven().op(), a);
}
Node* Word32ReverseBytes(Node* a) {
return AddNode(machine()->Word32ReverseBytes().op(), a);
}
Node* Word64ReverseBytes(Node* a) {
return AddNode(machine()->Word64ReverseBytes().op(), a);
}
// Float64 bit operations.
Node* Float64ExtractLowWord32(Node* a) {
......
......@@ -1454,6 +1454,18 @@ TEST_F(InstructionSelectorTest, Float64Min) {
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
TEST_F(InstructionSelectorTest, Word32ReverseBytes) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Word32ReverseBytes(m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kMipsByteSwap32, s[0]->arch_opcode());
EXPECT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -1964,6 +1964,30 @@ TEST_F(InstructionSelectorTest, LoadAndShiftRight) {
}
}
TEST_F(InstructionSelectorTest, Word32ReverseBytes) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Word32ReverseBytes(m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kMips64ByteSwap32, s[0]->arch_opcode());
EXPECT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
TEST_F(InstructionSelectorTest, Word64ReverseBytes) {
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Word64ReverseBytes(m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kMips64ByteSwap64, s[0]->arch_opcode());
EXPECT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
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