diff --git a/lib/Target/AMDGPU/GCNHazardRecognizer.cpp b/lib/Target/AMDGPU/GCNHazardRecognizer.cpp index 30a563fdc1d..d897127812b 100644 --- a/lib/Target/AMDGPU/GCNHazardRecognizer.cpp +++ b/lib/Target/AMDGPU/GCNHazardRecognizer.cpp @@ -185,7 +185,9 @@ GCNHazardRecognizer::getHazardType(SUnit *SU, int Stalls) { if (SIInstrInfo::isMAI(*MI) && checkMAIHazards(MI) > 0) return NoopHazard; - if (MI->mayLoadOrStore() && checkMAILdStHazards(MI) > 0) + if ((SIInstrInfo::isVMEM(*MI) || + SIInstrInfo::isFLAT(*MI) || + SIInstrInfo::isDS(*MI)) && checkMAILdStHazards(MI) > 0) return NoopHazard; if (MI->isInlineAsm() && checkInlineAsmHazards(MI) > 0) @@ -288,7 +290,9 @@ unsigned GCNHazardRecognizer::PreEmitNoopsCommon(MachineInstr *MI) { if (SIInstrInfo::isMAI(*MI)) return std::max(WaitStates, checkMAIHazards(MI)); - if (MI->mayLoadOrStore()) + if (SIInstrInfo::isVMEM(*MI) || + SIInstrInfo::isFLAT(*MI) || + SIInstrInfo::isDS(*MI)) return std::max(WaitStates, checkMAILdStHazards(MI)); return WaitStates; diff --git a/test/CodeGen/AMDGPU/mai-hazards.mir b/test/CodeGen/AMDGPU/mai-hazards.mir index 59ce256dc01..ca4ae3268b1 100644 --- a/test/CodeGen/AMDGPU/mai-hazards.mir +++ b/test/CodeGen/AMDGPU/mai-hazards.mir @@ -401,6 +401,45 @@ body: | ... --- +# GCN-LABEL: name: accvgpr_read_write_vgpr_ds_permute +# GCN: V_ACCVGPR_READ_B32 +# GCN-NEXT: S_NOP 0 +# GCN-NEXT: S_NOP 0 +# GCN-NEXT: DS_PERMUTE_B32 +name: accvgpr_read_write_vgpr_ds_permute +body: | + bb.0: + $vgpr0 = V_ACCVGPR_READ_B32 killed $agpr0, implicit $exec + $vgpr1 = DS_PERMUTE_B32 $vgpr0, $vgpr1, 0, implicit $exec +... +--- + +# GCN-LABEL: name: accvgpr_read_write_vgpr_flat_load +# GCN: V_ACCVGPR_READ_B32 +# GCN-NEXT: S_NOP 0 +# GCN-NEXT: S_NOP 0 +# GCN-NEXT: FLAT_LOAD_DWORD +name: accvgpr_read_write_vgpr_flat_load +body: | + bb.0: + $vgpr0 = V_ACCVGPR_READ_B32 killed $agpr0, implicit $exec + $vgpr4 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, 0, 0, implicit $exec, implicit $flat_scr +... +--- + +# GCN-LABEL: name: accvgpr_read_write_vgpr_buffer_store +# GCN: V_ACCVGPR_READ_B32 +# GCN-NEXT: S_NOP 0 +# GCN-NEXT: S_NOP 0 +# GCN-NEXT: BUFFER_STORE_DWORD_OFFSET +name: accvgpr_read_write_vgpr_buffer_store +body: | + bb.0: + $vgpr0 = V_ACCVGPR_READ_B32 killed $agpr0, implicit $exec + BUFFER_STORE_DWORD_OFFSET $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, 0, 0, 0, 0, implicit $exec +... +--- + # GCN-LABEL: name: accvgpr_read_write_vgpr_store # GCN: V_ACCVGPR_READ_B32 # GCN-NEXT: S_NOP 0