Index: src/compiler/ia32/instruction-scheduler-ia32.cc |
diff --git a/src/compiler/ia32/instruction-scheduler-ia32.cc b/src/compiler/ia32/instruction-scheduler-ia32.cc |
index ad7535c7c7a9bba52b754d7c6a810aec7eb2ba35..3216b1de0bf657e66bf56f67f2be8a5f35a51dcb 100644 |
--- a/src/compiler/ia32/instruction-scheduler-ia32.cc |
+++ b/src/compiler/ia32/instruction-scheduler-ia32.cc |
@@ -146,8 +146,72 @@ int InstructionScheduler::GetTargetInstructionFlags( |
int InstructionScheduler::GetInstructionLatency(const Instruction* instr) { |
- // TODO(all): Add instruction cost modeling. |
- return 1; |
+ // Basic latency modeling for ia32 instructions. They have been determined |
+ // in an empirical way. |
+ switch (instr->arch_opcode()) { |
+ case kCheckedLoadInt8: |
+ case kCheckedLoadUint8: |
+ case kCheckedLoadInt16: |
+ case kCheckedLoadUint16: |
+ case kCheckedLoadWord32: |
+ case kCheckedLoadFloat32: |
+ case kCheckedLoadFloat64: |
+ case kCheckedStoreWord8: |
+ case kCheckedStoreWord16: |
+ case kCheckedStoreWord32: |
+ case kCheckedStoreFloat32: |
+ case kCheckedStoreFloat64: |
+ case kSSEFloat64Mul: |
+ return 5; |
+ case kIA32Imul: |
+ case kIA32ImulHigh: |
+ return 5; |
+ case kSSEFloat32Cmp: |
+ case kSSEFloat64Cmp: |
+ return 9; |
+ case kSSEFloat32Add: |
+ case kSSEFloat32Sub: |
+ case kSSEFloat32Abs: |
+ case kSSEFloat32Neg: |
+ case kSSEFloat64Add: |
+ case kSSEFloat64Sub: |
+ case kSSEFloat64Max: |
+ case kSSEFloat64Min: |
+ case kSSEFloat64Abs: |
+ case kSSEFloat64Neg: |
+ return 5; |
+ case kSSEFloat32Mul: |
+ return 4; |
+ case kSSEFloat32ToFloat64: |
+ case kSSEFloat64ToFloat32: |
+ return 6; |
+ case kSSEFloat32Round: |
+ case kSSEFloat64Round: |
+ case kSSEFloat32ToInt32: |
+ case kSSEFloat64ToInt32: |
+ return 8; |
+ case kSSEFloat32ToUint32: |
+ return 21; |
+ case kSSEFloat64ToUint32: |
+ return 15; |
+ case kIA32Idiv: |
+ return 33; |
+ case kIA32Udiv: |
+ return 26; |
+ case kSSEFloat32Div: |
+ return 35; |
+ case kSSEFloat64Div: |
+ return 63; |
+ case kSSEFloat32Sqrt: |
+ case kSSEFloat64Sqrt: |
+ return 25; |
+ case kSSEFloat64Mod: |
+ return 50; |
+ case kArchTruncateDoubleToI: |
+ return 9; |
+ default: |
+ return 1; |
+ } |
} |
} // namespace compiler |