diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-03 07:27:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-03 07:27:34 +0000 |
commit | b97046ae4f5979df9fea20216fef0fe67211e0c6 (patch) | |
tree | 65afac57e73d3a0ab76c3726c15b0ef44800f690 | |
parent | 4e7854407ced8e2160592675918312a20cfb7cde (diff) |
Add support for one argument OneArgFP instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11094 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/FloatingPoint.cpp | 7 | ||||
-rw-r--r-- | lib/Target/X86/X86FloatingPoint.cpp | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/Target/X86/FloatingPoint.cpp b/lib/Target/X86/FloatingPoint.cpp index a6c370c2fd..4231776aee 100644 --- a/lib/Target/X86/FloatingPoint.cpp +++ b/lib/Target/X86/FloatingPoint.cpp @@ -383,10 +383,11 @@ void FPS::handleZeroArgFP(MachineBasicBlock::iterator &I) { /// void FPS::handleOneArgFP(MachineBasicBlock::iterator &I) { MachineInstr *MI = *I; - assert(MI->getNumOperands() == 5 && "Can only handle fst* instructions!"); + assert((MI->getNumOperands() == 5 || MI->getNumOperands() == 1) && + "Can only handle fst* & ftst instructions!"); // Is this the last use of the source register? - unsigned Reg = getFPReg(MI->getOperand(4)); + unsigned Reg = getFPReg(MI->getOperand(MI->getNumOperands()-1)); bool KillsSrc = false; for (LiveVariables::killed_iterator KI = LV->killed_begin(MI), E = LV->killed_end(MI); KI != E; ++KI) @@ -403,7 +404,7 @@ void FPS::handleOneArgFP(MachineBasicBlock::iterator &I) { } else { moveToTop(Reg, I); // Move to the top of the stack... } - MI->RemoveOperand(4); // Remove explicit ST(0) operand + MI->RemoveOperand(MI->getNumOperands()-1); // Remove explicit ST(0) operand if (MI->getOpcode() == X86::FSTPr80 || MI->getOpcode() == X86::FISTPr64) { assert(StackTop > 0 && "Stack empty??"); diff --git a/lib/Target/X86/X86FloatingPoint.cpp b/lib/Target/X86/X86FloatingPoint.cpp index a6c370c2fd..4231776aee 100644 --- a/lib/Target/X86/X86FloatingPoint.cpp +++ b/lib/Target/X86/X86FloatingPoint.cpp @@ -383,10 +383,11 @@ void FPS::handleZeroArgFP(MachineBasicBlock::iterator &I) { /// void FPS::handleOneArgFP(MachineBasicBlock::iterator &I) { MachineInstr *MI = *I; - assert(MI->getNumOperands() == 5 && "Can only handle fst* instructions!"); + assert((MI->getNumOperands() == 5 || MI->getNumOperands() == 1) && + "Can only handle fst* & ftst instructions!"); // Is this the last use of the source register? - unsigned Reg = getFPReg(MI->getOperand(4)); + unsigned Reg = getFPReg(MI->getOperand(MI->getNumOperands()-1)); bool KillsSrc = false; for (LiveVariables::killed_iterator KI = LV->killed_begin(MI), E = LV->killed_end(MI); KI != E; ++KI) @@ -403,7 +404,7 @@ void FPS::handleOneArgFP(MachineBasicBlock::iterator &I) { } else { moveToTop(Reg, I); // Move to the top of the stack... } - MI->RemoveOperand(4); // Remove explicit ST(0) operand + MI->RemoveOperand(MI->getNumOperands()-1); // Remove explicit ST(0) operand if (MI->getOpcode() == X86::FSTPr80 || MI->getOpcode() == X86::FISTPr64) { assert(StackTop > 0 && "Stack empty??"); |