diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-01-20 18:53:00 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-01-20 18:53:00 +0000 |
| commit | 2a631fa4064bbaf6ba038ddae278d9c6f9a1d7ec (patch) | |
| tree | a96af0ff7691d836d843e36053fab4b4eb51c216 /llvm/lib | |
| parent | b3f83b28a5acdd123724e32a4bb9dd248c432dc7 (diff) | |
| download | bcm5719-llvm-2a631fa4064bbaf6ba038ddae278d9c6f9a1d7ec.tar.gz bcm5719-llvm-2a631fa4064bbaf6ba038ddae278d9c6f9a1d7ec.zip | |
Implement ADD_PARTS/SUB_PARTS so that 64-bit integer add/sub work. This
fixes most of the remaining llc-beta failures.
llvm-svn: 19716
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelPattern.cpp | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/llvm/lib/Target/X86/X86ISelPattern.cpp b/llvm/lib/Target/X86/X86ISelPattern.cpp index 04a2665fead..2219291905b 100644 --- a/llvm/lib/Target/X86/X86ISelPattern.cpp +++ b/llvm/lib/Target/X86/X86ISelPattern.cpp @@ -1303,20 +1303,28 @@ unsigned ISel::SelectExpr(SDOperand N) { unsigned &Reg = ExprMap[N]; if (Reg) return Reg; - if (N.getOpcode() != ISD::CALL) + if (N.getOpcode() != ISD::CALL && N.getOpcode() != ISD::ADD_PARTS && + N.getOpcode() != ISD::SUB_PARTS) Reg = Result = (N.getValueType() != MVT::Other) ? MakeReg(N.getValueType()) : 1; else { // If this is a call instruction, make sure to prepare ALL of the result // values as well as the chain. - if (Node->getNumValues() == 1) - Reg = Result = 1; // Void call, just a chain. - else { + if (N.getOpcode() == ISD::CALL) { + if (Node->getNumValues() == 1) + Reg = Result = 1; // Void call, just a chain. + else { + Result = MakeReg(Node->getValueType(0)); + ExprMap[N.getValue(0)] = Result; + for (unsigned i = 1, e = N.Val->getNumValues()-1; i != e; ++i) + ExprMap[N.getValue(i)] = MakeReg(Node->getValueType(i)); + ExprMap[SDOperand(Node, Node->getNumValues()-1)] = 1; + } + } else { Result = MakeReg(Node->getValueType(0)); ExprMap[N.getValue(0)] = Result; - for (unsigned i = 1, e = N.Val->getNumValues()-1; i != e; ++i) + for (unsigned i = 1, e = N.Val->getNumValues(); i != e; ++i) ExprMap[N.getValue(i)] = MakeReg(Node->getValueType(i)); - ExprMap[SDOperand(Node, Node->getNumValues()-1)] = 1; } } @@ -1972,6 +1980,24 @@ unsigned ISel::SelectExpr(SDOperand N) { } return Result; } + case ISD::ADD_PARTS: + case ISD::SUB_PARTS: { + assert(N.getNumOperands() == 4 && N.getValueType() == MVT::i32 && + "Not an i64 add/sub!"); + // Emit all of the operands. + std::vector<unsigned> InVals; + for (unsigned i = 0, e = N.getNumOperands(); i != e; ++i) + InVals.push_back(SelectExpr(N.getOperand(i))); + if (N.getOpcode() == ISD::ADD_PARTS) { + BuildMI(BB, X86::ADD32rr, 2, Result).addReg(InVals[0]).addReg(InVals[2]); + BuildMI(BB, X86::ADC32rr,2,Result+1).addReg(InVals[1]).addReg(InVals[3]); + } else { + BuildMI(BB, X86::SUB32rr, 2, Result).addReg(InVals[0]).addReg(InVals[2]); + BuildMI(BB, X86::SBB32rr, 2,Result+1).addReg(InVals[1]).addReg(InVals[3]); + } + return Result+N.ResNo; + } + case ISD::SELECT: if (getRegPressure(N.getOperand(1)) > getRegPressure(N.getOperand(2))) { Tmp2 = SelectExpr(N.getOperand(1)); |

