Skip to content

Commit

Permalink
AMDGPU/SI: Fix more cases of losing exec operands
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247230 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
arsenm committed Sep 10, 2015
1 parent 117c014 commit 3a2cec8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
10 changes: 4 additions & 6 deletions lib/Target/AMDGPU/SIInstrFormats.td
Original file line number Diff line number Diff line change
Expand Up @@ -611,15 +611,13 @@ class VINTRPCommon <dag outs, dag ins, string asm, list<dag> pattern> :
// Vector I/O operations
//===----------------------------------------------------------------------===//

let Uses = [EXEC] in {

class DS <dag outs, dag ins, string asm, list<dag> pattern> :
InstSI <outs, ins, asm, pattern> {

let LGKM_CNT = 1;
let DS = 1;
let UseNamedOperandTable = 1;
let Uses = [M0];
let Uses = [M0, EXEC];

// Most instruction load and store data, so set this as the default.
let mayLoad = 1;
Expand All @@ -636,6 +634,7 @@ class MUBUF <dag outs, dag ins, string asm, list<dag> pattern> :
let VM_CNT = 1;
let EXP_CNT = 1;
let MUBUF = 1;
let Uses = [EXEC];

let hasSideEffects = 0;
let UseNamedOperandTable = 1;
Expand All @@ -649,6 +648,7 @@ class MTBUF <dag outs, dag ins, string asm, list<dag> pattern> :
let VM_CNT = 1;
let EXP_CNT = 1;
let MTBUF = 1;
let Uses = [EXEC];

let hasSideEffects = 0;
let UseNamedOperandTable = 1;
Expand Down Expand Up @@ -678,9 +678,7 @@ class MIMG <bits<7> op, dag outs, dag ins, string asm, list<dag> pattern> :
let VM_CNT = 1;
let EXP_CNT = 1;
let MIMG = 1;
let Uses = [EXEC];

let hasSideEffects = 0; // XXX ????
}


} // End Uses = [EXEC]
4 changes: 1 addition & 3 deletions lib/Target/AMDGPU/SIInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ bool SIInstrInfo::isReallyTriviallyReMaterializable(const MachineInstr *MI,
switch (MI->getOpcode()) {
case AMDGPU::V_MOV_B32_e32:
case AMDGPU::V_MOV_B32_e64:
case AMDGPU::V_MOV_B64_PSEUDO:
return true;
default:
return false;
Expand Down Expand Up @@ -996,9 +997,6 @@ bool SIInstrInfo::FoldImmediate(MachineInstr *UseMI, MachineInstr *DefMI,
AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::src2));
}

UseMI->RemoveOperand(AMDGPU::getNamedOperandIdx(Opc,
AMDGPU::OpName::src2));
// ChangingToImmediate adds Src2 back to the instruction.
Src2->ChangeToImmediate(Imm);

removeModOperands(*UseMI);
Expand Down
14 changes: 7 additions & 7 deletions lib/Target/AMDGPU/SIInstructions.td
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,7 @@ defm V_RSQ_CLAMP_F64 : VOP1InstSI <vop1<0x32>, "v_rsq_clamp_f64",
// VINTRP Instructions
//===----------------------------------------------------------------------===//

let Uses = [M0] in {
let Uses = [M0, EXEC] in {

// FIXME: Specify SchedRW for VINTRP insturctions.

Expand Down Expand Up @@ -1412,7 +1412,7 @@ defm V_INTERP_MOV_F32 : VINTRP_m <
[(set f32:$dst, (AMDGPUinterp_mov (i32 imm:$src0), (i32 imm:$attr_chan),
(i32 imm:$attr)))]>;

} // End Uses = [M0]
} // End Uses = [M0, EXEC]

//===----------------------------------------------------------------------===//
// VOP2 Instructions
Expand Down Expand Up @@ -1769,7 +1769,7 @@ let SchedRW = [WriteDouble, WriteSALU] in {
defm V_DIV_SCALE_F64 : VOP3b_64 <vop3<0x16e, 0x1e1>, "v_div_scale_f64", []>;
} // let SchedRW = [WriteDouble]

let isCommutable = 1, Uses = [VCC] in {
let isCommutable = 1, Uses = [VCC, EXEC] in {

let SchedRW = [WriteFloatFMA] in {
// v_div_fmas_f32:
Expand All @@ -1793,7 +1793,7 @@ defm V_DIV_FMAS_F64 : VOP3_VCC_Inst <vop3<0x170, 0x1e3>, "v_div_fmas_f64",
>;

} // End SchedRW = [WriteDouble]
} // End isCommutable = 1
} // End isCommutable = 1, Uses = [VCC, EXEC]

//def V_MSAD_U8 : VOP3_U8 <0x00000171, "v_msad_u8", []>;
//def V_QSAD_U8 : VOP3_U8 <0x00000172, "v_qsad_u8", []>;
Expand Down Expand Up @@ -1842,7 +1842,7 @@ def V_CNDMASK_B64_PSEUDO : VOP3Common <(outs VReg_64:$dst),
(ins VSrc_64:$src0, VSrc_64:$src1, SSrc_64:$src2), "", []
>;

let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in {
let hasSideEffects = 0, mayLoad = 0, mayStore = 0, Uses = [EXEC] in {
// 64-bit vector move instruction. This is mainly used by the SIFoldOperands
// pass to enable folding of inline immediates.
def V_MOV_B64_PSEUDO : InstSI <(outs VReg_64:$dst), (ins VSrc_64:$src0), "", []>;
Expand Down Expand Up @@ -1984,7 +1984,7 @@ def SI_INDIRECT_DST_V16 : SI_INDIRECT_DST<VReg_512>;

multiclass SI_SPILL_SGPR <RegisterClass sgpr_class> {

let UseNamedOperandTable = 1 in {
let UseNamedOperandTable = 1, Uses = [EXEC] in {
def _SAVE : InstSI <
(outs),
(ins sgpr_class:$src, i32imm:$frame_idx, SReg_128:$scratch_rsrc,
Expand Down Expand Up @@ -2016,7 +2016,7 @@ defm SI_SPILL_S256 : SI_SPILL_SGPR <SReg_256>;
defm SI_SPILL_S512 : SI_SPILL_SGPR <SReg_512>;

multiclass SI_SPILL_VGPR <RegisterClass vgpr_class> {
let UseNamedOperandTable = 1, VGPRSpill = 1 in {
let UseNamedOperandTable = 1, VGPRSpill = 1, Uses = [EXEC] in {
def _SAVE : InstSI <
(outs),
(ins vgpr_class:$src, i32imm:$frame_idx, SReg_128:$scratch_rsrc,
Expand Down

0 comments on commit 3a2cec8

Please sign in to comment.