@@ -156,7 +156,7 @@ void LocalRA::evenAlign()
156156#endif
157157 gra.updateAlignment (G4_GRF, Even);
158158 }
159- gra.updateSubRegAlignment (G4_GRF, Sixteen_Word );
159+ gra.updateSubRegAlignment (G4_GRF, SUB_ALIGNMENT_GRFALIGN );
160160 // Since we are piggy backing on mask field of G4_Declare,
161161 // we need to make sure we reset it before going further.
162162 resetMasks ();
@@ -818,7 +818,7 @@ bool LocalRA::assignUniqueRegisters(bool twoBanksRA, bool twoDirectionsAssign)
818818 }
819819
820820 // Why?
821- G4_SubReg_Align subAlign = builder.GRFAlign () ? Sixteen_Word : dcl->getSubRegAlign ();
821+ G4_SubReg_Align subAlign = builder.GRFAlign () ? SUB_ALIGNMENT_GRFALIGN : dcl->getSubRegAlign ();
822822
823823 if (assignFromFront)
824824 {
@@ -1688,9 +1688,9 @@ void LocalRA::countLocalLiveIntervals(std::vector<LocalLiveRange*>& liveInterval
16881688 }
16891689 else
16901690 {
1691- if (dcl->getNumElems () > 1 && size > 16 && size <= 32 )
1691+ if (dcl->getNumElems () > 1 && size > ( getGRFSize () / 2u ) && size <= ( unsigned int ) getGRFSize () )
16921692 numOneGRF++;
1693- else if (dcl->getNumElems () > 1 && size <= 16 )
1693+ else if (dcl->getNumElems () > 1 && size <= ( getGRFSize () / 2u ) )
16941694 numHalfGRF++;
16951695 else if (dcl->getNumElems () == 1 )
16961696 numScalars++;
@@ -1843,6 +1843,7 @@ void PhyRegsLocalRA::setGRFBusy(int which)
18431843{
18441844 MUST_BE_TRUE (isGRFAvailable (which), " Invalid register" );
18451845 regBusyVector[which] = 0xffff ;
1846+
18461847 if (twoBanksRA)
18471848 {
18481849 if (which < SECOND_HALF_BANK_START_GRF)
@@ -1884,7 +1885,7 @@ void PhyRegsLocalRA::setWordBusy(int whichgrf, int word)
18841885 }
18851886 }
18861887
1887- regBusyVector[whichgrf] |= (0x1 << word);
1888+ regBusyVector[whichgrf] |= (WORD_BUSY << word);
18881889}
18891890
18901891void PhyRegsLocalRA::setWordBusy (int whichgrf, int word, int howmany)
@@ -1947,7 +1948,7 @@ void PhyRegsLocalRA::setWordNotBusy(int whichgrf, int word, int instID)
19471948 }
19481949 }
19491950 }
1950- int mask = ~(1 << word);
1951+ uint32_t mask = ~(1 << word);
19511952 regBusyVector[whichgrf] &= mask;
19521953 if (instID)
19531954 {
@@ -2259,15 +2260,15 @@ void PhyRegsLocalRA::markPhyRegs(G4_Declare* topdcl)
22592260bool PhyRegsLocalRA::findFreeSingleReg (int regIdx, G4_SubReg_Align subalign, int ®num, int &subregnum, int size)
22602261{
22612262 bool found = false ;
2262- if (subalign == Sixteen_Word )
2263+ if (subalign == SUB_ALIGNMENT_GRFALIGN )
22632264 {
22642265 if (isWordBusy (regIdx, 0 , size) == false )
22652266 {
22662267 subregnum = 0 ;
22672268 found = true ;
22682269 }
22692270 }
2270- else if (subalign == Eight_Word )
2271+ else if (subalign == SUB_ALIGNMENT_HALFGRFALIGN )
22712272 {
22722273 if (isWordBusy (regIdx, 0 , size) == false )
22732274 {
@@ -2280,7 +2281,8 @@ bool PhyRegsLocalRA::findFreeSingleReg(int regIdx, G4_SubReg_Align subalign, int
22802281 found = true ;
22812282 }
22822283 }
2283- else if (subalign == Four_Word)
2284+ else if (subalign == Eight_Word ||
2285+ subalign == Four_Word)
22842286 {
22852287 for (int j = 0 ; j < (NUM_WORDS_PER_GRF - size + 1 ) && found == false ; j += 4 )
22862288 {
0 commit comments