Commit ee7f97c8 authored by titzer@chromium.org's avatar titzer@chromium.org

TF: Rename ConvertXToY machine operators to ChangeXToY.

R=bmeurer@chromium.org
BUG=

Review URL: https://codereview.chromium.org/435923002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22788 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 204f1ce8
......@@ -705,28 +705,28 @@ void InstructionSelector::VisitInt32UMod(Node* node) {
}
void InstructionSelector::VisitConvertInt32ToFloat64(Node* node) {
void InstructionSelector::VisitChangeInt32ToFloat64(Node* node) {
ArmOperandGenerator g(this);
Emit(kArmVcvtF64S32, g.DefineAsDoubleRegister(node),
g.UseRegister(node->InputAt(0)));
}
void InstructionSelector::VisitConvertUint32ToFloat64(Node* node) {
void InstructionSelector::VisitChangeUint32ToFloat64(Node* node) {
ArmOperandGenerator g(this);
Emit(kArmVcvtF64U32, g.DefineAsDoubleRegister(node),
g.UseRegister(node->InputAt(0)));
}
void InstructionSelector::VisitConvertFloat64ToInt32(Node* node) {
void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) {
ArmOperandGenerator g(this);
Emit(kArmVcvtS32F64, g.DefineAsRegister(node),
g.UseDoubleRegister(node->InputAt(0)));
}
void InstructionSelector::VisitConvertFloat64ToUint32(Node* node) {
void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) {
ArmOperandGenerator g(this);
Emit(kArmVcvtU32F64, g.DefineAsRegister(node),
g.UseDoubleRegister(node->InputAt(0)));
......
......@@ -426,28 +426,28 @@ void InstructionSelector::VisitConvertInt64ToInt32(Node* node) {
}
void InstructionSelector::VisitConvertInt32ToFloat64(Node* node) {
void InstructionSelector::VisitChangeInt32ToFloat64(Node* node) {
Arm64OperandGenerator g(this);
Emit(kArm64Int32ToFloat64, g.DefineAsDoubleRegister(node),
g.UseRegister(node->InputAt(0)));
}
void InstructionSelector::VisitConvertUint32ToFloat64(Node* node) {
void InstructionSelector::VisitChangeUint32ToFloat64(Node* node) {
Arm64OperandGenerator g(this);
Emit(kArm64Uint32ToFloat64, g.DefineAsDoubleRegister(node),
g.UseRegister(node->InputAt(0)));
}
void InstructionSelector::VisitConvertFloat64ToInt32(Node* node) {
void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) {
Arm64OperandGenerator g(this);
Emit(kArm64Float64ToInt32, g.DefineAsRegister(node),
g.UseDoubleRegister(node->InputAt(0)));
}
void InstructionSelector::VisitConvertFloat64ToUint32(Node* node) {
void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) {
Arm64OperandGenerator g(this);
Emit(kArm64Float64ToUint32, g.DefineAsRegister(node),
g.UseDoubleRegister(node->InputAt(0)));
......
......@@ -363,14 +363,14 @@ void InstructionSelector::VisitInt32UMod(Node* node) {
}
void InstructionSelector::VisitConvertInt32ToFloat64(Node* node) {
void InstructionSelector::VisitChangeInt32ToFloat64(Node* node) {
IA32OperandGenerator g(this);
Emit(kSSEInt32ToFloat64, g.DefineAsDoubleRegister(node),
g.Use(node->InputAt(0)));
}
void InstructionSelector::VisitConvertUint32ToFloat64(Node* node) {
void InstructionSelector::VisitChangeUint32ToFloat64(Node* node) {
IA32OperandGenerator g(this);
// TODO(turbofan): IA32 SSE LoadUint32() should take an operand.
Emit(kSSEUint32ToFloat64, g.DefineAsDoubleRegister(node),
......@@ -378,13 +378,13 @@ void InstructionSelector::VisitConvertUint32ToFloat64(Node* node) {
}
void InstructionSelector::VisitConvertFloat64ToInt32(Node* node) {
void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) {
IA32OperandGenerator g(this);
Emit(kSSEFloat64ToInt32, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
}
void InstructionSelector::VisitConvertFloat64ToUint32(Node* node) {
void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) {
IA32OperandGenerator g(this);
// TODO(turbofan): IA32 SSE subsd() should take an operand.
Emit(kSSEFloat64ToUint32, g.DefineAsRegister(node),
......
......@@ -551,14 +551,14 @@ void InstructionSelector::VisitNode(Node* node) {
return VisitConvertInt32ToInt64(node);
case IrOpcode::kConvertInt64ToInt32:
return VisitConvertInt64ToInt32(node);
case IrOpcode::kConvertInt32ToFloat64:
return MarkAsDouble(node), VisitConvertInt32ToFloat64(node);
case IrOpcode::kConvertUint32ToFloat64:
return MarkAsDouble(node), VisitConvertUint32ToFloat64(node);
case IrOpcode::kConvertFloat64ToInt32:
return VisitConvertFloat64ToInt32(node);
case IrOpcode::kConvertFloat64ToUint32:
return VisitConvertFloat64ToUint32(node);
case IrOpcode::kChangeInt32ToFloat64:
return MarkAsDouble(node), VisitChangeInt32ToFloat64(node);
case IrOpcode::kChangeUint32ToFloat64:
return MarkAsDouble(node), VisitChangeUint32ToFloat64(node);
case IrOpcode::kChangeFloat64ToInt32:
return VisitChangeFloat64ToInt32(node);
case IrOpcode::kChangeFloat64ToUint32:
return VisitChangeFloat64ToUint32(node);
case IrOpcode::kFloat64Add:
return MarkAsDouble(node), VisitFloat64Add(node);
case IrOpcode::kFloat64Sub:
......
......@@ -335,17 +335,17 @@ class MachineNodeFactory {
Node* ConvertInt64ToInt32(Node* a) {
return NEW_NODE_1(MACHINE()->ConvertInt64ToInt32(), a);
}
Node* ConvertInt32ToFloat64(Node* a) {
return NEW_NODE_1(MACHINE()->ConvertInt32ToFloat64(), a);
Node* ChangeInt32ToFloat64(Node* a) {
return NEW_NODE_1(MACHINE()->ChangeInt32ToFloat64(), a);
}
Node* ConvertUint32ToFloat64(Node* a) {
return NEW_NODE_1(MACHINE()->ConvertUint32ToFloat64(), a);
Node* ChangeUint32ToFloat64(Node* a) {
return NEW_NODE_1(MACHINE()->ChangeUint32ToFloat64(), a);
}
Node* ConvertFloat64ToInt32(Node* a) {
return NEW_NODE_1(MACHINE()->ConvertFloat64ToInt32(), a);
Node* ChangeFloat64ToInt32(Node* a) {
return NEW_NODE_1(MACHINE()->ChangeFloat64ToInt32(), a);
}
Node* ConvertFloat64ToUint32(Node* a) {
return NEW_NODE_1(MACHINE()->ConvertFloat64ToUint32(), a);
Node* ChangeFloat64ToUint32(Node* a) {
return NEW_NODE_1(MACHINE()->ChangeFloat64ToUint32(), a);
}
#ifdef MACHINE_ASSEMBLER_SUPPORTS_CALL_C
......
......@@ -147,10 +147,10 @@ class MachineOperatorBuilder {
// defined for these operators, since they are intended only for use with
// integers.
// TODO(titzer): rename ConvertXXX to ChangeXXX in machine operators.
Operator* ConvertInt32ToFloat64() { UNOP(ConvertInt32ToFloat64); }
Operator* ConvertUint32ToFloat64() { UNOP(ConvertUint32ToFloat64); }
Operator* ConvertFloat64ToInt32() { UNOP(ConvertFloat64ToInt32); }
Operator* ConvertFloat64ToUint32() { UNOP(ConvertFloat64ToUint32); }
Operator* ChangeInt32ToFloat64() { UNOP(ChangeInt32ToFloat64); }
Operator* ChangeUint32ToFloat64() { UNOP(ChangeUint32ToFloat64); }
Operator* ChangeFloat64ToInt32() { UNOP(ChangeFloat64ToInt32); }
Operator* ChangeFloat64ToUint32() { UNOP(ChangeFloat64ToUint32); }
// Floating point operators always operate with IEEE 754 round-to-nearest.
Operator* Float64Add() { BINOP_C(Float64Add); }
......
......@@ -155,57 +155,57 @@
V(StoreElement)
// Opcodes for Machine-level operators.
#define MACHINE_OP_LIST(V) \
V(Load) \
V(Store) \
V(Word32And) \
V(Word32Or) \
V(Word32Xor) \
V(Word32Shl) \
V(Word32Shr) \
V(Word32Sar) \
V(Word32Equal) \
V(Word64And) \
V(Word64Or) \
V(Word64Xor) \
V(Word64Shl) \
V(Word64Shr) \
V(Word64Sar) \
V(Word64Equal) \
V(Int32Add) \
V(Int32AddWithOverflow) \
V(Int32Sub) \
V(Int32Mul) \
V(Int32Div) \
V(Int32UDiv) \
V(Int32Mod) \
V(Int32UMod) \
V(Int32LessThan) \
V(Int32LessThanOrEqual) \
V(Uint32LessThan) \
V(Uint32LessThanOrEqual) \
V(Int64Add) \
V(Int64Sub) \
V(Int64Mul) \
V(Int64Div) \
V(Int64UDiv) \
V(Int64Mod) \
V(Int64UMod) \
V(Int64LessThan) \
V(Int64LessThanOrEqual) \
V(ConvertInt64ToInt32) \
V(ConvertInt32ToInt64) \
V(ConvertInt32ToFloat64) \
V(ConvertUint32ToFloat64) \
V(ConvertFloat64ToInt32) \
V(ConvertFloat64ToUint32) \
V(Float64Add) \
V(Float64Sub) \
V(Float64Mul) \
V(Float64Div) \
V(Float64Mod) \
V(Float64Equal) \
V(Float64LessThan) \
#define MACHINE_OP_LIST(V) \
V(Load) \
V(Store) \
V(Word32And) \
V(Word32Or) \
V(Word32Xor) \
V(Word32Shl) \
V(Word32Shr) \
V(Word32Sar) \
V(Word32Equal) \
V(Word64And) \
V(Word64Or) \
V(Word64Xor) \
V(Word64Shl) \
V(Word64Shr) \
V(Word64Sar) \
V(Word64Equal) \
V(Int32Add) \
V(Int32AddWithOverflow) \
V(Int32Sub) \
V(Int32Mul) \
V(Int32Div) \
V(Int32UDiv) \
V(Int32Mod) \
V(Int32UMod) \
V(Int32LessThan) \
V(Int32LessThanOrEqual) \
V(Uint32LessThan) \
V(Uint32LessThanOrEqual) \
V(Int64Add) \
V(Int64Sub) \
V(Int64Mul) \
V(Int64Div) \
V(Int64UDiv) \
V(Int64Mod) \
V(Int64UMod) \
V(Int64LessThan) \
V(Int64LessThanOrEqual) \
V(ConvertInt64ToInt32) \
V(ConvertInt32ToInt64) \
V(ChangeInt32ToFloat64) \
V(ChangeUint32ToFloat64) \
V(ChangeFloat64ToInt32) \
V(ChangeFloat64ToUint32) \
V(Float64Add) \
V(Float64Sub) \
V(Float64Mul) \
V(Float64Div) \
V(Float64Mod) \
V(Float64Equal) \
V(Float64LessThan) \
V(Float64LessThanOrEqual)
#define VALUE_OP_LIST(V) \
......
......@@ -150,9 +150,9 @@ class RepresentationChanger {
Operator* op;
if (output_type & rWord32) {
if (output_type & tUint32) {
op = machine()->ConvertUint32ToFloat64();
op = machine()->ChangeUint32ToFloat64();
} else if (output_type & tInt32) {
op = machine()->ConvertInt32ToFloat64();
op = machine()->ChangeInt32ToFloat64();
} else {
return TypeError(node, output_type, rFloat64);
}
......@@ -188,12 +188,10 @@ class RepresentationChanger {
// Select the correct X -> Word32 operator.
Operator* op = NULL;
if (output_type & rFloat64) {
// TODO(turbofan): could have cheaper float64 conversions that don't do
// the full JavaScript truncation here.
if (output_type & tUint32) {
op = machine()->ConvertFloat64ToUint32();
op = machine()->ChangeFloat64ToUint32();
} else if (output_type & tInt32) {
op = machine()->ConvertFloat64ToInt32();
op = machine()->ChangeFloat64ToInt32();
} else {
return TypeError(node, output_type, rWord32);
}
......
......@@ -66,8 +66,8 @@ void SimplifiedLowering::DoChangeTaggedToUI32(Node* node, Node* effect,
Node* loaded = graph()->NewNode(
machine()->Load(kMachineFloat64), val,
OffsetMinusTagConstant(HeapNumber::kValueOffset), effect);
Operator* op = is_signed ? machine()->ConvertFloat64ToInt32()
: machine()->ConvertFloat64ToUint32();
Operator* op = is_signed ? machine()->ChangeFloat64ToInt32()
: machine()->ChangeFloat64ToUint32();
Node* converted = graph()->NewNode(op, loaded);
// false branch.
......@@ -100,7 +100,7 @@ void SimplifiedLowering::DoChangeTaggedToFloat64(Node* node, Node* effect,
Node* fbranch = graph()->NewNode(common()->IfFalse(), branch);
Node* untagged = Untag(val);
Node* converted =
graph()->NewNode(machine()->ConvertInt32ToFloat64(), untagged);
graph()->NewNode(machine()->ChangeInt32ToFloat64(), untagged);
// merge.
Node* merge = graph()->NewNode(common()->Merge(2), tbranch, fbranch);
......
......@@ -493,14 +493,14 @@ void InstructionSelector::VisitInt64UMod(Node* node) {
}
void InstructionSelector::VisitConvertInt32ToFloat64(Node* node) {
void InstructionSelector::VisitChangeInt32ToFloat64(Node* node) {
X64OperandGenerator g(this);
Emit(kSSEInt32ToFloat64, g.DefineAsDoubleRegister(node),
g.Use(node->InputAt(0)));
}
void InstructionSelector::VisitConvertUint32ToFloat64(Node* node) {
void InstructionSelector::VisitChangeUint32ToFloat64(Node* node) {
X64OperandGenerator g(this);
// TODO(turbofan): X64 SSE cvtqsi2sd should support operands.
Emit(kSSEUint32ToFloat64, g.DefineAsDoubleRegister(node),
......@@ -508,13 +508,13 @@ void InstructionSelector::VisitConvertUint32ToFloat64(Node* node) {
}
void InstructionSelector::VisitConvertFloat64ToInt32(Node* node) {
void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) {
X64OperandGenerator g(this);
Emit(kSSEFloat64ToInt32, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
}
void InstructionSelector::VisitConvertFloat64ToUint32(Node* node) {
void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) {
X64OperandGenerator g(this);
// TODO(turbofan): X64 SSE cvttsd2siq should support operands.
Emit(kSSEFloat64ToUint32, g.DefineAsRegister(node),
......
......@@ -771,6 +771,6 @@ TEST(ReduceFloat64Mod) {
// TODO(titzer): test MachineOperatorReducer for Int64Mod
// TODO(titzer): test MachineOperatorReducer for Int64UMod
// TODO(titzer): test MachineOperatorReducer for Int64Neg
// TODO(titzer): test MachineOperatorReducer for ConvertInt32ToFloat64
// TODO(titzer): test MachineOperatorReducer for ConvertFloat64ToInt32
// TODO(titzer): test MachineOperatorReducer for ChangeInt32ToFloat64
// TODO(titzer): test MachineOperatorReducer for ChangeFloat64ToInt32
// TODO(titzer): test MachineOperatorReducer for Float64Compare
......@@ -180,10 +180,10 @@ TEST(SingleChanges) {
CheckChange(IrOpcode::kChangeTaggedToFloat64, rTagged, rFloat64);
// Int32,Uint32 <-> Float64 are actually machine conversions.
CheckChange(IrOpcode::kConvertInt32ToFloat64, rWord32 | tInt32, rFloat64);
CheckChange(IrOpcode::kConvertUint32ToFloat64, rWord32 | tUint32, rFloat64);
CheckChange(IrOpcode::kConvertFloat64ToInt32, rFloat64 | tInt32, rWord32);
CheckChange(IrOpcode::kConvertFloat64ToUint32, rFloat64 | tUint32, rWord32);
CheckChange(IrOpcode::kChangeInt32ToFloat64, rWord32 | tInt32, rFloat64);
CheckChange(IrOpcode::kChangeUint32ToFloat64, rWord32 | tUint32, rFloat64);
CheckChange(IrOpcode::kChangeFloat64ToInt32, rFloat64 | tInt32, rWord32);
CheckChange(IrOpcode::kChangeFloat64ToUint32, rFloat64 | tUint32, rWord32);
}
......@@ -200,8 +200,8 @@ TEST(SignednessInWord32) {
// CheckChange(IrOpcode::kChangeTaggedToInt32, rTagged, rWord32 | tInt32);
// CheckChange(IrOpcode::kChangeTaggedToUint32, rTagged, rWord32 | tUint32);
// CheckChange(IrOpcode::kConvertInt32ToFloat64, rWord32, rFloat64);
// CheckChange(IrOpcode::kConvertFloat64ToInt32, rFloat64, rWord32);
// CheckChange(IrOpcode::kChangeInt32ToFloat64, rWord32, rFloat64);
// CheckChange(IrOpcode::kChangeFloat64ToInt32, rFloat64, rWord32);
}
......
......@@ -482,7 +482,7 @@ TEST(RunLoopIncrementFloat64) {
m.Goto(&header);
m.Bind(end);
m.Return(m.ConvertFloat64ToInt32(phi));
m.Return(m.ChangeFloat64ToInt32(phi));
CHECK_EQ(10, m.Call());
}
......@@ -2858,12 +2858,12 @@ TEST(RunFloat64ModP) {
}
TEST(RunConvertInt32ToFloat64_A) {
TEST(RunChangeInt32ToFloat64_A) {
RawMachineAssemblerTester<int32_t> m;
int32_t magic = 0x986234;
double result = 0;
Node* convert = m.ConvertInt32ToFloat64(m.Int32Constant(magic));
Node* convert = m.ChangeInt32ToFloat64(m.Int32Constant(magic));
m.Store(kMachineFloat64, m.PointerConstant(&result), m.Int32Constant(0),
convert);
m.Return(m.Int32Constant(magic));
......@@ -2873,11 +2873,11 @@ TEST(RunConvertInt32ToFloat64_A) {
}
TEST(RunConvertInt32ToFloat64_B) {
TEST(RunChangeInt32ToFloat64_B) {
RawMachineAssemblerTester<int32_t> m(kMachineWord32);
double output = 0;
Node* convert = m.ConvertInt32ToFloat64(m.Parameter(0));
Node* convert = m.ChangeInt32ToFloat64(m.Parameter(0));
m.Store(kMachineFloat64, m.PointerConstant(&output), m.Int32Constant(0),
convert);
m.Return(m.Parameter(0));
......@@ -2890,11 +2890,11 @@ TEST(RunConvertInt32ToFloat64_B) {
}
TEST(RunConvertUint32ToFloat64_B) {
TEST(RunChangeUint32ToFloat64_B) {
RawMachineAssemblerTester<int32_t> m(kMachineWord32);
double output = 0;
Node* convert = m.ConvertUint32ToFloat64(m.Parameter(0));
Node* convert = m.ChangeUint32ToFloat64(m.Parameter(0));
m.Store(kMachineFloat64, m.PointerConstant(&output), m.Int32Constant(0),
convert);
m.Return(m.Parameter(0));
......@@ -2907,14 +2907,14 @@ TEST(RunConvertUint32ToFloat64_B) {
}
TEST(RunConvertFloat64ToInt32_A) {
TEST(RunChangeFloat64ToInt32_A) {
RawMachineAssemblerTester<int32_t> m;
int32_t magic = 0x786234;
double input = 11.1;
int32_t result = 0;
m.Store(kMachineWord32, m.PointerConstant(&result), m.Int32Constant(0),
m.ConvertFloat64ToInt32(m.Float64Constant(input)));
m.ChangeFloat64ToInt32(m.Float64Constant(input)));
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
......@@ -2922,14 +2922,14 @@ TEST(RunConvertFloat64ToInt32_A) {
}
TEST(RunConvertFloat64ToInt32_B) {
TEST(RunChangeFloat64ToInt32_B) {
RawMachineAssemblerTester<int32_t> m;
double input = 0;
int32_t output = 0;
Node* load =
m.Load(kMachineFloat64, m.PointerConstant(&input), m.Int32Constant(0));
Node* convert = m.ConvertFloat64ToInt32(load);
Node* convert = m.ChangeFloat64ToInt32(load);
m.Store(kMachineWord32, m.PointerConstant(&output), m.Int32Constant(0),
convert);
m.Return(convert);
......@@ -2964,14 +2964,14 @@ TEST(RunConvertFloat64ToInt32_B) {
}
TEST(RunConvertFloat64ToUint32_B) {
TEST(RunChangeFloat64ToUint32_B) {
RawMachineAssemblerTester<int32_t> m;
double input = 0;
int32_t output = 0;
Node* load =
m.Load(kMachineFloat64, m.PointerConstant(&input), m.Int32Constant(0));
Node* convert = m.ConvertFloat64ToUint32(load);
Node* convert = m.ChangeFloat64ToUint32(load);
m.Store(kMachineWord32, m.PointerConstant(&output), m.Int32Constant(0),
convert);
m.Return(convert);
......@@ -3007,7 +3007,7 @@ TEST(RunConvertFloat64ToUint32_B) {
}
TEST(RunConvertFloat64ToInt32_spilled) {
TEST(RunChangeFloat64ToInt32_spilled) {
RawMachineAssemblerTester<int32_t> m;
const int kNumInputs = 32;
int32_t magic = 0x786234;
......@@ -3022,7 +3022,7 @@ TEST(RunConvertFloat64ToInt32_spilled) {
for (int i = 0; i < kNumInputs; i++) {
m.Store(kMachineWord32, m.PointerConstant(&result), m.Int32Constant(i * 4),
m.ConvertFloat64ToInt32(input_node[i]));
m.ChangeFloat64ToInt32(input_node[i]));
}
m.Return(m.Int32Constant(magic));
......@@ -3039,19 +3039,19 @@ TEST(RunConvertFloat64ToInt32_spilled) {
}
TEST(RunDeadConvertFloat64ToInt32) {
TEST(RunDeadChangeFloat64ToInt32) {
RawMachineAssemblerTester<int32_t> m;
const int magic = 0x88abcda4;
m.ConvertFloat64ToInt32(m.Float64Constant(999.78));
m.ChangeFloat64ToInt32(m.Float64Constant(999.78));
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
}
TEST(RunDeadConvertInt32ToFloat64) {
TEST(RunDeadChangeInt32ToFloat64) {
RawMachineAssemblerTester<int32_t> m;
const int magic = 0x8834abcd;
m.ConvertInt32ToFloat64(m.Int32Constant(magic - 6888));
m.ChangeInt32ToFloat64(m.Int32Constant(magic - 6888));
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
}
......
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