forked from OSchip/llvm-project
R600/SI: Move selection of i64 add to separate function.
Also don't use a SmallVector for fixed size array. llvm-svn: 211513
This commit is contained in:
parent
c791f39912
commit
9fa3f93173
|
@ -85,6 +85,8 @@ private:
|
|||
bool SelectADDRVTX_READ(SDValue Addr, SDValue &Base, SDValue &Offset);
|
||||
bool SelectADDRIndirect(SDValue Addr, SDValue &Base, SDValue &Offset);
|
||||
|
||||
SDNode *SelectADD_I64(SDNode *N);
|
||||
|
||||
// Include the pieces autogenerated from the target description.
|
||||
#include "AMDGPUGenDAGISel.inc"
|
||||
};
|
||||
|
@ -217,45 +219,7 @@ SDNode *AMDGPUDAGToDAGISel::Select(SDNode *N) {
|
|||
ST.getGeneration() < AMDGPUSubtarget::SOUTHERN_ISLANDS)
|
||||
break;
|
||||
|
||||
SDLoc DL(N);
|
||||
SDValue LHS = N->getOperand(0);
|
||||
SDValue RHS = N->getOperand(1);
|
||||
|
||||
SDValue Sub0 = CurDAG->getTargetConstant(AMDGPU::sub0, MVT::i32);
|
||||
SDValue Sub1 = CurDAG->getTargetConstant(AMDGPU::sub1, MVT::i32);
|
||||
|
||||
SDNode *Lo0 = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG,
|
||||
DL, MVT::i32, LHS, Sub0);
|
||||
SDNode *Hi0 = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG,
|
||||
DL, MVT::i32, LHS, Sub1);
|
||||
|
||||
SDNode *Lo1 = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG,
|
||||
DL, MVT::i32, RHS, Sub0);
|
||||
SDNode *Hi1 = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG,
|
||||
DL, MVT::i32, RHS, Sub1);
|
||||
|
||||
SDVTList VTList = CurDAG->getVTList(MVT::i32, MVT::Glue);
|
||||
|
||||
SmallVector<SDValue, 8> AddLoArgs;
|
||||
AddLoArgs.push_back(SDValue(Lo0, 0));
|
||||
AddLoArgs.push_back(SDValue(Lo1, 0));
|
||||
|
||||
SDNode *AddLo = CurDAG->getMachineNode(
|
||||
isCFDepth0() ? AMDGPU::S_ADD_I32 : AMDGPU::V_ADD_I32_e32,
|
||||
DL, VTList, AddLoArgs);
|
||||
SDValue Carry = SDValue(AddLo, 1);
|
||||
SDNode *AddHi = CurDAG->getMachineNode(
|
||||
isCFDepth0() ? AMDGPU::S_ADDC_U32 : AMDGPU::V_ADDC_U32_e32,
|
||||
DL, MVT::i32, SDValue(Hi0, 0), SDValue(Hi1, 0), Carry);
|
||||
|
||||
SDValue Args[5] = {
|
||||
CurDAG->getTargetConstant(AMDGPU::SReg_64RegClassID, MVT::i32),
|
||||
SDValue(AddLo,0),
|
||||
Sub0,
|
||||
SDValue(AddHi,0),
|
||||
Sub1,
|
||||
};
|
||||
return CurDAG->SelectNodeTo(N, AMDGPU::REG_SEQUENCE, MVT::i64, Args);
|
||||
return SelectADD_I64(N);
|
||||
}
|
||||
case ISD::SCALAR_TO_VECTOR:
|
||||
case AMDGPUISD::BUILD_VERTICAL_VECTOR:
|
||||
|
@ -682,6 +646,46 @@ bool AMDGPUDAGToDAGISel::SelectADDRIndirect(SDValue Addr, SDValue &Base,
|
|||
return true;
|
||||
}
|
||||
|
||||
SDNode *AMDGPUDAGToDAGISel::SelectADD_I64(SDNode *N) {
|
||||
SDLoc DL(N);
|
||||
SDValue LHS = N->getOperand(0);
|
||||
SDValue RHS = N->getOperand(1);
|
||||
|
||||
SDValue Sub0 = CurDAG->getTargetConstant(AMDGPU::sub0, MVT::i32);
|
||||
SDValue Sub1 = CurDAG->getTargetConstant(AMDGPU::sub1, MVT::i32);
|
||||
|
||||
SDNode *Lo0 = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG,
|
||||
DL, MVT::i32, LHS, Sub0);
|
||||
SDNode *Hi0 = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG,
|
||||
DL, MVT::i32, LHS, Sub1);
|
||||
|
||||
SDNode *Lo1 = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG,
|
||||
DL, MVT::i32, RHS, Sub0);
|
||||
SDNode *Hi1 = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG,
|
||||
DL, MVT::i32, RHS, Sub1);
|
||||
|
||||
SDVTList VTList = CurDAG->getVTList(MVT::i32, MVT::Glue);
|
||||
|
||||
SDValue AddLoArgs[] = { SDValue(Lo0, 0), SDValue(Lo1, 0) };
|
||||
|
||||
SDNode *AddLo = CurDAG->getMachineNode(
|
||||
isCFDepth0() ? AMDGPU::S_ADD_I32 : AMDGPU::V_ADD_I32_e32,
|
||||
DL, VTList, AddLoArgs);
|
||||
SDValue Carry = SDValue(AddLo, 1);
|
||||
SDNode *AddHi = CurDAG->getMachineNode(
|
||||
isCFDepth0() ? AMDGPU::S_ADDC_U32 : AMDGPU::V_ADDC_U32_e32,
|
||||
DL, MVT::i32, SDValue(Hi0, 0), SDValue(Hi1, 0), Carry);
|
||||
|
||||
SDValue Args[5] = {
|
||||
CurDAG->getTargetConstant(AMDGPU::SReg_64RegClassID, MVT::i32),
|
||||
SDValue(AddLo,0),
|
||||
Sub0,
|
||||
SDValue(AddHi,0),
|
||||
Sub1,
|
||||
};
|
||||
return CurDAG->SelectNodeTo(N, AMDGPU::REG_SEQUENCE, MVT::i64, Args);
|
||||
}
|
||||
|
||||
void AMDGPUDAGToDAGISel::PostprocessISelDAG() {
|
||||
const AMDGPUTargetLowering& Lowering =
|
||||
*static_cast<const AMDGPUTargetLowering*>(getTargetLowering());
|
||||
|
|
Loading…
Reference in New Issue