From a39b9b80e0098622a89aa020e087986164a32781 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 6 Sep 2012 15:41:59 -0400 Subject: radeonsi: Move interpolation mode check into the compiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The compiler needs to know which interpolation modes are enabled, so it knows which values will be preloaded into the VGPRs. Reviewed-by: Michel Dänzer --- lib/Target/AMDGPU/SIAssignInterpRegs.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Target/AMDGPU/SIAssignInterpRegs.cpp b/lib/Target/AMDGPU/SIAssignInterpRegs.cpp index 447eff6f5ac..0e36e6b8b78 100644 --- a/lib/Target/AMDGPU/SIAssignInterpRegs.cpp +++ b/lib/Target/AMDGPU/SIAssignInterpRegs.cpp @@ -52,6 +52,7 @@ public: char SIAssignInterpRegsPass::ID = 0; #define INTERP_VALUES 16 +#define REQUIRED_VALUE_MAX_INDEX 7 struct interp_info { bool enabled; @@ -92,16 +93,26 @@ bool SIAssignInterpRegsPass::runOnMachineFunction(MachineFunction &MF) return false; } MachineRegisterInfo &MRI = MF.getRegInfo(); + bool ForceEnable = true; /* First pass, mark the interpolation values that are used. */ for (unsigned interp_idx = 0; interp_idx < INTERP_VALUES; interp_idx++) { for (unsigned reg_idx = 0; reg_idx < InterpUse[interp_idx].reg_count; reg_idx++) { - InterpUse[interp_idx].enabled = + InterpUse[interp_idx].enabled = InterpUse[interp_idx].enabled || !MRI.use_empty(InterpUse[interp_idx].regs[reg_idx]); + if (InterpUse[interp_idx].enabled && + interp_idx <= REQUIRED_VALUE_MAX_INDEX) { + ForceEnable = false; + } } } + // At least one interpolation mode must be enabled or else the GPU will hang. + if (ForceEnable) { + InterpUse[0].enabled = true; + } + unsigned used_vgprs = 0; /* Second pass, replace with VGPRs. */ -- cgit v1.2.3