From e09206d4d7683e2a421104c5cb83f7808ba4b06e Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Fri, 29 Oct 2010 23:16:55 +0000 Subject: [PATCH] Fix fpscr <-> GPR latency info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117737 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMBaseInstrInfo.cpp | 11 +++++++++-- lib/Target/ARM/ARMScheduleA8.td | 2 +- lib/Target/ARM/ARMScheduleA9.td | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/Target/ARM/ARMBaseInstrInfo.cpp b/lib/Target/ARM/ARMBaseInstrInfo.cpp index c23bc93925b..d4b832e7bc6 100644 --- a/lib/Target/ARM/ARMBaseInstrInfo.cpp +++ b/lib/Target/ARM/ARMBaseInstrInfo.cpp @@ -1914,9 +1914,16 @@ ARMBaseInstrInfo::getOperandLatency(const InstrItineraryData *ItinData, const TargetInstrDesc &UseTID = UseMI->getDesc(); const MachineOperand &DefMO = DefMI->getOperand(DefIdx); - if (DefMO.getReg() == ARM::CPSR && UseTID.isBranch()) + if (DefMO.getReg() == ARM::CPSR) { + if (DefMI->getOpcode() == ARM::FMSTAT) { + // fpscr -> cpsr stalls over 20 cycles on A8 (and earlier?) + return Subtarget.isCortexA9() ? 1 : 20; + } + // CPSR set and branch can be paired in the same cycle. - return 0; + if (UseTID.isBranch()) + return 0; + } unsigned DefAlign = DefMI->hasOneMemOperand() ? (*DefMI->memoperands_begin())->getAlignment() : 0; diff --git a/lib/Target/ARM/ARMScheduleA8.td b/lib/Target/ARM/ARMScheduleA8.td index 32d9d66837b..1f19b21e1c3 100644 --- a/lib/Target/ARM/ARMScheduleA8.td +++ b/lib/Target/ARM/ARMScheduleA8.td @@ -237,7 +237,7 @@ def CortexA8Itineraries : ProcessorItineraries< // // FP Special Register to Integer Register File Move InstrItinData, - InstrStage<1, [A8_NLSPipe]>]>, + InstrStage<1, [A8_NLSPipe]>], [20]>, // // Single-precision FP Unary InstrItinData, diff --git a/lib/Target/ARM/ARMScheduleA9.td b/lib/Target/ARM/ARMScheduleA9.td index 20aa64163bf..3096b0ad990 100644 --- a/lib/Target/ARM/ARMScheduleA9.td +++ b/lib/Target/ARM/ARMScheduleA9.td @@ -431,7 +431,8 @@ def CortexA9Itineraries : ProcessorItineraries< InstrStage<1, [A9_MUX0], 0>, InstrStage<1, [A9_DRegsVFP], 0, Required>, InstrStage<2, [A9_DRegsN], 0, Reserved>, - InstrStage<1, [A9_NPipe]>]>, + InstrStage<1, [A9_NPipe]>], + [1]>, // // Single-precision FP Unary InstrItinData, -- 2.34.1