mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-23 06:21:11 +00:00
AMDGPU/SI: Remove VCCReg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244380 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f456aa53d9
commit
d3ff1cd1f5
@ -100,11 +100,11 @@ class VOPAnyCommon <dag outs, dag ins, string asm, list<dag> pattern> :
|
||||
}
|
||||
|
||||
class VOPCCommon <dag ins, string asm, list<dag> pattern> :
|
||||
VOPAnyCommon <(outs VCCReg:$dst), ins, asm, pattern> {
|
||||
VOPAnyCommon <(outs), ins, asm, pattern> {
|
||||
|
||||
let DisableEncoding = "$dst";
|
||||
let VOPC = 1;
|
||||
let Size = 4;
|
||||
let Defs = [VCC];
|
||||
}
|
||||
|
||||
class VOP1Common <dag outs, dag ins, string asm, list<dag> pattern> :
|
||||
|
@ -360,7 +360,7 @@ SIInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
|
||||
} else {
|
||||
// FIXME: Hack until VReg_1 removed.
|
||||
assert(AMDGPU::VGPR_32RegClass.contains(SrcReg));
|
||||
BuildMI(MBB, MI, DL, get(AMDGPU::V_CMP_NE_I32_e32), AMDGPU::VCC)
|
||||
BuildMI(MBB, MI, DL, get(AMDGPU::V_CMP_NE_I32_e32))
|
||||
.addImm(0)
|
||||
.addReg(SrcReg, getKillRegState(KillSrc));
|
||||
}
|
||||
|
@ -1122,15 +1122,25 @@ def VOP_I32_I32_I32_VCC : VOPProfile <[i32, i32, i32, untyped]> {
|
||||
let Src0RC32 = VCSrc_32;
|
||||
}
|
||||
|
||||
def VOP_I1_F32_I32 : VOPProfile <[i1, f32, i32, untyped]> {
|
||||
// VOPC instructions are a special case because for the 32-bit
|
||||
// encoding, we want to display the implicit vcc write as if it were
|
||||
// an explicit $dst.
|
||||
class VOPC_Profile<ValueType vt0, ValueType vt1 = vt0> : VOPProfile <[i1, vt0, vt1, untyped]> {
|
||||
let Asm32 = "vcc, $src0, $src1";
|
||||
}
|
||||
|
||||
class VOPC_Class_Profile<ValueType vt> : VOPC_Profile<vt, i32> {
|
||||
let Ins64 = (ins InputModsNoDefault:$src0_modifiers, Src0RC64:$src0, Src1RC64:$src1);
|
||||
let Asm64 = "$dst, $src0_modifiers, $src1";
|
||||
}
|
||||
|
||||
def VOP_I1_F64_I32 : VOPProfile <[i1, f64, i32, untyped]> {
|
||||
let Ins64 = (ins InputModsNoDefault:$src0_modifiers, Src0RC64:$src0, Src1RC64:$src1);
|
||||
let Asm64 = "$dst, $src0_modifiers, $src1";
|
||||
}
|
||||
def VOPC_I1_F32_F32 : VOPC_Profile<f32>;
|
||||
def VOPC_I1_F64_F64 : VOPC_Profile<f64>;
|
||||
def VOPC_I1_I32_I32 : VOPC_Profile<i32>;
|
||||
def VOPC_I1_I64_I64 : VOPC_Profile<i64>;
|
||||
|
||||
def VOPC_I1_F32_I32 : VOPC_Class_Profile<f32>;
|
||||
def VOPC_I1_F64_I32 : VOPC_Class_Profile<f64>;
|
||||
|
||||
def VOP_I64_I64_I32 : VOPProfile <[i64, i64, i32, untyped]>;
|
||||
def VOP_I64_I32_I64 : VOPProfile <[i64, i32, i64, untyped]>;
|
||||
@ -1637,13 +1647,13 @@ multiclass VOPC_m <vopc op, dag ins, string op_asm, list<dag> pattern,
|
||||
|
||||
def _si : VOPC<op.SI, ins, asm, []>,
|
||||
SIMCInstr <opName#"_e32", SISubtarget.SI> {
|
||||
let Defs = !if(DefExec, [EXEC], []);
|
||||
let Defs = !if(DefExec, [VCC, EXEC], [VCC]);
|
||||
let hasSideEffects = DefExec;
|
||||
}
|
||||
|
||||
def : SIInstAlias <
|
||||
alias_asm,
|
||||
(!cast<Instruction>(NAME#"_e32_si") VCCReg:$dst, p.Src0RC32:$src0, p.Src1RC32:$src1)
|
||||
(!cast<Instruction>(NAME#"_e32_si") p.Src0RC32:$src0, p.Src1RC32:$src1)
|
||||
>;
|
||||
|
||||
} // End AssemblerPredicates = [isSICI]
|
||||
@ -1653,13 +1663,13 @@ multiclass VOPC_m <vopc op, dag ins, string op_asm, list<dag> pattern,
|
||||
|
||||
def _vi : VOPC<op.VI, ins, asm, []>,
|
||||
SIMCInstr <opName#"_e32", SISubtarget.VI> {
|
||||
let Defs = !if(DefExec, [EXEC], []);
|
||||
let Defs = !if(DefExec, [VCC, EXEC], [VCC]);
|
||||
let hasSideEffects = DefExec;
|
||||
}
|
||||
|
||||
def : SIInstAlias <
|
||||
alias_asm,
|
||||
(!cast<Instruction>(NAME#"_e32_vi") VCCReg:$dst, p.Src0RC32:$src0, p.Src1RC32:$src1)
|
||||
(!cast<Instruction>(NAME#"_e32_vi") p.Src0RC32:$src0, p.Src1RC32:$src1)
|
||||
>;
|
||||
|
||||
} // End AssemblerPredicates = [isVI]
|
||||
@ -1721,16 +1731,16 @@ multiclass VOPCClassInst <vopc op, string opName, VOPProfile P,
|
||||
|
||||
|
||||
multiclass VOPC_F32 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
|
||||
VOPCInst <op, opName, VOP_F32_F32_F32, cond, revOp>;
|
||||
VOPCInst <op, opName, VOPC_I1_F32_F32, cond, revOp>;
|
||||
|
||||
multiclass VOPC_F64 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
|
||||
VOPCInst <op, opName, VOP_F64_F64_F64, cond, revOp>;
|
||||
VOPCInst <op, opName, VOPC_I1_F64_F64, cond, revOp>;
|
||||
|
||||
multiclass VOPC_I32 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
|
||||
VOPCInst <op, opName, VOP_I32_I32_I32, cond, revOp>;
|
||||
VOPCInst <op, opName, VOPC_I1_I32_I32, cond, revOp>;
|
||||
|
||||
multiclass VOPC_I64 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
|
||||
VOPCInst <op, opName, VOP_I64_I64_I64, cond, revOp>;
|
||||
VOPCInst <op, opName, VOPC_I1_I64_I64, cond, revOp>;
|
||||
|
||||
|
||||
multiclass VOPCX <vopc op, string opName, VOPProfile P,
|
||||
@ -1739,16 +1749,16 @@ multiclass VOPCX <vopc op, string opName, VOPProfile P,
|
||||
: VOPCInst <op, opName, P, cond, revOp, 1>;
|
||||
|
||||
multiclass VOPCX_F32 <vopc op, string opName, string revOp = opName> :
|
||||
VOPCX <op, opName, VOP_F32_F32_F32, COND_NULL, revOp>;
|
||||
VOPCX <op, opName, VOPC_I1_F32_F32, COND_NULL, revOp>;
|
||||
|
||||
multiclass VOPCX_F64 <vopc op, string opName, string revOp = opName> :
|
||||
VOPCX <op, opName, VOP_F64_F64_F64, COND_NULL, revOp>;
|
||||
VOPCX <op, opName, VOPC_I1_F64_F64, COND_NULL, revOp>;
|
||||
|
||||
multiclass VOPCX_I32 <vopc op, string opName, string revOp = opName> :
|
||||
VOPCX <op, opName, VOP_I32_I32_I32, COND_NULL, revOp>;
|
||||
VOPCX <op, opName, VOPC_I1_I32_I32, COND_NULL, revOp>;
|
||||
|
||||
multiclass VOPCX_I64 <vopc op, string opName, string revOp = opName> :
|
||||
VOPCX <op, opName, VOP_I64_I64_I64, COND_NULL, revOp>;
|
||||
VOPCX <op, opName, VOPC_I1_I64_I64, COND_NULL, revOp>;
|
||||
|
||||
multiclass VOP3_Helper <vop3 op, string opName, dag outs, dag ins, string asm,
|
||||
list<dag> pat, int NumSrcArgs, bit HasMods> : VOP3_m <
|
||||
@ -1756,16 +1766,16 @@ multiclass VOP3_Helper <vop3 op, string opName, dag outs, dag ins, string asm,
|
||||
>;
|
||||
|
||||
multiclass VOPC_CLASS_F32 <vopc op, string opName> :
|
||||
VOPCClassInst <op, opName, VOP_I1_F32_I32, 0>;
|
||||
VOPCClassInst <op, opName, VOPC_I1_F32_I32, 0>;
|
||||
|
||||
multiclass VOPCX_CLASS_F32 <vopc op, string opName> :
|
||||
VOPCClassInst <op, opName, VOP_I1_F32_I32, 1>;
|
||||
VOPCClassInst <op, opName, VOPC_I1_F32_I32, 1>;
|
||||
|
||||
multiclass VOPC_CLASS_F64 <vopc op, string opName> :
|
||||
VOPCClassInst <op, opName, VOP_I1_F64_I32, 0>;
|
||||
VOPCClassInst <op, opName, VOPC_I1_F64_I32, 0>;
|
||||
|
||||
multiclass VOPCX_CLASS_F64 <vopc op, string opName> :
|
||||
VOPCClassInst <op, opName, VOP_I1_F64_I32, 1>;
|
||||
VOPCClassInst <op, opName, VOPC_I1_F64_I32, 1>;
|
||||
|
||||
multiclass VOP3Inst <vop3 op, string opName, VOPProfile P,
|
||||
SDPatternOperator node = null_frag> : VOP3_Helper <
|
||||
|
@ -313,7 +313,7 @@ void SILowerControlFlowPass::Kill(MachineInstr &MI) {
|
||||
.addImm(0);
|
||||
}
|
||||
} else {
|
||||
BuildMI(MBB, &MI, DL, TII->get(AMDGPU::V_CMPX_LE_F32_e32), AMDGPU::VCC)
|
||||
BuildMI(MBB, &MI, DL, TII->get(AMDGPU::V_CMPX_LE_F32_e32))
|
||||
.addImm(0)
|
||||
.addOperand(Op);
|
||||
}
|
||||
@ -359,9 +359,9 @@ void SILowerControlFlowPass::LoadM0(MachineInstr &MI, MachineInstr *MovRel, int
|
||||
.addReg(AMDGPU::VCC_LO);
|
||||
|
||||
// Compare the just read M0 value to all possible Idx values
|
||||
BuildMI(MBB, &MI, DL, TII->get(AMDGPU::V_CMP_EQ_U32_e32), AMDGPU::VCC)
|
||||
.addReg(AMDGPU::M0)
|
||||
.addReg(Idx);
|
||||
BuildMI(MBB, &MI, DL, TII->get(AMDGPU::V_CMP_EQ_U32_e32))
|
||||
.addReg(AMDGPU::M0)
|
||||
.addReg(Idx);
|
||||
|
||||
// Update EXEC, save the original EXEC value to VCC
|
||||
BuildMI(MBB, &MI, DL, TII->get(AMDGPU::S_AND_SAVEEXEC_B64), AMDGPU::VCC)
|
||||
|
@ -182,8 +182,6 @@ class RegImmMatcher<string name> : AsmOperandClass {
|
||||
let RenderMethod = "addRegOrImmOperands";
|
||||
}
|
||||
|
||||
def VCCReg : RegisterClass<"AMDGPU", [i64, i1], 64, (add VCC)>;
|
||||
|
||||
// Register class for all scalar registers (SGPRs + Special Registers)
|
||||
def SReg_32 : RegisterClass<"AMDGPU", [i32, f32], 32,
|
||||
(add SGPR_32, M0, VCC_LO, VCC_HI, EXEC_LO, EXEC_HI, FLAT_SCR_LO, FLAT_SCR_HI)
|
||||
|
@ -288,8 +288,17 @@ bool SIShrinkInstructions::runOnMachineFunction(MachineFunction &MF) {
|
||||
MachineInstrBuilder Inst32 =
|
||||
BuildMI(MBB, I, MI.getDebugLoc(), TII->get(Op32));
|
||||
|
||||
// dst
|
||||
Inst32.addOperand(MI.getOperand(0));
|
||||
// Add the dst operand if the 32-bit encoding also has an explicit $dst.
|
||||
// For VOPC instructions, this is replaced by an implicit def of vcc.
|
||||
int Op32DstIdx = AMDGPU::getNamedOperandIdx(Op32, AMDGPU::OpName::dst);
|
||||
if (Op32DstIdx != -1) {
|
||||
// dst
|
||||
Inst32.addOperand(MI.getOperand(0));
|
||||
} else {
|
||||
assert(MI.getOperand(0).getReg() == AMDGPU::VCC &&
|
||||
"Unexpected case");
|
||||
}
|
||||
|
||||
|
||||
Inst32.addOperand(*TII->getNamedOperand(MI, AMDGPU::OpName::src0));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user