mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
R600/SI: Add support for buffer stores v2
v2: - Use the ADDR64 bit Reviewed-by: Christian König <christian.koenig@amd.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178931 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -49,6 +49,7 @@ SITargetLowering::SITargetLowering(TargetMachine &TM) :
|
||||
|
||||
addRegisterClass(MVT::v4i32, &AMDGPU::VReg_128RegClass);
|
||||
addRegisterClass(MVT::v4f32, &AMDGPU::VReg_128RegClass);
|
||||
addRegisterClass(MVT::i128, &AMDGPU::SReg_128RegClass);
|
||||
|
||||
addRegisterClass(MVT::v8i32, &AMDGPU::VReg_256RegClass);
|
||||
addRegisterClass(MVT::v8f32, &AMDGPU::VReg_256RegClass);
|
||||
@@ -70,6 +71,10 @@ SITargetLowering::SITargetLowering(TargetMachine &TM) :
|
||||
setOperationAction(ISD::SELECT_CC, MVT::i32, Custom);
|
||||
|
||||
setOperationAction(ISD::SELECT_CC, MVT::Other, Expand);
|
||||
|
||||
setOperationAction(ISD::STORE, MVT::i32, Custom);
|
||||
setOperationAction(ISD::STORE, MVT::i64, Custom);
|
||||
|
||||
setTargetDAGCombine(ISD::SELECT_CC);
|
||||
|
||||
setTargetDAGCombine(ISD::SETCC);
|
||||
@@ -234,6 +239,7 @@ SDValue SITargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
|
||||
default: return AMDGPUTargetLowering::LowerOperation(Op, DAG);
|
||||
case ISD::BRCOND: return LowerBRCOND(Op, DAG);
|
||||
case ISD::SELECT_CC: return LowerSELECT_CC(Op, DAG);
|
||||
case ISD::STORE: return LowerSTORE(Op, DAG);
|
||||
}
|
||||
return SDValue();
|
||||
}
|
||||
@@ -332,6 +338,32 @@ SDValue SITargetLowering::LowerBRCOND(SDValue BRCOND,
|
||||
return Chain;
|
||||
}
|
||||
|
||||
#define RSRC_DATA_FORMAT 0xf00000000000
|
||||
|
||||
SDValue SITargetLowering::LowerSTORE(SDValue Op, SelectionDAG &DAG) const {
|
||||
StoreSDNode *StoreNode = cast<StoreSDNode>(Op);
|
||||
SDValue Chain = Op.getOperand(0);
|
||||
SDValue Value = Op.getOperand(1);
|
||||
SDValue VirtualAddress = Op.getOperand(2);
|
||||
DebugLoc DL = Op.getDebugLoc();
|
||||
|
||||
if (StoreNode->getAddressSpace() != AMDGPUAS::GLOBAL_ADDRESS) {
|
||||
return SDValue();
|
||||
}
|
||||
|
||||
SDValue SrcSrc = DAG.getNode(ISD::BUILD_PAIR, DL, MVT::i128,
|
||||
DAG.getConstant(0, MVT::i64),
|
||||
DAG.getConstant(RSRC_DATA_FORMAT, MVT::i64));
|
||||
|
||||
SDValue Ops[2];
|
||||
Ops[0] = DAG.getNode(AMDGPUISD::BUFFER_STORE, DL, MVT::Other, Chain,
|
||||
Value, SrcSrc, VirtualAddress);
|
||||
Ops[1] = Chain;
|
||||
|
||||
return DAG.getMergeValues(Ops, 2, DL);
|
||||
|
||||
}
|
||||
|
||||
SDValue SITargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const {
|
||||
SDValue LHS = Op.getOperand(0);
|
||||
SDValue RHS = Op.getOperand(1);
|
||||
|
||||
Reference in New Issue
Block a user