Index: test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc |
diff --git a/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc b/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc |
index 1e07d7a41b598915c9110e8feb544673eee0f5f9..92795c1bd41161e6d7a7e7bfbb1b1d9a423e9690 100644 |
--- a/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc |
+++ b/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc |
@@ -19,7 +19,8 @@ const int32_t kImmediates[] = {kMinInt, -42, -1, 0, 1, 2, |
TEST_F(InstructionSelectorTest, Int32AddWithParameter) { |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return(m.Int32Add(m.Parameter(0), m.Parameter(1))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -30,7 +31,7 @@ TEST_F(InstructionSelectorTest, Int32AddWithParameter) { |
TEST_F(InstructionSelectorTest, Int32AddWithImmediate) { |
TRACED_FOREACH(int32_t, imm, kImmediates) { |
{ |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Int32Add(m.Parameter(0), m.Int32Constant(imm))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -43,7 +44,7 @@ TEST_F(InstructionSelectorTest, Int32AddWithImmediate) { |
} |
} |
{ |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Int32Add(m.Int32Constant(imm), m.Parameter(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -60,7 +61,8 @@ TEST_F(InstructionSelectorTest, Int32AddWithImmediate) { |
TEST_F(InstructionSelectorTest, Int32SubWithParameter) { |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return(m.Int32Sub(m.Parameter(0), m.Parameter(1))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -71,7 +73,7 @@ TEST_F(InstructionSelectorTest, Int32SubWithParameter) { |
TEST_F(InstructionSelectorTest, Int32SubWithImmediate) { |
TRACED_FOREACH(int32_t, imm, kImmediates) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Int32Sub(m.Parameter(0), m.Int32Constant(imm))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -87,7 +89,7 @@ TEST_F(InstructionSelectorTest, Int32SubWithImmediate) { |
TEST_F(InstructionSelectorTest, ChangeFloat32ToFloat64WithParameter) { |
- StreamBuilder m(this, kMachFloat32, kMachFloat64); |
+ StreamBuilder m(this, MachineType::Float32(), MachineType::Float64()); |
m.Return(m.ChangeFloat32ToFloat64(m.Parameter(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -98,7 +100,7 @@ TEST_F(InstructionSelectorTest, ChangeFloat32ToFloat64WithParameter) { |
TEST_F(InstructionSelectorTest, TruncateFloat64ToFloat32WithParameter) { |
- StreamBuilder m(this, kMachFloat64, kMachFloat32); |
+ StreamBuilder m(this, MachineType::Float64(), MachineType::Float32()); |
m.Return(m.TruncateFloat64ToFloat32(m.Parameter(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -113,7 +115,8 @@ TEST_F(InstructionSelectorTest, TruncateFloat64ToFloat32WithParameter) { |
TEST_F(InstructionSelectorTest, BetterLeftOperandTestAddBinop) { |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
Node* param1 = m.Parameter(0); |
Node* param2 = m.Parameter(1); |
Node* add = m.Int32Add(param1, param2); |
@@ -131,7 +134,8 @@ TEST_F(InstructionSelectorTest, BetterLeftOperandTestAddBinop) { |
TEST_F(InstructionSelectorTest, BetterLeftOperandTestMulBinop) { |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
Node* param1 = m.Parameter(0); |
Node* param2 = m.Parameter(1); |
Node* mul = m.Int32Mul(param1, param2); |
@@ -151,7 +155,7 @@ TEST_F(InstructionSelectorTest, BetterLeftOperandTestMulBinop) { |
TEST_F(InstructionSelectorTest, ChangeUint32ToFloat64WithParameter) { |
- StreamBuilder m(this, kMachFloat64, kMachUint32); |
+ StreamBuilder m(this, MachineType::Float64(), MachineType::Uint32()); |
m.Return(m.ChangeUint32ToFloat64(m.Parameter(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -178,14 +182,14 @@ std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) { |
static const MemoryAccess kMemoryAccesses[] = { |
- {kMachInt8, kIA32Movsxbl, kIA32Movb}, |
- {kMachUint8, kIA32Movzxbl, kIA32Movb}, |
- {kMachInt16, kIA32Movsxwl, kIA32Movw}, |
- {kMachUint16, kIA32Movzxwl, kIA32Movw}, |
- {kMachInt32, kIA32Movl, kIA32Movl}, |
- {kMachUint32, kIA32Movl, kIA32Movl}, |
- {kMachFloat32, kIA32Movss, kIA32Movss}, |
- {kMachFloat64, kIA32Movsd, kIA32Movsd}}; |
+ {MachineType::Int8(), kIA32Movsxbl, kIA32Movb}, |
+ {MachineType::Uint8(), kIA32Movzxbl, kIA32Movb}, |
+ {MachineType::Int16(), kIA32Movsxwl, kIA32Movw}, |
+ {MachineType::Uint16(), kIA32Movzxwl, kIA32Movw}, |
+ {MachineType::Int32(), kIA32Movl, kIA32Movl}, |
+ {MachineType::Uint32(), kIA32Movl, kIA32Movl}, |
+ {MachineType::Float32(), kIA32Movss, kIA32Movss}, |
+ {MachineType::Float64(), kIA32Movsd, kIA32Movsd}}; |
} // namespace |
@@ -196,7 +200,8 @@ typedef InstructionSelectorTestWithParam<MemoryAccess> |
TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) { |
const MemoryAccess memacc = GetParam(); |
- StreamBuilder m(this, memacc.type, kMachPtr, kMachInt32); |
+ StreamBuilder m(this, memacc.type, MachineType::Pointer(), |
+ MachineType::Int32()); |
m.Return(m.Load(memacc.type, m.Parameter(0), m.Parameter(1))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -209,7 +214,7 @@ TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) { |
TEST_P(InstructionSelectorMemoryAccessTest, LoadWithImmediateBase) { |
const MemoryAccess memacc = GetParam(); |
TRACED_FOREACH(int32_t, base, kImmediates) { |
- StreamBuilder m(this, memacc.type, kMachPtr); |
+ StreamBuilder m(this, memacc.type, MachineType::Pointer()); |
m.Return(m.Load(memacc.type, m.Int32Constant(base), m.Parameter(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -229,7 +234,7 @@ TEST_P(InstructionSelectorMemoryAccessTest, LoadWithImmediateBase) { |
TEST_P(InstructionSelectorMemoryAccessTest, LoadWithImmediateIndex) { |
const MemoryAccess memacc = GetParam(); |
TRACED_FOREACH(int32_t, index, kImmediates) { |
- StreamBuilder m(this, memacc.type, kMachPtr); |
+ StreamBuilder m(this, memacc.type, MachineType::Pointer()); |
m.Return(m.Load(memacc.type, m.Parameter(0), m.Int32Constant(index))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -248,7 +253,8 @@ TEST_P(InstructionSelectorMemoryAccessTest, LoadWithImmediateIndex) { |
TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) { |
const MemoryAccess memacc = GetParam(); |
- StreamBuilder m(this, kMachInt32, kMachPtr, kMachInt32, memacc.type); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), |
+ MachineType::Int32(), memacc.type); |
m.Store(memacc.type, m.Parameter(0), m.Parameter(1), m.Parameter(2), |
kNoWriteBarrier); |
m.Return(m.Int32Constant(0)); |
@@ -263,7 +269,8 @@ TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) { |
TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateBase) { |
const MemoryAccess memacc = GetParam(); |
TRACED_FOREACH(int32_t, base, kImmediates) { |
- StreamBuilder m(this, kMachInt32, kMachInt32, memacc.type); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ memacc.type); |
m.Store(memacc.type, m.Int32Constant(base), m.Parameter(0), m.Parameter(1), |
kNoWriteBarrier); |
m.Return(m.Int32Constant(0)); |
@@ -285,7 +292,8 @@ TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateBase) { |
TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateIndex) { |
const MemoryAccess memacc = GetParam(); |
TRACED_FOREACH(int32_t, index, kImmediates) { |
- StreamBuilder m(this, kMachInt32, kMachPtr, memacc.type); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), |
+ memacc.type); |
m.Store(memacc.type, m.Parameter(0), m.Int32Constant(index), m.Parameter(1), |
kNoWriteBarrier); |
m.Return(m.Int32Constant(0)); |
@@ -320,8 +328,8 @@ class AddressingModeUnitTest : public InstructionSelectorTest { |
void Run(Node* base, Node* load_index, Node* store_index, |
AddressingMode mode) { |
- Node* load = m->Load(kMachInt32, base, load_index); |
- m->Store(kMachInt32, base, store_index, load, kNoWriteBarrier); |
+ Node* load = m->Load(MachineType::Int32(), base, load_index); |
+ m->Store(MachineType::Int32(), base, store_index, load, kNoWriteBarrier); |
m->Return(m->Int32Constant(0)); |
Stream s = m->Build(); |
ASSERT_EQ(2U, s.size()); |
@@ -339,7 +347,8 @@ class AddressingModeUnitTest : public InstructionSelectorTest { |
void Reset() { |
delete m; |
- m = new StreamBuilder(this, kMachInt32, kMachInt32, kMachInt32); |
+ m = new StreamBuilder(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
zero = m->Int32Constant(0); |
null_ptr = m->Int32Constant(0); |
non_zero = m->Int32Constant(127); |
@@ -565,7 +574,7 @@ static AddressingMode AddressingModeForAddMult(int32_t imm, |
TEST_P(InstructionSelectorMultTest, Mult32) { |
const MultParam m_param = GetParam(); |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
Node* param = m.Parameter(0); |
Node* mult = m.Int32Mul(param, m.Int32Constant(m_param.value)); |
m.Return(mult); |
@@ -586,7 +595,7 @@ TEST_P(InstructionSelectorMultTest, Mult32) { |
TEST_P(InstructionSelectorMultTest, MultAdd32) { |
TRACED_FOREACH(int32_t, imm, kImmediates) { |
const MultParam m_param = GetParam(); |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
Node* param = m.Parameter(0); |
Node* mult = m.Int32Add(m.Int32Mul(param, m.Int32Constant(m_param.value)), |
m.Int32Constant(imm)); |
@@ -618,7 +627,8 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorMultTest, |
TEST_F(InstructionSelectorTest, Int32MulHigh) { |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
Node* const p0 = m.Parameter(0); |
Node* const p1 = m.Parameter(1); |
Node* const n = m.Int32MulHigh(p0, p1); |
@@ -643,7 +653,7 @@ TEST_F(InstructionSelectorTest, Int32MulHigh) { |
TEST_F(InstructionSelectorTest, Float32Abs) { |
{ |
- StreamBuilder m(this, kMachFloat32, kMachFloat32); |
+ StreamBuilder m(this, MachineType::Float32(), MachineType::Float32()); |
Node* const p0 = m.Parameter(0); |
Node* const n = m.Float32Abs(p0); |
m.Return(n); |
@@ -658,7 +668,7 @@ TEST_F(InstructionSelectorTest, Float32Abs) { |
EXPECT_EQ(kFlags_none, s[0]->flags_mode()); |
} |
{ |
- StreamBuilder m(this, kMachFloat32, kMachFloat32); |
+ StreamBuilder m(this, MachineType::Float32(), MachineType::Float32()); |
Node* const p0 = m.Parameter(0); |
Node* const n = m.Float32Abs(p0); |
m.Return(n); |
@@ -676,7 +686,7 @@ TEST_F(InstructionSelectorTest, Float32Abs) { |
TEST_F(InstructionSelectorTest, Float64Abs) { |
{ |
- StreamBuilder m(this, kMachFloat64, kMachFloat64); |
+ StreamBuilder m(this, MachineType::Float64(), MachineType::Float64()); |
Node* const p0 = m.Parameter(0); |
Node* const n = m.Float64Abs(p0); |
m.Return(n); |
@@ -691,7 +701,7 @@ TEST_F(InstructionSelectorTest, Float64Abs) { |
EXPECT_EQ(kFlags_none, s[0]->flags_mode()); |
} |
{ |
- StreamBuilder m(this, kMachFloat64, kMachFloat64); |
+ StreamBuilder m(this, MachineType::Float64(), MachineType::Float64()); |
Node* const p0 = m.Parameter(0); |
Node* const n = m.Float64Abs(p0); |
m.Return(n); |
@@ -709,7 +719,8 @@ TEST_F(InstructionSelectorTest, Float64Abs) { |
TEST_F(InstructionSelectorTest, Float64BinopArithmetic) { |
{ |
- StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64); |
+ StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(), |
+ MachineType::Float64()); |
Node* add = m.Float64Add(m.Parameter(0), m.Parameter(1)); |
Node* mul = m.Float64Mul(add, m.Parameter(1)); |
Node* sub = m.Float64Sub(mul, add); |
@@ -723,7 +734,8 @@ TEST_F(InstructionSelectorTest, Float64BinopArithmetic) { |
EXPECT_EQ(kAVXFloat64Div, s[3]->arch_opcode()); |
} |
{ |
- StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64); |
+ StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(), |
+ MachineType::Float64()); |
Node* add = m.Float64Add(m.Parameter(0), m.Parameter(1)); |
Node* mul = m.Float64Mul(add, m.Parameter(1)); |
Node* sub = m.Float64Sub(mul, add); |
@@ -741,7 +753,7 @@ TEST_F(InstructionSelectorTest, Float64BinopArithmetic) { |
TEST_F(InstructionSelectorTest, Float32SubWithMinusZeroAndParameter) { |
{ |
- StreamBuilder m(this, kMachFloat32, kMachFloat32); |
+ StreamBuilder m(this, MachineType::Float32(), MachineType::Float32()); |
Node* const p0 = m.Parameter(0); |
Node* const n = m.Float32Sub(m.Float32Constant(-0.0f), p0); |
m.Return(n); |
@@ -755,7 +767,7 @@ TEST_F(InstructionSelectorTest, Float32SubWithMinusZeroAndParameter) { |
EXPECT_EQ(kFlags_none, s[0]->flags_mode()); |
} |
{ |
- StreamBuilder m(this, kMachFloat32, kMachFloat32); |
+ StreamBuilder m(this, MachineType::Float32(), MachineType::Float32()); |
Node* const p0 = m.Parameter(0); |
Node* const n = m.Float32Sub(m.Float32Constant(-0.0f), p0); |
m.Return(n); |
@@ -773,7 +785,7 @@ TEST_F(InstructionSelectorTest, Float32SubWithMinusZeroAndParameter) { |
TEST_F(InstructionSelectorTest, Float64SubWithMinusZeroAndParameter) { |
{ |
- StreamBuilder m(this, kMachFloat64, kMachFloat64); |
+ StreamBuilder m(this, MachineType::Float64(), MachineType::Float64()); |
Node* const p0 = m.Parameter(0); |
Node* const n = m.Float64Sub(m.Float64Constant(-0.0), p0); |
m.Return(n); |
@@ -787,7 +799,7 @@ TEST_F(InstructionSelectorTest, Float64SubWithMinusZeroAndParameter) { |
EXPECT_EQ(kFlags_none, s[0]->flags_mode()); |
} |
{ |
- StreamBuilder m(this, kMachFloat64, kMachFloat64); |
+ StreamBuilder m(this, MachineType::Float64(), MachineType::Float64()); |
Node* const p0 = m.Parameter(0); |
Node* const n = m.Float64Sub(m.Float64Constant(-0.0), p0); |
m.Return(n); |
@@ -808,9 +820,9 @@ TEST_F(InstructionSelectorTest, Float64SubWithMinusZeroAndParameter) { |
TEST_F(InstructionSelectorTest, Uint32LessThanWithLoadAndLoadStackPointer) { |
- StreamBuilder m(this, kMachBool); |
+ StreamBuilder m(this, MachineType::Bool()); |
Node* const sl = m.Load( |
- kMachPtr, |
+ MachineType::Pointer(), |
m.ExternalConstant(ExternalReference::address_of_stack_limit(isolate()))); |
Node* const sp = m.LoadStackPointer(); |
Node* const n = m.Uint32LessThan(sl, sp); |
@@ -827,7 +839,7 @@ TEST_F(InstructionSelectorTest, Uint32LessThanWithLoadAndLoadStackPointer) { |
TEST_F(InstructionSelectorTest, Word32Clz) { |
- StreamBuilder m(this, kMachUint32, kMachUint32); |
+ StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32()); |
Node* const p0 = m.Parameter(0); |
Node* const n = m.Word32Clz(p0); |
m.Return(n); |