Index: test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc |
diff --git a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc |
index c3d82ba7ef3e90381f968a6532d81af0e30ceebf..5d52625684dbcd2adc2e88d5f44476ae546fae29 100644 |
--- a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc |
+++ b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc |
@@ -43,12 +43,12 @@ std::ostream& operator<<(std::ostream& os, const Shift& shift) { |
// machine type. |
Node* BuildConstant(InstructionSelectorTest::StreamBuilder& m, MachineType type, |
int64_t value) { |
- switch (type) { |
- case kMachInt32: |
+ switch (type.representation()) { |
+ case MachineRepresentation::kWord32: |
return m.Int32Constant(static_cast<int32_t>(value)); |
break; |
- case kMachInt64: |
+ case MachineRepresentation::kWord64: |
return m.Int64Constant(value); |
break; |
@@ -61,12 +61,18 @@ Node* BuildConstant(InstructionSelectorTest::StreamBuilder& m, MachineType type, |
// ARM64 logical instructions. |
const MachInst2 kLogicalInstructions[] = { |
- {&RawMachineAssembler::Word32And, "Word32And", kArm64And32, kMachInt32}, |
- {&RawMachineAssembler::Word64And, "Word64And", kArm64And, kMachInt64}, |
- {&RawMachineAssembler::Word32Or, "Word32Or", kArm64Or32, kMachInt32}, |
- {&RawMachineAssembler::Word64Or, "Word64Or", kArm64Or, kMachInt64}, |
- {&RawMachineAssembler::Word32Xor, "Word32Xor", kArm64Eor32, kMachInt32}, |
- {&RawMachineAssembler::Word64Xor, "Word64Xor", kArm64Eor, kMachInt64}}; |
+ {&RawMachineAssembler::Word32And, "Word32And", kArm64And32, |
+ MachineType::Int32()}, |
+ {&RawMachineAssembler::Word64And, "Word64And", kArm64And, |
+ MachineType::Int64()}, |
+ {&RawMachineAssembler::Word32Or, "Word32Or", kArm64Or32, |
+ MachineType::Int32()}, |
+ {&RawMachineAssembler::Word64Or, "Word64Or", kArm64Or, |
+ MachineType::Int64()}, |
+ {&RawMachineAssembler::Word32Xor, "Word32Xor", kArm64Eor32, |
+ MachineType::Int32()}, |
+ {&RawMachineAssembler::Word64Xor, "Word64Xor", kArm64Eor, |
+ MachineType::Int64()}}; |
// ARM64 logical immediates: contiguous set bits, rotated about a power of two |
@@ -130,13 +136,17 @@ std::ostream& operator<<(std::ostream& os, const AddSub& op) { |
const AddSub kAddSubInstructions[] = { |
- {{&RawMachineAssembler::Int32Add, "Int32Add", kArm64Add32, kMachInt32}, |
+ {{&RawMachineAssembler::Int32Add, "Int32Add", kArm64Add32, |
+ MachineType::Int32()}, |
kArm64Sub32}, |
- {{&RawMachineAssembler::Int64Add, "Int64Add", kArm64Add, kMachInt64}, |
+ {{&RawMachineAssembler::Int64Add, "Int64Add", kArm64Add, |
+ MachineType::Int64()}, |
kArm64Sub}, |
- {{&RawMachineAssembler::Int32Sub, "Int32Sub", kArm64Sub32, kMachInt32}, |
+ {{&RawMachineAssembler::Int32Sub, "Int32Sub", kArm64Sub32, |
+ MachineType::Int32()}, |
kArm64Add32}, |
- {{&RawMachineAssembler::Int64Sub, "Int64Sub", kArm64Sub, kMachInt64}, |
+ {{&RawMachineAssembler::Int64Sub, "Int64Sub", kArm64Sub, |
+ MachineType::Int64()}, |
kArm64Add}}; |
@@ -159,60 +169,78 @@ const int32_t kAddSubImmediates[] = { |
// ARM64 flag setting data processing instructions. |
const MachInst2 kDPFlagSetInstructions[] = { |
- {&RawMachineAssembler::Word32And, "Word32And", kArm64Tst32, kMachInt32}, |
- {&RawMachineAssembler::Int32Add, "Int32Add", kArm64Cmn32, kMachInt32}, |
- {&RawMachineAssembler::Int32Sub, "Int32Sub", kArm64Cmp32, kMachInt32}, |
- {&RawMachineAssembler::Word64And, "Word64And", kArm64Tst, kMachInt64}}; |
+ {&RawMachineAssembler::Word32And, "Word32And", kArm64Tst32, |
+ MachineType::Int32()}, |
+ {&RawMachineAssembler::Int32Add, "Int32Add", kArm64Cmn32, |
+ MachineType::Int32()}, |
+ {&RawMachineAssembler::Int32Sub, "Int32Sub", kArm64Cmp32, |
+ MachineType::Int32()}, |
+ {&RawMachineAssembler::Word64And, "Word64And", kArm64Tst, |
+ MachineType::Int64()}}; |
// ARM64 arithmetic with overflow instructions. |
const MachInst2 kOvfAddSubInstructions[] = { |
{&RawMachineAssembler::Int32AddWithOverflow, "Int32AddWithOverflow", |
- kArm64Add32, kMachInt32}, |
+ kArm64Add32, MachineType::Int32()}, |
{&RawMachineAssembler::Int32SubWithOverflow, "Int32SubWithOverflow", |
- kArm64Sub32, kMachInt32}}; |
+ kArm64Sub32, MachineType::Int32()}}; |
// ARM64 shift instructions. |
const Shift kShiftInstructions[] = { |
- {{&RawMachineAssembler::Word32Shl, "Word32Shl", kArm64Lsl32, kMachInt32}, |
+ {{&RawMachineAssembler::Word32Shl, "Word32Shl", kArm64Lsl32, |
+ MachineType::Int32()}, |
kMode_Operand2_R_LSL_I}, |
- {{&RawMachineAssembler::Word64Shl, "Word64Shl", kArm64Lsl, kMachInt64}, |
+ {{&RawMachineAssembler::Word64Shl, "Word64Shl", kArm64Lsl, |
+ MachineType::Int64()}, |
kMode_Operand2_R_LSL_I}, |
- {{&RawMachineAssembler::Word32Shr, "Word32Shr", kArm64Lsr32, kMachInt32}, |
+ {{&RawMachineAssembler::Word32Shr, "Word32Shr", kArm64Lsr32, |
+ MachineType::Int32()}, |
kMode_Operand2_R_LSR_I}, |
- {{&RawMachineAssembler::Word64Shr, "Word64Shr", kArm64Lsr, kMachInt64}, |
+ {{&RawMachineAssembler::Word64Shr, "Word64Shr", kArm64Lsr, |
+ MachineType::Int64()}, |
kMode_Operand2_R_LSR_I}, |
- {{&RawMachineAssembler::Word32Sar, "Word32Sar", kArm64Asr32, kMachInt32}, |
+ {{&RawMachineAssembler::Word32Sar, "Word32Sar", kArm64Asr32, |
+ MachineType::Int32()}, |
kMode_Operand2_R_ASR_I}, |
- {{&RawMachineAssembler::Word64Sar, "Word64Sar", kArm64Asr, kMachInt64}, |
+ {{&RawMachineAssembler::Word64Sar, "Word64Sar", kArm64Asr, |
+ MachineType::Int64()}, |
kMode_Operand2_R_ASR_I}, |
- {{&RawMachineAssembler::Word32Ror, "Word32Ror", kArm64Ror32, kMachInt32}, |
+ {{&RawMachineAssembler::Word32Ror, "Word32Ror", kArm64Ror32, |
+ MachineType::Int32()}, |
kMode_Operand2_R_ROR_I}, |
- {{&RawMachineAssembler::Word64Ror, "Word64Ror", kArm64Ror, kMachInt64}, |
+ {{&RawMachineAssembler::Word64Ror, "Word64Ror", kArm64Ror, |
+ MachineType::Int64()}, |
kMode_Operand2_R_ROR_I}}; |
// ARM64 Mul/Div instructions. |
const MachInst2 kMulDivInstructions[] = { |
- {&RawMachineAssembler::Int32Mul, "Int32Mul", kArm64Mul32, kMachInt32}, |
- {&RawMachineAssembler::Int64Mul, "Int64Mul", kArm64Mul, kMachInt64}, |
- {&RawMachineAssembler::Int32Div, "Int32Div", kArm64Idiv32, kMachInt32}, |
- {&RawMachineAssembler::Int64Div, "Int64Div", kArm64Idiv, kMachInt64}, |
- {&RawMachineAssembler::Uint32Div, "Uint32Div", kArm64Udiv32, kMachInt32}, |
- {&RawMachineAssembler::Uint64Div, "Uint64Div", kArm64Udiv, kMachInt64}}; |
+ {&RawMachineAssembler::Int32Mul, "Int32Mul", kArm64Mul32, |
+ MachineType::Int32()}, |
+ {&RawMachineAssembler::Int64Mul, "Int64Mul", kArm64Mul, |
+ MachineType::Int64()}, |
+ {&RawMachineAssembler::Int32Div, "Int32Div", kArm64Idiv32, |
+ MachineType::Int32()}, |
+ {&RawMachineAssembler::Int64Div, "Int64Div", kArm64Idiv, |
+ MachineType::Int64()}, |
+ {&RawMachineAssembler::Uint32Div, "Uint32Div", kArm64Udiv32, |
+ MachineType::Int32()}, |
+ {&RawMachineAssembler::Uint64Div, "Uint64Div", kArm64Udiv, |
+ MachineType::Int64()}}; |
// ARM64 FP arithmetic instructions. |
const MachInst2 kFPArithInstructions[] = { |
{&RawMachineAssembler::Float64Add, "Float64Add", kArm64Float64Add, |
- kMachFloat64}, |
+ MachineType::Float64()}, |
{&RawMachineAssembler::Float64Sub, "Float64Sub", kArm64Float64Sub, |
- kMachFloat64}, |
+ MachineType::Float64()}, |
{&RawMachineAssembler::Float64Mul, "Float64Mul", kArm64Float64Mul, |
- kMachFloat64}, |
+ MachineType::Float64()}, |
{&RawMachineAssembler::Float64Div, "Float64Div", kArm64Float64Div, |
- kMachFloat64}}; |
+ MachineType::Float64()}}; |
struct FPCmp { |
@@ -230,23 +258,29 @@ std::ostream& operator<<(std::ostream& os, const FPCmp& cmp) { |
// ARM64 FP comparison instructions. |
const FPCmp kFPCmpInstructions[] = { |
{{&RawMachineAssembler::Float64Equal, "Float64Equal", kArm64Float64Cmp, |
- kMachFloat64}, |
- kEqual, kEqual}, |
+ MachineType::Float64()}, |
+ kEqual, |
+ kEqual}, |
{{&RawMachineAssembler::Float64LessThan, "Float64LessThan", |
- kArm64Float64Cmp, kMachFloat64}, |
- kFloatLessThan, kFloatGreaterThan}, |
+ kArm64Float64Cmp, MachineType::Float64()}, |
+ kFloatLessThan, |
+ kFloatGreaterThan}, |
{{&RawMachineAssembler::Float64LessThanOrEqual, "Float64LessThanOrEqual", |
- kArm64Float64Cmp, kMachFloat64}, |
- kFloatLessThanOrEqual, kFloatGreaterThanOrEqual}, |
+ kArm64Float64Cmp, MachineType::Float64()}, |
+ kFloatLessThanOrEqual, |
+ kFloatGreaterThanOrEqual}, |
{{&RawMachineAssembler::Float32Equal, "Float32Equal", kArm64Float32Cmp, |
- kMachFloat32}, |
- kEqual, kEqual}, |
+ MachineType::Float32()}, |
+ kEqual, |
+ kEqual}, |
{{&RawMachineAssembler::Float32LessThan, "Float32LessThan", |
- kArm64Float32Cmp, kMachFloat32}, |
- kFloatLessThan, kFloatGreaterThan}, |
+ kArm64Float32Cmp, MachineType::Float32()}, |
+ kFloatLessThan, |
+ kFloatGreaterThan}, |
{{&RawMachineAssembler::Float32LessThanOrEqual, "Float32LessThanOrEqual", |
- kArm64Float32Cmp, kMachFloat32}, |
- kFloatLessThanOrEqual, kFloatGreaterThanOrEqual}}; |
+ kArm64Float32Cmp, MachineType::Float32()}, |
+ kFloatLessThanOrEqual, |
+ kFloatGreaterThanOrEqual}}; |
struct Conversion { |
@@ -264,32 +298,33 @@ std::ostream& operator<<(std::ostream& os, const Conversion& conv) { |
// ARM64 type conversion instructions. |
const Conversion kConversionInstructions[] = { |
{{&RawMachineAssembler::ChangeFloat32ToFloat64, "ChangeFloat32ToFloat64", |
- kArm64Float32ToFloat64, kMachFloat64}, |
- kMachFloat32}, |
+ kArm64Float32ToFloat64, MachineType::Float64()}, |
+ MachineType::Float32()}, |
{{&RawMachineAssembler::TruncateFloat64ToFloat32, |
- "TruncateFloat64ToFloat32", kArm64Float64ToFloat32, kMachFloat32}, |
- kMachFloat64}, |
+ "TruncateFloat64ToFloat32", kArm64Float64ToFloat32, |
+ MachineType::Float32()}, |
+ MachineType::Float64()}, |
{{&RawMachineAssembler::ChangeInt32ToInt64, "ChangeInt32ToInt64", |
- kArm64Sxtw, kMachInt64}, |
- kMachInt32}, |
+ kArm64Sxtw, MachineType::Int64()}, |
+ MachineType::Int32()}, |
{{&RawMachineAssembler::ChangeUint32ToUint64, "ChangeUint32ToUint64", |
- kArm64Mov32, kMachUint64}, |
- kMachUint32}, |
+ kArm64Mov32, MachineType::Uint64()}, |
+ MachineType::Uint32()}, |
{{&RawMachineAssembler::TruncateInt64ToInt32, "TruncateInt64ToInt32", |
- kArm64Mov32, kMachInt32}, |
- kMachInt64}, |
+ kArm64Mov32, MachineType::Int32()}, |
+ MachineType::Int64()}, |
{{&RawMachineAssembler::ChangeInt32ToFloat64, "ChangeInt32ToFloat64", |
- kArm64Int32ToFloat64, kMachFloat64}, |
- kMachInt32}, |
+ kArm64Int32ToFloat64, MachineType::Float64()}, |
+ MachineType::Int32()}, |
{{&RawMachineAssembler::ChangeUint32ToFloat64, "ChangeUint32ToFloat64", |
- kArm64Uint32ToFloat64, kMachFloat64}, |
- kMachUint32}, |
+ kArm64Uint32ToFloat64, MachineType::Float64()}, |
+ MachineType::Uint32()}, |
{{&RawMachineAssembler::ChangeFloat64ToInt32, "ChangeFloat64ToInt32", |
- kArm64Float64ToInt32, kMachInt32}, |
- kMachFloat64}, |
+ kArm64Float64ToInt32, MachineType::Int32()}, |
+ MachineType::Float64()}, |
{{&RawMachineAssembler::ChangeFloat64ToUint32, "ChangeFloat64ToUint32", |
- kArm64Float64ToUint32, kMachUint32}, |
- kMachFloat64}}; |
+ kArm64Float64ToUint32, MachineType::Uint32()}, |
+ MachineType::Float64()}}; |
} // namespace |
@@ -319,7 +354,7 @@ TEST_P(InstructionSelectorLogicalTest, Immediate) { |
const MachInst2 dpi = GetParam(); |
const MachineType type = dpi.machine_type; |
// TODO(all): Add support for testing 64-bit immediates. |
- if (type == kMachInt32) { |
+ if (type == MachineType::Int32()) { |
// Immediate on the right. |
TRACED_FOREACH(int32_t, imm, kLogical32Immediates) { |
StreamBuilder m(this, type, type); |
@@ -356,7 +391,7 @@ TEST_P(InstructionSelectorLogicalTest, ShiftByImmediate) { |
// Only test 64-bit shifted operands with 64-bit instructions. |
if (shift.mi.machine_type != type) continue; |
- TRACED_FORRANGE(int, imm, 0, ((type == kMachInt32) ? 31 : 63)) { |
+ TRACED_FORRANGE(int, imm, 0, ((type == MachineType::Int32()) ? 31 : 63)) { |
StreamBuilder m(this, type, type, type); |
m.Return((m.*dpi.constructor)( |
m.Parameter(0), |
@@ -371,7 +406,7 @@ TEST_P(InstructionSelectorLogicalTest, ShiftByImmediate) { |
EXPECT_EQ(1U, s[0]->OutputCount()); |
} |
- TRACED_FORRANGE(int, imm, 0, ((type == kMachInt32) ? 31 : 63)) { |
+ TRACED_FORRANGE(int, imm, 0, ((type == MachineType::Int32()) ? 31 : 63)) { |
StreamBuilder m(this, type, type, type); |
m.Return((m.*dpi.constructor)( |
(m.*shift.mi.constructor)(m.Parameter(1), |
@@ -462,7 +497,7 @@ TEST_P(InstructionSelectorAddSubTest, ShiftByImmediateOnRight) { |
continue; |
} |
- TRACED_FORRANGE(int, imm, 0, ((type == kMachInt32) ? 31 : 63)) { |
+ TRACED_FORRANGE(int, imm, 0, ((type == MachineType::Int32()) ? 31 : 63)) { |
StreamBuilder m(this, type, type, type); |
m.Return((m.*dpi.mi.constructor)( |
m.Parameter(0), |
@@ -552,7 +587,7 @@ TEST_F(InstructionSelectorTest, AddImmediateOnLeft) { |
{ |
// 32-bit add. |
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) { |
- 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()); |
@@ -566,7 +601,7 @@ TEST_F(InstructionSelectorTest, AddImmediateOnLeft) { |
{ |
// 64-bit add. |
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) { |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
m.Return(m.Int64Add(m.Int64Constant(imm), m.Parameter(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -583,7 +618,8 @@ TEST_F(InstructionSelectorTest, AddImmediateOnLeft) { |
TEST_F(InstructionSelectorTest, SubZeroOnLeft) { |
{ |
// 32-bit subtract. |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return(m.Int32Sub(m.Int32Constant(0), m.Parameter(0))); |
Stream s = m.Build(); |
@@ -596,7 +632,8 @@ TEST_F(InstructionSelectorTest, SubZeroOnLeft) { |
} |
{ |
// 64-bit subtract. |
- StreamBuilder m(this, kMachInt64, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), |
+ MachineType::Int64()); |
m.Return(m.Int64Sub(m.Int64Constant(0), m.Parameter(0))); |
Stream s = m.Build(); |
@@ -615,13 +652,14 @@ TEST_F(InstructionSelectorTest, SubZeroOnLeftWithShift) { |
{ |
// Test 32-bit operations. Ignore ROR shifts, as subtract does not |
// support them. |
- if ((shift.mi.machine_type != kMachInt32) || |
+ if ((shift.mi.machine_type != MachineType::Int32()) || |
(shift.mi.arch_opcode == kArm64Ror32) || |
(shift.mi.arch_opcode == kArm64Ror)) |
continue; |
TRACED_FORRANGE(int, imm, -32, 63) { |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return(m.Int32Sub( |
m.Int32Constant(0), |
(m.*shift.mi.constructor)(m.Parameter(1), m.Int32Constant(imm)))); |
@@ -640,13 +678,14 @@ TEST_F(InstructionSelectorTest, SubZeroOnLeftWithShift) { |
{ |
// Test 64-bit operations. Ignore ROR shifts, as subtract does not |
// support them. |
- if ((shift.mi.machine_type != kMachInt64) || |
+ if ((shift.mi.machine_type != MachineType::Int64()) || |
(shift.mi.arch_opcode == kArm64Ror32) || |
(shift.mi.arch_opcode == kArm64Ror)) |
continue; |
TRACED_FORRANGE(int, imm, -32, 127) { |
- StreamBuilder m(this, kMachInt64, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), |
+ MachineType::Int64()); |
m.Return(m.Int64Sub( |
m.Int64Constant(0), |
(m.*shift.mi.constructor)(m.Parameter(1), m.Int64Constant(imm)))); |
@@ -671,7 +710,7 @@ TEST_F(InstructionSelectorTest, AddNegImmediateOnLeft) { |
// 32-bit add. |
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) { |
if (imm == 0) continue; |
- 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(); |
@@ -687,7 +726,7 @@ TEST_F(InstructionSelectorTest, AddNegImmediateOnLeft) { |
// 64-bit add. |
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) { |
if (imm == 0) continue; |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
m.Return(m.Int64Add(m.Int64Constant(-imm), m.Parameter(0))); |
Stream s = m.Build(); |
@@ -706,13 +745,14 @@ TEST_F(InstructionSelectorTest, AddShiftByImmediateOnLeft) { |
// 32-bit add. |
TRACED_FOREACH(Shift, shift, kShiftInstructions) { |
// Only test relevant shifted operands. |
- if (shift.mi.machine_type != kMachInt32) continue; |
+ if (shift.mi.machine_type != MachineType::Int32()) continue; |
if (shift.mi.arch_opcode == kArm64Ror32) continue; |
// The available shift operand range is `0 <= imm < 32`, but we also test |
// that immediates outside this range are handled properly (modulo-32). |
TRACED_FORRANGE(int, imm, -32, 63) { |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return((m.Int32Add)( |
(m.*shift.mi.constructor)(m.Parameter(1), m.Int32Constant(imm)), |
m.Parameter(0))); |
@@ -729,13 +769,14 @@ TEST_F(InstructionSelectorTest, AddShiftByImmediateOnLeft) { |
// 64-bit add. |
TRACED_FOREACH(Shift, shift, kShiftInstructions) { |
// Only test relevant shifted operands. |
- if (shift.mi.machine_type != kMachInt64) continue; |
+ if (shift.mi.machine_type != MachineType::Int64()) continue; |
if (shift.mi.arch_opcode == kArm64Ror) continue; |
// The available shift operand range is `0 <= imm < 64`, but we also test |
// that immediates outside this range are handled properly (modulo-64). |
TRACED_FORRANGE(int, imm, -64, 127) { |
- StreamBuilder m(this, kMachInt64, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), |
+ MachineType::Int64()); |
m.Return((m.Int64Add)( |
(m.*shift.mi.constructor)(m.Parameter(1), m.Int64Constant(imm)), |
m.Parameter(0))); |
@@ -753,7 +794,8 @@ TEST_F(InstructionSelectorTest, AddShiftByImmediateOnLeft) { |
TEST_F(InstructionSelectorTest, AddUnsignedExtendByteOnLeft) { |
{ |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return(m.Int32Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xff)), |
m.Parameter(1))); |
Stream s = m.Build(); |
@@ -764,7 +806,8 @@ TEST_F(InstructionSelectorTest, AddUnsignedExtendByteOnLeft) { |
ASSERT_EQ(1U, s[0]->OutputCount()); |
} |
{ |
- StreamBuilder m(this, kMachInt64, kMachInt32, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int32(), |
+ MachineType::Int64()); |
m.Return(m.Int64Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xff)), |
m.Parameter(1))); |
Stream s = m.Build(); |
@@ -779,7 +822,8 @@ TEST_F(InstructionSelectorTest, AddUnsignedExtendByteOnLeft) { |
TEST_F(InstructionSelectorTest, AddUnsignedExtendHalfwordOnLeft) { |
{ |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return(m.Int32Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xffff)), |
m.Parameter(1))); |
Stream s = m.Build(); |
@@ -790,7 +834,8 @@ TEST_F(InstructionSelectorTest, AddUnsignedExtendHalfwordOnLeft) { |
ASSERT_EQ(1U, s[0]->OutputCount()); |
} |
{ |
- StreamBuilder m(this, kMachInt64, kMachInt32, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int32(), |
+ MachineType::Int64()); |
m.Return(m.Int64Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xffff)), |
m.Parameter(1))); |
Stream s = m.Build(); |
@@ -805,7 +850,8 @@ TEST_F(InstructionSelectorTest, AddUnsignedExtendHalfwordOnLeft) { |
TEST_F(InstructionSelectorTest, AddSignedExtendByteOnLeft) { |
{ |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return( |
m.Int32Add(m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(24)), |
m.Int32Constant(24)), |
@@ -818,7 +864,8 @@ TEST_F(InstructionSelectorTest, AddSignedExtendByteOnLeft) { |
ASSERT_EQ(1U, s[0]->OutputCount()); |
} |
{ |
- StreamBuilder m(this, kMachInt64, kMachInt32, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int32(), |
+ MachineType::Int64()); |
m.Return( |
m.Int64Add(m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(24)), |
m.Int32Constant(24)), |
@@ -835,7 +882,8 @@ TEST_F(InstructionSelectorTest, AddSignedExtendByteOnLeft) { |
TEST_F(InstructionSelectorTest, AddSignedExtendHalfwordOnLeft) { |
{ |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return( |
m.Int32Add(m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(16)), |
m.Int32Constant(16)), |
@@ -848,7 +896,8 @@ TEST_F(InstructionSelectorTest, AddSignedExtendHalfwordOnLeft) { |
ASSERT_EQ(1U, s[0]->OutputCount()); |
} |
{ |
- StreamBuilder m(this, kMachInt64, kMachInt32, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int32(), |
+ MachineType::Int64()); |
m.Return( |
m.Int64Add(m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(16)), |
m.Int32Constant(16)), |
@@ -899,7 +948,7 @@ TEST_F(InstructionSelectorTest, Word32AndBranchWithImmediateOnRight) { |
// Skip the cases where the instruction selector would use tbz/tbnz. |
if (base::bits::CountPopulation32(imm) == 1) continue; |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
RawMachineLabel a, b; |
m.Branch(m.Word32And(m.Parameter(0), m.Int32Constant(imm)), &a, &b); |
m.Bind(&a); |
@@ -922,7 +971,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithImmediateOnRight) { |
// Skip the cases where the instruction selector would use tbz/tbnz. |
if (base::bits::CountPopulation64(imm) == 1) continue; |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
RawMachineLabel a, b; |
m.Branch(m.Word64And(m.Parameter(0), m.Int64Constant(imm)), &a, &b); |
m.Bind(&a); |
@@ -942,7 +991,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithImmediateOnRight) { |
TEST_F(InstructionSelectorTest, AddBranchWithImmediateOnRight) { |
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
RawMachineLabel a, b; |
m.Branch(m.Int32Add(m.Parameter(0), m.Int32Constant(imm)), &a, &b); |
m.Bind(&a); |
@@ -960,7 +1009,7 @@ TEST_F(InstructionSelectorTest, AddBranchWithImmediateOnRight) { |
TEST_F(InstructionSelectorTest, SubBranchWithImmediateOnRight) { |
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
RawMachineLabel a, b; |
m.Branch(m.Int32Sub(m.Parameter(0), m.Int32Constant(imm)), &a, &b); |
m.Bind(&a); |
@@ -981,7 +1030,7 @@ TEST_F(InstructionSelectorTest, Word32AndBranchWithImmediateOnLeft) { |
// Skip the cases where the instruction selector would use tbz/tbnz. |
if (base::bits::CountPopulation32(imm) == 1) continue; |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
RawMachineLabel a, b; |
m.Branch(m.Word32And(m.Int32Constant(imm), m.Parameter(0)), &a, &b); |
m.Bind(&a); |
@@ -1005,7 +1054,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithImmediateOnLeft) { |
// Skip the cases where the instruction selector would use tbz/tbnz. |
if (base::bits::CountPopulation64(imm) == 1) continue; |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
RawMachineLabel a, b; |
m.Branch(m.Word64And(m.Int64Constant(imm), m.Parameter(0)), &a, &b); |
m.Bind(&a); |
@@ -1026,7 +1075,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithImmediateOnLeft) { |
TEST_F(InstructionSelectorTest, AddBranchWithImmediateOnLeft) { |
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
RawMachineLabel a, b; |
m.Branch(m.Int32Add(m.Int32Constant(imm), m.Parameter(0)), &a, &b); |
m.Bind(&a); |
@@ -1046,7 +1095,7 @@ TEST_F(InstructionSelectorTest, AddBranchWithImmediateOnLeft) { |
TEST_F(InstructionSelectorTest, Word32AndBranchWithOneBitMaskOnRight) { |
TRACED_FORRANGE(int, bit, 0, 31) { |
uint32_t mask = 1 << bit; |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
RawMachineLabel a, b; |
m.Branch(m.Word32And(m.Parameter(0), m.Int32Constant(mask)), &a, &b); |
m.Bind(&a); |
@@ -1064,7 +1113,7 @@ TEST_F(InstructionSelectorTest, Word32AndBranchWithOneBitMaskOnRight) { |
TRACED_FORRANGE(int, bit, 0, 31) { |
uint32_t mask = 1 << bit; |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
RawMachineLabel a, b; |
m.Branch( |
m.Word32BinaryNot(m.Word32And(m.Parameter(0), m.Int32Constant(mask))), |
@@ -1087,7 +1136,7 @@ TEST_F(InstructionSelectorTest, Word32AndBranchWithOneBitMaskOnRight) { |
TEST_F(InstructionSelectorTest, Word32AndBranchWithOneBitMaskOnLeft) { |
TRACED_FORRANGE(int, bit, 0, 31) { |
uint32_t mask = 1 << bit; |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
RawMachineLabel a, b; |
m.Branch(m.Word32And(m.Int32Constant(mask), m.Parameter(0)), &a, &b); |
m.Bind(&a); |
@@ -1105,7 +1154,7 @@ TEST_F(InstructionSelectorTest, Word32AndBranchWithOneBitMaskOnLeft) { |
TRACED_FORRANGE(int, bit, 0, 31) { |
uint32_t mask = 1 << bit; |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
RawMachineLabel a, b; |
m.Branch( |
m.Word32BinaryNot(m.Word32And(m.Int32Constant(mask), m.Parameter(0))), |
@@ -1128,7 +1177,7 @@ TEST_F(InstructionSelectorTest, Word32AndBranchWithOneBitMaskOnLeft) { |
TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnRight) { |
TRACED_FORRANGE(int, bit, 0, 63) { |
uint64_t mask = 1L << bit; |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
RawMachineLabel a, b; |
m.Branch(m.Word64And(m.Parameter(0), m.Int64Constant(mask)), &a, &b); |
m.Bind(&a); |
@@ -1149,7 +1198,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnRight) { |
TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnLeft) { |
TRACED_FORRANGE(int, bit, 0, 63) { |
uint64_t mask = 1L << bit; |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
RawMachineLabel a, b; |
m.Branch(m.Word64And(m.Int64Constant(mask), m.Parameter(0)), &a, &b); |
m.Bind(&a); |
@@ -1169,7 +1218,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnLeft) { |
TEST_F(InstructionSelectorTest, CompareAgainstZeroAndBranch) { |
{ |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
RawMachineLabel a, b; |
Node* p0 = m.Parameter(0); |
m.Branch(p0, &a, &b); |
@@ -1186,7 +1235,7 @@ TEST_F(InstructionSelectorTest, CompareAgainstZeroAndBranch) { |
} |
{ |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
RawMachineLabel a, b; |
Node* p0 = m.Parameter(0); |
m.Branch(m.Word32BinaryNot(p0), &a, &b); |
@@ -1366,7 +1415,7 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, |
TEST_F(InstructionSelectorTest, OvfFlagAddImmediateOnLeft) { |
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Projection( |
1, m.Int32AddWithOverflow(m.Int32Constant(imm), m.Parameter(0)))); |
Stream s = m.Build(); |
@@ -1384,7 +1433,7 @@ TEST_F(InstructionSelectorTest, OvfFlagAddImmediateOnLeft) { |
TEST_F(InstructionSelectorTest, OvfValAddImmediateOnLeft) { |
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Projection( |
0, m.Int32AddWithOverflow(m.Int32Constant(imm), m.Parameter(0)))); |
Stream s = m.Build(); |
@@ -1401,7 +1450,7 @@ TEST_F(InstructionSelectorTest, OvfValAddImmediateOnLeft) { |
TEST_F(InstructionSelectorTest, OvfBothAddImmediateOnLeft) { |
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
Node* n = m.Int32AddWithOverflow(m.Int32Constant(imm), m.Parameter(0)); |
m.Return(m.Word32Equal(m.Projection(0, n), m.Projection(1, n))); |
Stream s = m.Build(); |
@@ -1419,7 +1468,7 @@ TEST_F(InstructionSelectorTest, OvfBothAddImmediateOnLeft) { |
TEST_F(InstructionSelectorTest, OvfBranchWithImmediateOnLeft) { |
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
RawMachineLabel a, b; |
Node* n = m.Int32AddWithOverflow(m.Int32Constant(imm), m.Parameter(0)); |
m.Branch(m.Projection(1, n), &a, &b); |
@@ -1463,7 +1512,8 @@ TEST_P(InstructionSelectorShiftTest, Parameter) { |
TEST_P(InstructionSelectorShiftTest, Immediate) { |
const Shift shift = GetParam(); |
const MachineType type = shift.mi.machine_type; |
- TRACED_FORRANGE(int32_t, imm, 0, (ElementSizeOf(type) * 8) - 1) { |
+ TRACED_FORRANGE(int32_t, imm, 0, |
+ ((1 << ElementSizeLog2Of(type.representation())) * 8) - 1) { |
StreamBuilder m(this, type, type); |
m.Return((m.*shift.mi.constructor)(m.Parameter(0), m.Int32Constant(imm))); |
Stream s = m.Build(); |
@@ -1483,7 +1533,7 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorShiftTest, |
TEST_F(InstructionSelectorTest, Word64ShlWithChangeInt32ToInt64) { |
TRACED_FORRANGE(int64_t, x, 32, 63) { |
- StreamBuilder m(this, kMachInt64, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int32()); |
Node* const p0 = m.Parameter(0); |
Node* const n = m.Word64Shl(m.ChangeInt32ToInt64(p0), m.Int64Constant(x)); |
m.Return(n); |
@@ -1501,7 +1551,7 @@ TEST_F(InstructionSelectorTest, Word64ShlWithChangeInt32ToInt64) { |
TEST_F(InstructionSelectorTest, Word64ShlWithChangeUint32ToUint64) { |
TRACED_FORRANGE(int64_t, x, 32, 63) { |
- StreamBuilder m(this, kMachInt64, kMachUint32); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Uint32()); |
Node* const p0 = m.Parameter(0); |
Node* const n = m.Word64Shl(m.ChangeUint32ToUint64(p0), m.Int64Constant(x)); |
m.Return(n); |
@@ -1518,7 +1568,7 @@ TEST_F(InstructionSelectorTest, Word64ShlWithChangeUint32ToUint64) { |
TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithWord64Sar) { |
- StreamBuilder m(this, kMachInt32, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int64()); |
Node* const p = m.Parameter(0); |
Node* const t = m.TruncateInt64ToInt32(m.Word64Sar(p, m.Int64Constant(32))); |
m.Return(t); |
@@ -1535,7 +1585,7 @@ TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithWord64Sar) { |
TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithWord64Shr) { |
TRACED_FORRANGE(int64_t, x, 32, 63) { |
- StreamBuilder m(this, kMachInt32, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int64()); |
Node* const p = m.Parameter(0); |
Node* const t = m.TruncateInt64ToInt32(m.Word64Shr(p, m.Int64Constant(x))); |
m.Return(t); |
@@ -1600,10 +1650,10 @@ std::ostream& operator<<(std::ostream& os, const MulDPInst& inst) { |
static const MulDPInst kMulDPInstructions[] = { |
{"Int32Mul", &RawMachineAssembler::Int32Mul, &RawMachineAssembler::Int32Add, |
&RawMachineAssembler::Int32Sub, kArm64Madd32, kArm64Msub32, kArm64Mneg32, |
- kMachInt32}, |
+ MachineType::Int32()}, |
{"Int64Mul", &RawMachineAssembler::Int64Mul, &RawMachineAssembler::Int64Add, |
&RawMachineAssembler::Int64Sub, kArm64Madd, kArm64Msub, kArm64Mneg, |
- kMachInt64}}; |
+ MachineType::Int64()}}; |
typedef InstructionSelectorTestWithParam<MulDPInst> |
@@ -1688,7 +1738,7 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, |
TEST_F(InstructionSelectorTest, Int32MulWithImmediate) { |
// x * (2^k + 1) -> x + (x << k) |
TRACED_FORRANGE(int32_t, k, 1, 30) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Int32Mul(m.Parameter(0), m.Int32Constant((1 << k) + 1))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -1701,7 +1751,7 @@ TEST_F(InstructionSelectorTest, Int32MulWithImmediate) { |
} |
// (2^k + 1) * x -> x + (x << k) |
TRACED_FORRANGE(int32_t, k, 1, 30) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Int32Mul(m.Int32Constant((1 << k) + 1), m.Parameter(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -1714,7 +1764,8 @@ TEST_F(InstructionSelectorTest, Int32MulWithImmediate) { |
} |
// x * (2^k + 1) + c -> x + (x << k) + c |
TRACED_FORRANGE(int32_t, k, 1, 30) { |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return( |
m.Int32Add(m.Int32Mul(m.Parameter(0), m.Int32Constant((1 << k) + 1)), |
m.Parameter(1))); |
@@ -1730,7 +1781,8 @@ TEST_F(InstructionSelectorTest, Int32MulWithImmediate) { |
} |
// (2^k + 1) * x + c -> x + (x << k) + c |
TRACED_FORRANGE(int32_t, k, 1, 30) { |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return( |
m.Int32Add(m.Int32Mul(m.Int32Constant((1 << k) + 1), m.Parameter(0)), |
m.Parameter(1))); |
@@ -1746,7 +1798,8 @@ TEST_F(InstructionSelectorTest, Int32MulWithImmediate) { |
} |
// c + x * (2^k + 1) -> c + x + (x << k) |
TRACED_FORRANGE(int32_t, k, 1, 30) { |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return( |
m.Int32Add(m.Parameter(0), |
m.Int32Mul(m.Parameter(1), m.Int32Constant((1 << k) + 1)))); |
@@ -1762,7 +1815,8 @@ TEST_F(InstructionSelectorTest, Int32MulWithImmediate) { |
} |
// c + (2^k + 1) * x -> c + x + (x << k) |
TRACED_FORRANGE(int32_t, k, 1, 30) { |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return( |
m.Int32Add(m.Parameter(0), |
m.Int32Mul(m.Int32Constant((1 << k) + 1), m.Parameter(1)))); |
@@ -1778,7 +1832,8 @@ TEST_F(InstructionSelectorTest, Int32MulWithImmediate) { |
} |
// c - x * (2^k + 1) -> c - x + (x << k) |
TRACED_FORRANGE(int32_t, k, 1, 30) { |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return( |
m.Int32Sub(m.Parameter(0), |
m.Int32Mul(m.Parameter(1), m.Int32Constant((1 << k) + 1)))); |
@@ -1794,7 +1849,8 @@ TEST_F(InstructionSelectorTest, Int32MulWithImmediate) { |
} |
// c - (2^k + 1) * x -> c - x + (x << k) |
TRACED_FORRANGE(int32_t, k, 1, 30) { |
- StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), |
+ MachineType::Int32()); |
m.Return( |
m.Int32Sub(m.Parameter(0), |
m.Int32Mul(m.Int32Constant((1 << k) + 1), m.Parameter(1)))); |
@@ -1814,7 +1870,7 @@ TEST_F(InstructionSelectorTest, Int32MulWithImmediate) { |
TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { |
// x * (2^k + 1) -> x + (x << k) |
TRACED_FORRANGE(int64_t, k, 1, 62) { |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
m.Return(m.Int64Mul(m.Parameter(0), m.Int64Constant((1L << k) + 1))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -1827,7 +1883,7 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { |
} |
// (2^k + 1) * x -> x + (x << k) |
TRACED_FORRANGE(int64_t, k, 1, 62) { |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
m.Return(m.Int64Mul(m.Int64Constant((1L << k) + 1), m.Parameter(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -1840,7 +1896,8 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { |
} |
// x * (2^k + 1) + c -> x + (x << k) + c |
TRACED_FORRANGE(int64_t, k, 1, 62) { |
- StreamBuilder m(this, kMachInt64, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), |
+ MachineType::Int64()); |
m.Return( |
m.Int64Add(m.Int64Mul(m.Parameter(0), m.Int64Constant((1L << k) + 1)), |
m.Parameter(1))); |
@@ -1856,7 +1913,8 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { |
} |
// (2^k + 1) * x + c -> x + (x << k) + c |
TRACED_FORRANGE(int64_t, k, 1, 62) { |
- StreamBuilder m(this, kMachInt64, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), |
+ MachineType::Int64()); |
m.Return( |
m.Int64Add(m.Int64Mul(m.Int64Constant((1L << k) + 1), m.Parameter(0)), |
m.Parameter(1))); |
@@ -1872,7 +1930,8 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { |
} |
// c + x * (2^k + 1) -> c + x + (x << k) |
TRACED_FORRANGE(int64_t, k, 1, 62) { |
- StreamBuilder m(this, kMachInt64, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), |
+ MachineType::Int64()); |
m.Return( |
m.Int64Add(m.Parameter(0), |
m.Int64Mul(m.Parameter(1), m.Int64Constant((1L << k) + 1)))); |
@@ -1888,7 +1947,8 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { |
} |
// c + (2^k + 1) * x -> c + x + (x << k) |
TRACED_FORRANGE(int64_t, k, 1, 62) { |
- StreamBuilder m(this, kMachInt64, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), |
+ MachineType::Int64()); |
m.Return( |
m.Int64Add(m.Parameter(0), |
m.Int64Mul(m.Int64Constant((1L << k) + 1), m.Parameter(1)))); |
@@ -1904,7 +1964,8 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { |
} |
// c - x * (2^k + 1) -> c - x + (x << k) |
TRACED_FORRANGE(int64_t, k, 1, 62) { |
- StreamBuilder m(this, kMachInt64, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), |
+ MachineType::Int64()); |
m.Return( |
m.Int64Sub(m.Parameter(0), |
m.Int64Mul(m.Parameter(1), m.Int64Constant((1L << k) + 1)))); |
@@ -1920,7 +1981,8 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { |
} |
// c - (2^k + 1) * x -> c - x + (x << k) |
TRACED_FORRANGE(int64_t, k, 1, 62) { |
- StreamBuilder m(this, kMachInt64, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), |
+ MachineType::Int64()); |
m.Return( |
m.Int64Sub(m.Parameter(0), |
m.Int64Mul(m.Int64Constant((1L << k) + 1), m.Parameter(1)))); |
@@ -1965,7 +2027,8 @@ typedef InstructionSelectorTestWithParam<FPCmp> InstructionSelectorFPCmpTest; |
TEST_P(InstructionSelectorFPCmpTest, Parameter) { |
const FPCmp cmp = GetParam(); |
- StreamBuilder m(this, kMachInt32, cmp.mi.machine_type, cmp.mi.machine_type); |
+ StreamBuilder m(this, MachineType::Int32(), cmp.mi.machine_type, |
+ cmp.mi.machine_type); |
m.Return((m.*cmp.mi.constructor)(m.Parameter(0), m.Parameter(1))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -1979,8 +2042,8 @@ TEST_P(InstructionSelectorFPCmpTest, Parameter) { |
TEST_P(InstructionSelectorFPCmpTest, WithImmediateZeroOnRight) { |
const FPCmp cmp = GetParam(); |
- StreamBuilder m(this, kMachInt32, cmp.mi.machine_type); |
- if (cmp.mi.machine_type == kMachFloat64) { |
+ StreamBuilder m(this, MachineType::Int32(), cmp.mi.machine_type); |
+ if (cmp.mi.machine_type == MachineType::Float64()) { |
m.Return((m.*cmp.mi.constructor)(m.Parameter(0), m.Float64Constant(0.0))); |
} else { |
m.Return((m.*cmp.mi.constructor)(m.Parameter(0), m.Float32Constant(0.0f))); |
@@ -1998,8 +2061,8 @@ TEST_P(InstructionSelectorFPCmpTest, WithImmediateZeroOnRight) { |
TEST_P(InstructionSelectorFPCmpTest, WithImmediateZeroOnLeft) { |
const FPCmp cmp = GetParam(); |
- StreamBuilder m(this, kMachInt32, cmp.mi.machine_type); |
- if (cmp.mi.machine_type == kMachFloat64) { |
+ StreamBuilder m(this, MachineType::Int32(), cmp.mi.machine_type); |
+ if (cmp.mi.machine_type == MachineType::Float64()) { |
m.Return((m.*cmp.mi.constructor)(m.Float64Constant(0.0), m.Parameter(0))); |
} else { |
m.Return((m.*cmp.mi.constructor)(m.Float32Constant(0.0f), m.Parameter(0))); |
@@ -2065,52 +2128,52 @@ std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) { |
static const MemoryAccess kMemoryAccesses[] = { |
- {kMachInt8, |
+ {MachineType::Int8(), |
kArm64Ldrsb, |
kArm64Strb, |
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 257, 258, 1000, 1001, 2121, |
2442, 4093, 4094, 4095}}, |
- {kMachUint8, |
+ {MachineType::Uint8(), |
kArm64Ldrb, |
kArm64Strb, |
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 257, 258, 1000, 1001, 2121, |
2442, 4093, 4094, 4095}}, |
- {kMachInt16, |
+ {MachineType::Int16(), |
kArm64Ldrsh, |
kArm64Strh, |
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 258, 260, 4096, 4098, 4100, |
4242, 6786, 8188, 8190}}, |
- {kMachUint16, |
+ {MachineType::Uint16(), |
kArm64Ldrh, |
kArm64Strh, |
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 258, 260, 4096, 4098, 4100, |
4242, 6786, 8188, 8190}}, |
- {kMachInt32, |
+ {MachineType::Int32(), |
kArm64LdrW, |
kArm64StrW, |
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 260, 4096, 4100, 8192, 8196, |
3276, 3280, 16376, 16380}}, |
- {kMachUint32, |
+ {MachineType::Uint32(), |
kArm64LdrW, |
kArm64StrW, |
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 260, 4096, 4100, 8192, 8196, |
3276, 3280, 16376, 16380}}, |
- {kMachInt64, |
+ {MachineType::Int64(), |
kArm64Ldr, |
kArm64Str, |
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 264, 4096, 4104, 8192, 8200, |
16384, 16392, 32752, 32760}}, |
- {kMachUint64, |
+ {MachineType::Uint64(), |
kArm64Ldr, |
kArm64Str, |
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 264, 4096, 4104, 8192, 8200, |
16384, 16392, 32752, 32760}}, |
- {kMachFloat32, |
+ {MachineType::Float32(), |
kArm64LdrS, |
kArm64StrS, |
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 260, 4096, 4100, 8192, 8196, |
3276, 3280, 16376, 16380}}, |
- {kMachFloat64, |
+ {MachineType::Float64(), |
kArm64LdrD, |
kArm64StrD, |
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 264, 4096, 4104, 8192, 8200, |
@@ -2123,7 +2186,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()); |
@@ -2137,7 +2201,7 @@ TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) { |
TEST_P(InstructionSelectorMemoryAccessTest, LoadWithImmediateIndex) { |
const MemoryAccess memacc = GetParam(); |
TRACED_FOREACH(int32_t, index, memacc.immediates) { |
- 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()); |
@@ -2153,7 +2217,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)); |
@@ -2169,7 +2234,8 @@ TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) { |
TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateIndex) { |
const MemoryAccess memacc = GetParam(); |
TRACED_FOREACH(int32_t, index, memacc.immediates) { |
- 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)); |
@@ -2194,8 +2260,10 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, |
// Comparison instructions. |
static const MachInst2 kComparisonInstructions[] = { |
- {&RawMachineAssembler::Word32Equal, "Word32Equal", kArm64Cmp32, kMachInt32}, |
- {&RawMachineAssembler::Word64Equal, "Word64Equal", kArm64Cmp, kMachInt64}, |
+ {&RawMachineAssembler::Word32Equal, "Word32Equal", kArm64Cmp32, |
+ MachineType::Int32()}, |
+ {&RawMachineAssembler::Word64Equal, "Word64Equal", kArm64Cmp, |
+ MachineType::Int64()}, |
}; |
@@ -2260,7 +2328,7 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, |
TEST_F(InstructionSelectorTest, Word32EqualWithZero) { |
{ |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Word32Equal(m.Parameter(0), m.Int32Constant(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -2272,7 +2340,7 @@ TEST_F(InstructionSelectorTest, Word32EqualWithZero) { |
EXPECT_EQ(kEqual, s[0]->flags_condition()); |
} |
{ |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Word32Equal(m.Int32Constant(0), m.Parameter(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -2288,7 +2356,7 @@ TEST_F(InstructionSelectorTest, Word32EqualWithZero) { |
TEST_F(InstructionSelectorTest, Word64EqualWithZero) { |
{ |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
m.Return(m.Word64Equal(m.Parameter(0), m.Int64Constant(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -2300,7 +2368,7 @@ TEST_F(InstructionSelectorTest, Word64EqualWithZero) { |
EXPECT_EQ(kEqual, s[0]->flags_condition()); |
} |
{ |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
m.Return(m.Word64Equal(m.Int64Constant(0), m.Parameter(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -2317,13 +2385,14 @@ TEST_F(InstructionSelectorTest, Word64EqualWithZero) { |
TEST_F(InstructionSelectorTest, Word32EqualWithWord32Shift) { |
TRACED_FOREACH(Shift, shift, kShiftInstructions) { |
// Skip non 32-bit shifts or ror operations. |
- if (shift.mi.machine_type != kMachInt32 || |
+ if (shift.mi.machine_type != MachineType::Int32() || |
shift.mi.arch_opcode == kArm64Ror32) { |
continue; |
} |
TRACED_FORRANGE(int32_t, imm, -32, 63) { |
- 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* r = (m.*shift.mi.constructor)(p1, m.Int32Constant(imm)); |
@@ -2339,7 +2408,8 @@ TEST_F(InstructionSelectorTest, Word32EqualWithWord32Shift) { |
ASSERT_EQ(1U, s[0]->OutputCount()); |
} |
TRACED_FORRANGE(int32_t, imm, -32, 63) { |
- 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* r = (m.*shift.mi.constructor)(p1, m.Int32Constant(imm)); |
@@ -2360,7 +2430,8 @@ TEST_F(InstructionSelectorTest, Word32EqualWithWord32Shift) { |
TEST_F(InstructionSelectorTest, Word32EqualWithUnsignedExtendByte) { |
{ |
- 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* r = m.Word32And(p1, m.Int32Constant(0xff)); |
@@ -2375,7 +2446,8 @@ TEST_F(InstructionSelectorTest, Word32EqualWithUnsignedExtendByte) { |
ASSERT_EQ(1U, s[0]->OutputCount()); |
} |
{ |
- 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* r = m.Word32And(p1, m.Int32Constant(0xff)); |
@@ -2394,7 +2466,8 @@ TEST_F(InstructionSelectorTest, Word32EqualWithUnsignedExtendByte) { |
TEST_F(InstructionSelectorTest, Word32EqualWithUnsignedExtendHalfword) { |
{ |
- 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* r = m.Word32And(p1, m.Int32Constant(0xffff)); |
@@ -2409,7 +2482,8 @@ TEST_F(InstructionSelectorTest, Word32EqualWithUnsignedExtendHalfword) { |
ASSERT_EQ(1U, s[0]->OutputCount()); |
} |
{ |
- 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* r = m.Word32And(p1, m.Int32Constant(0xffff)); |
@@ -2428,7 +2502,8 @@ TEST_F(InstructionSelectorTest, Word32EqualWithUnsignedExtendHalfword) { |
TEST_F(InstructionSelectorTest, Word32EqualWithSignedExtendByte) { |
{ |
- 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* r = |
@@ -2444,7 +2519,8 @@ TEST_F(InstructionSelectorTest, Word32EqualWithSignedExtendByte) { |
ASSERT_EQ(1U, s[0]->OutputCount()); |
} |
{ |
- 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* r = |
@@ -2464,7 +2540,8 @@ TEST_F(InstructionSelectorTest, Word32EqualWithSignedExtendByte) { |
TEST_F(InstructionSelectorTest, Word32EqualWithSignedExtendHalfword) { |
{ |
- 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* r = |
@@ -2480,7 +2557,8 @@ TEST_F(InstructionSelectorTest, Word32EqualWithSignedExtendHalfword) { |
ASSERT_EQ(1U, s[0]->OutputCount()); |
} |
{ |
- 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* r = |
@@ -2500,7 +2578,8 @@ TEST_F(InstructionSelectorTest, Word32EqualWithSignedExtendHalfword) { |
TEST_F(InstructionSelectorTest, Word32EqualZeroWithWord32Equal) { |
{ |
- 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); |
m.Return(m.Word32Equal(m.Word32Equal(p0, p1), m.Int32Constant(0))); |
@@ -2515,7 +2594,8 @@ TEST_F(InstructionSelectorTest, Word32EqualZeroWithWord32Equal) { |
EXPECT_EQ(kNotEqual, s[0]->flags_condition()); |
} |
{ |
- 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); |
m.Return(m.Word32Equal(m.Int32Constant(0), m.Word32Equal(p0, p1))); |
@@ -2547,19 +2627,19 @@ std::ostream& operator<<(std::ostream& os, const IntegerCmp& cmp) { |
// ARM64 32-bit integer comparison instructions. |
const IntegerCmp kIntegerCmpInstructions[] = { |
{{&RawMachineAssembler::Word32Equal, "Word32Equal", kArm64Cmp32, |
- kMachInt32}, |
+ MachineType::Int32()}, |
kEqual}, |
{{&RawMachineAssembler::Int32LessThan, "Int32LessThan", kArm64Cmp32, |
- kMachInt32}, |
+ MachineType::Int32()}, |
kSignedLessThan}, |
{{&RawMachineAssembler::Int32LessThanOrEqual, "Int32LessThanOrEqual", |
- kArm64Cmp32, kMachInt32}, |
+ kArm64Cmp32, MachineType::Int32()}, |
kSignedLessThanOrEqual}, |
{{&RawMachineAssembler::Uint32LessThan, "Uint32LessThan", kArm64Cmp32, |
- kMachUint32}, |
+ MachineType::Uint32()}, |
kUnsignedLessThan}, |
{{&RawMachineAssembler::Uint32LessThanOrEqual, "Uint32LessThanOrEqual", |
- kArm64Cmp32, kMachUint32}, |
+ kArm64Cmp32, MachineType::Uint32()}, |
kUnsignedLessThanOrEqual}}; |
} // namespace |
@@ -2570,13 +2650,14 @@ TEST_F(InstructionSelectorTest, Word32CompareNegateWithWord32Shift) { |
TRACED_FOREACH(Shift, shift, kShiftInstructions) { |
// Test 32-bit operations. Ignore ROR shifts, as compare-negate does not |
// support them. |
- if (shift.mi.machine_type != kMachInt32 || |
+ if (shift.mi.machine_type != MachineType::Int32() || |
shift.mi.arch_opcode == kArm64Ror32) { |
continue; |
} |
TRACED_FORRANGE(int32_t, imm, -32, 63) { |
- 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* r = (m.*shift.mi.constructor)(p1, m.Int32Constant(imm)); |
@@ -2602,12 +2683,18 @@ TEST_F(InstructionSelectorTest, Word32CompareNegateWithWord32Shift) { |
static const MachInst2 kLogicalWithNotRHSs[] = { |
- {&RawMachineAssembler::Word32And, "Word32And", kArm64Bic32, kMachInt32}, |
- {&RawMachineAssembler::Word64And, "Word64And", kArm64Bic, kMachInt64}, |
- {&RawMachineAssembler::Word32Or, "Word32Or", kArm64Orn32, kMachInt32}, |
- {&RawMachineAssembler::Word64Or, "Word64Or", kArm64Orn, kMachInt64}, |
- {&RawMachineAssembler::Word32Xor, "Word32Xor", kArm64Eon32, kMachInt32}, |
- {&RawMachineAssembler::Word64Xor, "Word64Xor", kArm64Eon, kMachInt64}}; |
+ {&RawMachineAssembler::Word32And, "Word32And", kArm64Bic32, |
+ MachineType::Int32()}, |
+ {&RawMachineAssembler::Word64And, "Word64And", kArm64Bic, |
+ MachineType::Int64()}, |
+ {&RawMachineAssembler::Word32Or, "Word32Or", kArm64Orn32, |
+ MachineType::Int32()}, |
+ {&RawMachineAssembler::Word64Or, "Word64Or", kArm64Orn, |
+ MachineType::Int64()}, |
+ {&RawMachineAssembler::Word32Xor, "Word32Xor", kArm64Eon32, |
+ MachineType::Int32()}, |
+ {&RawMachineAssembler::Word64Xor, "Word64Xor", kArm64Eon, |
+ MachineType::Int64()}}; |
typedef InstructionSelectorTestWithParam<MachInst2> |
@@ -2620,11 +2707,11 @@ TEST_P(InstructionSelectorLogicalWithNotRHSTest, Parameter) { |
// Test cases where RHS is Xor(x, -1). |
{ |
StreamBuilder m(this, type, type, type); |
- if (type == kMachInt32) { |
+ if (type == MachineType::Int32()) { |
m.Return((m.*inst.constructor)( |
m.Parameter(0), m.Word32Xor(m.Parameter(1), m.Int32Constant(-1)))); |
} else { |
- ASSERT_EQ(kMachInt64, type); |
+ ASSERT_EQ(MachineType::Int64(), type); |
m.Return((m.*inst.constructor)( |
m.Parameter(0), m.Word64Xor(m.Parameter(1), m.Int64Constant(-1)))); |
} |
@@ -2636,11 +2723,11 @@ TEST_P(InstructionSelectorLogicalWithNotRHSTest, Parameter) { |
} |
{ |
StreamBuilder m(this, type, type, type); |
- if (type == kMachInt32) { |
+ if (type == MachineType::Int32()) { |
m.Return((m.*inst.constructor)( |
m.Word32Xor(m.Parameter(0), m.Int32Constant(-1)), m.Parameter(1))); |
} else { |
- ASSERT_EQ(kMachInt64, type); |
+ ASSERT_EQ(MachineType::Int64(), type); |
m.Return((m.*inst.constructor)( |
m.Word64Xor(m.Parameter(0), m.Int64Constant(-1)), m.Parameter(1))); |
} |
@@ -2653,11 +2740,11 @@ TEST_P(InstructionSelectorLogicalWithNotRHSTest, Parameter) { |
// Test cases where RHS is Not(x). |
{ |
StreamBuilder m(this, type, type, type); |
- if (type == kMachInt32) { |
+ if (type == MachineType::Int32()) { |
m.Return( |
(m.*inst.constructor)(m.Parameter(0), m.Word32Not(m.Parameter(1)))); |
} else { |
- ASSERT_EQ(kMachInt64, type); |
+ ASSERT_EQ(MachineType::Int64(), type); |
m.Return( |
(m.*inst.constructor)(m.Parameter(0), m.Word64Not(m.Parameter(1)))); |
} |
@@ -2669,11 +2756,11 @@ TEST_P(InstructionSelectorLogicalWithNotRHSTest, Parameter) { |
} |
{ |
StreamBuilder m(this, type, type, type); |
- if (type == kMachInt32) { |
+ if (type == MachineType::Int32()) { |
m.Return( |
(m.*inst.constructor)(m.Word32Not(m.Parameter(0)), m.Parameter(1))); |
} else { |
- ASSERT_EQ(kMachInt64, type); |
+ ASSERT_EQ(MachineType::Int64(), type); |
m.Return( |
(m.*inst.constructor)(m.Word64Not(m.Parameter(0)), m.Parameter(1))); |
} |
@@ -2692,7 +2779,7 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, |
TEST_F(InstructionSelectorTest, Word32NotWithParameter) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Word32Not(m.Parameter(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -2703,7 +2790,7 @@ TEST_F(InstructionSelectorTest, Word32NotWithParameter) { |
TEST_F(InstructionSelectorTest, Word64NotWithParameter) { |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
m.Return(m.Word64Not(m.Parameter(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -2715,7 +2802,7 @@ TEST_F(InstructionSelectorTest, Word64NotWithParameter) { |
TEST_F(InstructionSelectorTest, Word32XorMinusOneWithParameter) { |
{ |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Word32Xor(m.Parameter(0), m.Int32Constant(-1))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -2724,7 +2811,7 @@ TEST_F(InstructionSelectorTest, Word32XorMinusOneWithParameter) { |
EXPECT_EQ(1U, s[0]->OutputCount()); |
} |
{ |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Word32Xor(m.Int32Constant(-1), m.Parameter(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -2737,7 +2824,7 @@ TEST_F(InstructionSelectorTest, Word32XorMinusOneWithParameter) { |
TEST_F(InstructionSelectorTest, Word64XorMinusOneWithParameter) { |
{ |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
m.Return(m.Word64Xor(m.Parameter(0), m.Int64Constant(-1))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -2746,7 +2833,7 @@ TEST_F(InstructionSelectorTest, Word64XorMinusOneWithParameter) { |
EXPECT_EQ(1U, s[0]->OutputCount()); |
} |
{ |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
m.Return(m.Word64Xor(m.Int64Constant(-1), m.Parameter(0))); |
Stream s = m.Build(); |
ASSERT_EQ(1U, s.size()); |
@@ -2766,7 +2853,7 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) { |
uint32_t jnk = rng()->NextInt(); |
jnk = (lsb > 0) ? (jnk >> (32 - lsb)) : 0; |
uint32_t msk = ((0xffffffffu >> (32 - width)) << lsb) | jnk; |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Word32Shr(m.Word32And(m.Parameter(0), m.Int32Constant(msk)), |
m.Int32Constant(shift))); |
Stream s = m.Build(); |
@@ -2783,7 +2870,7 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) { |
uint32_t jnk = rng()->NextInt(); |
jnk = (lsb > 0) ? (jnk >> (32 - lsb)) : 0; |
uint32_t msk = ((0xffffffffu >> (32 - width)) << lsb) | jnk; |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Word32Shr(m.Word32And(m.Int32Constant(msk), m.Parameter(0)), |
m.Int32Constant(shift))); |
Stream s = m.Build(); |
@@ -2807,7 +2894,7 @@ TEST_F(InstructionSelectorTest, Word64ShrWithWord64AndWithImmediate) { |
jnk = (lsb > 0) ? (jnk >> (64 - lsb)) : 0; |
uint64_t msk = |
((V8_UINT64_C(0xffffffffffffffff) >> (64 - width)) << lsb) | jnk; |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
m.Return(m.Word64Shr(m.Word64And(m.Parameter(0), m.Int64Constant(msk)), |
m.Int64Constant(shift))); |
Stream s = m.Build(); |
@@ -2825,7 +2912,7 @@ TEST_F(InstructionSelectorTest, Word64ShrWithWord64AndWithImmediate) { |
jnk = (lsb > 0) ? (jnk >> (64 - lsb)) : 0; |
uint64_t msk = |
((V8_UINT64_C(0xffffffffffffffff) >> (64 - width)) << lsb) | jnk; |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
m.Return(m.Word64Shr(m.Word64And(m.Int64Constant(msk), m.Parameter(0)), |
m.Int64Constant(shift))); |
Stream s = m.Build(); |
@@ -2846,7 +2933,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) { |
int32_t lsb = shift & 0x1f; |
TRACED_FORRANGE(int32_t, width, 1, 31) { |
uint32_t msk = (1 << width) - 1; |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return(m.Word32And(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)), |
m.Int32Constant(msk))); |
Stream s = m.Build(); |
@@ -2862,7 +2949,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) { |
int32_t lsb = shift & 0x1f; |
TRACED_FORRANGE(int32_t, width, 1, 31) { |
uint32_t msk = (1 << width) - 1; |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
m.Return( |
m.Word32And(m.Int32Constant(msk), |
m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)))); |
@@ -2885,7 +2972,7 @@ TEST_F(InstructionSelectorTest, Word64AndWithImmediateWithWord64Shr) { |
int64_t lsb = shift & 0x3f; |
TRACED_FORRANGE(int64_t, width, 1, 63) { |
uint64_t msk = (V8_UINT64_C(1) << width) - 1; |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
m.Return(m.Word64And(m.Word64Shr(m.Parameter(0), m.Int64Constant(shift)), |
m.Int64Constant(msk))); |
Stream s = m.Build(); |
@@ -2901,7 +2988,7 @@ TEST_F(InstructionSelectorTest, Word64AndWithImmediateWithWord64Shr) { |
int64_t lsb = shift & 0x3f; |
TRACED_FORRANGE(int64_t, width, 1, 63) { |
uint64_t msk = (V8_UINT64_C(1) << width) - 1; |
- StreamBuilder m(this, kMachInt64, kMachInt64); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); |
m.Return( |
m.Word64And(m.Int64Constant(msk), |
m.Word64Shr(m.Parameter(0), m.Int64Constant(shift)))); |
@@ -2918,7 +3005,8 @@ TEST_F(InstructionSelectorTest, Word64AndWithImmediateWithWord64Shr) { |
TEST_F(InstructionSelectorTest, Int32MulHighWithParameters) { |
- 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); |
@@ -2941,7 +3029,8 @@ TEST_F(InstructionSelectorTest, Int32MulHighWithParameters) { |
TEST_F(InstructionSelectorTest, Int32MulHighWithSar) { |
TRACED_FORRANGE(int32_t, shift, -32, 63) { |
- 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.Word32Sar(m.Int32MulHigh(p0, p1), m.Int32Constant(shift)); |
@@ -2964,7 +3053,8 @@ TEST_F(InstructionSelectorTest, Int32MulHighWithSar) { |
TEST_F(InstructionSelectorTest, Int32MulHighWithAdd) { |
- 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 a = m.Int32Add(m.Int32MulHigh(p0, p1), p0); |
@@ -2997,7 +3087,8 @@ TEST_F(InstructionSelectorTest, Int32MulHighWithAdd) { |
TEST_F(InstructionSelectorTest, Uint32MulHighWithShr) { |
TRACED_FORRANGE(int32_t, shift, -32, 63) { |
- 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 = |
@@ -3022,7 +3113,7 @@ TEST_F(InstructionSelectorTest, Uint32MulHighWithShr) { |
TEST_F(InstructionSelectorTest, Word32SarWithWord32Shl) { |
TRACED_FORRANGE(int32_t, shift, 1, 31) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
Node* const p0 = m.Parameter(0); |
Node* const r = m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(shift)), |
m.Int32Constant(shift)); |
@@ -3036,7 +3127,7 @@ TEST_F(InstructionSelectorTest, Word32SarWithWord32Shl) { |
EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output())); |
} |
TRACED_FORRANGE(int32_t, shift, 1, 31) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
Node* const p0 = m.Parameter(0); |
Node* const r = m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(shift + 32)), |
m.Int32Constant(shift + 64)); |
@@ -3054,7 +3145,7 @@ TEST_F(InstructionSelectorTest, Word32SarWithWord32Shl) { |
TEST_F(InstructionSelectorTest, Word32ShrWithWord32Shl) { |
TRACED_FORRANGE(int32_t, shift, 1, 31) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
Node* const p0 = m.Parameter(0); |
Node* const r = m.Word32Shr(m.Word32Shl(p0, m.Int32Constant(shift)), |
m.Int32Constant(shift)); |
@@ -3068,7 +3159,7 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32Shl) { |
EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output())); |
} |
TRACED_FORRANGE(int32_t, shift, 1, 31) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
Node* const p0 = m.Parameter(0); |
Node* const r = m.Word32Shr(m.Word32Shl(p0, m.Int32Constant(shift + 32)), |
m.Int32Constant(shift + 64)); |
@@ -3086,7 +3177,7 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32Shl) { |
TEST_F(InstructionSelectorTest, Word32ShlWithWord32And) { |
TRACED_FORRANGE(int32_t, shift, 1, 30) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
Node* const p0 = m.Parameter(0); |
Node* const r = |
m.Word32Shl(m.Word32And(p0, m.Int32Constant((1 << (31 - shift)) - 1)), |
@@ -3101,7 +3192,7 @@ TEST_F(InstructionSelectorTest, Word32ShlWithWord32And) { |
EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output())); |
} |
TRACED_FORRANGE(int32_t, shift, 0, 30) { |
- StreamBuilder m(this, kMachInt32, kMachInt32); |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
Node* const p0 = m.Parameter(0); |
Node* const r = |
m.Word32Shl(m.Word32And(p0, m.Int32Constant((1 << (31 - shift)) - 1)), |
@@ -3119,7 +3210,7 @@ TEST_F(InstructionSelectorTest, Word32ShlWithWord32And) { |
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); |
@@ -3134,7 +3225,7 @@ TEST_F(InstructionSelectorTest, Word32Clz) { |
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); |
@@ -3149,7 +3240,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); |
@@ -3164,7 +3255,7 @@ TEST_F(InstructionSelectorTest, Float64Abs) { |
TEST_F(InstructionSelectorTest, Float64SubWithMinusZero) { |
- 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); |
@@ -3179,7 +3270,8 @@ TEST_F(InstructionSelectorTest, Float64SubWithMinusZero) { |
TEST_F(InstructionSelectorTest, Float32Max) { |
- StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32); |
+ StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(), |
+ MachineType::Float32()); |
Node* const p0 = m.Parameter(0); |
Node* const p1 = m.Parameter(1); |
Node* const n = m.Float32Max(p0, p1); |
@@ -3197,7 +3289,8 @@ TEST_F(InstructionSelectorTest, Float32Max) { |
TEST_F(InstructionSelectorTest, Float32Min) { |
- StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32); |
+ StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(), |
+ MachineType::Float32()); |
Node* const p0 = m.Parameter(0); |
Node* const p1 = m.Parameter(1); |
Node* const n = m.Float32Min(p0, p1); |
@@ -3215,7 +3308,8 @@ TEST_F(InstructionSelectorTest, Float32Min) { |
TEST_F(InstructionSelectorTest, Float64Max) { |
- StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64); |
+ StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(), |
+ MachineType::Float64()); |
Node* const p0 = m.Parameter(0); |
Node* const p1 = m.Parameter(1); |
Node* const n = m.Float64Max(p0, p1); |
@@ -3233,7 +3327,8 @@ TEST_F(InstructionSelectorTest, Float64Max) { |
TEST_F(InstructionSelectorTest, Float64Min) { |
- StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64); |
+ StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(), |
+ MachineType::Float64()); |
Node* const p0 = m.Parameter(0); |
Node* const p1 = m.Parameter(1); |
Node* const n = m.Float64Min(p0, p1); |