"RESERVE_REG $dst, $src",
[(set GPRF32:$dst, (int_AMDGPU_reserve_reg imm:$src))]
>;
-
- def STORE_OUTPUT: AMDGPUShaderInst <
- (outs GPRF32:$dst),
- (ins GPRF32:$src0, i32imm:$src1),
- "STORE_OUTPUT $dst, $src0, $src1",
- [(set GPRF32:$dst, (int_AMDGPU_store_output GPRF32:$src0, imm:$src1))]
- >;
}
/* Generic helper patterns for intrinsics */
MI->eraseFromParent();
break;
}
+ case AMDIL::STORE_OUTPUT:
+ {
+ MachineBasicBlock::iterator I = *MI;
+ int64_t OutputIndex = MI->getOperand(2).getImm();
+ unsigned OutputReg = AMDIL::R600_TReg32RegClass.getRegister(OutputIndex);
+
+ BuildMI(*BB, I, BB->findDebugLoc(I), TII->get(AMDIL::COPY), OutputReg)
+ .addOperand(MI->getOperand(1));
+
+ MRI.replaceRegWith(MI->getOperand(0).getReg(), OutputReg);
+ if (!MRI.isLiveOut(OutputReg)) {
+ MRI.addLiveOut(OutputReg);
+ }
+ MI->eraseFromParent();
+ break;
+ }
}
return BB;
}
[(set R600_Reg32:$dst, (int_R600_load_input imm:$src))]
>;
+def STORE_OUTPUT: AMDGPUShaderInst <
+ (outs R600_Reg32:$dst),
+ (ins R600_Reg32:$src0, i32imm:$src1),
+ "STORE_OUTPUT $dst, $src0, $src1",
+ [(set R600_Reg32:$dst, (int_AMDGPU_store_output R600_Reg32:$src0, imm:$src1))]
+>;
+
} // End usesCustomInserter = 1, isPseudo = 1
} // End isCodeGenOnly = 1
void lowerEXPORT_REG_FAKE(MachineInstr &MI, MachineBasicBlock &MBB,
MachineBasicBlock::iterator I);
- bool lowerSTORE_OUTPUT(MachineInstr & MI, MachineBasicBlock &MBB,
- MachineBasicBlock::iterator I);
public:
R600LowerShaderInstructionsPass(TargetMachine &tm) :
deleteInstr = true;
break;
- case AMDIL::STORE_OUTPUT:
- deleteInstr = lowerSTORE_OUTPUT(MI, MBB, I);
- break;
-
}
++I;
return false;
}
-
-bool R600LowerShaderInstructionsPass::lowerSTORE_OUTPUT(MachineInstr &MI,
- MachineBasicBlock &MBB, MachineBasicBlock::iterator I)
-{
- MachineOperand &valueOp = MI.getOperand(1);
- MachineOperand &indexOp = MI.getOperand(2);
- unsigned valueReg = valueOp.getReg();
- int64_t outputIndex = indexOp.getImm();
- const TargetRegisterClass * outputClass = TM.getRegisterInfo()->getRegClass(AMDIL::R600_TReg32RegClassID);
- unsigned newRegister = outputClass->getRegister(outputIndex);
-
- BuildMI(MBB, I, MBB.findDebugLoc(I), TM.getInstrInfo()->get(AMDIL::COPY),
- newRegister)
- .addReg(valueReg);
-
- if (!MRI->isLiveOut(newRegister))
- MRI->addLiveOut(newRegister);
-
- return true;
-
-}