summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/FloatingPoint.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-03 07:27:34 +0000
committerChris Lattner <sabre@nondot.org>2004-02-03 07:27:34 +0000
commit8161306139937c48c2f7d66bb41be2748d518058 (patch)
tree9d710e874db96e53bae2efbd7e972c5b1478648d /llvm/lib/Target/X86/FloatingPoint.cpp
parent3d100ef0caf5b7429678eda625d393cd4be78221 (diff)
downloadbcm5719-llvm-8161306139937c48c2f7d66bb41be2748d518058.tar.gz
bcm5719-llvm-8161306139937c48c2f7d66bb41be2748d518058.zip
Add support for one argument OneArgFP instructions
llvm-svn: 11094
Diffstat (limited to 'llvm/lib/Target/X86/FloatingPoint.cpp')
-rw-r--r--llvm/lib/Target/X86/FloatingPoint.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/FloatingPoint.cpp b/llvm/lib/Target/X86/FloatingPoint.cpp
index a6c370c2fd3..4231776aeef 100644
--- a/llvm/lib/Target/X86/FloatingPoint.cpp
+++ b/llvm/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??");
OpenPOWER on IntegriCloud