To unroll a for loop you would just copy and paste it's contents, each time replacing it with the current value of the iterator.
So
for(i=0; i<8; i++)
{
PORTA = ((bits<<i) | (bits >> 8-i));
delay_ms(500);
}
would become
//i=0
PORTA = ((bits<<0) | (bits >> 8-0));
delay_ms(500);
//i=1
PORTA = ((bits<<1) | (bits >> 8-1));
delay_ms(500);
//i=2
PORTA = ((bits<<2) | (bits >> 8-2));
delay_ms(500);
//i=3
PORTA = ((bits<<3) | (bits >> 8-3));
delay_ms(500);
//i=4
PORTA = ((bits<<4) | (bits >> 8-4));
delay_ms(500);
//i=5
PORTA = ((bits<<5) | (bits >> 8-5));
delay_ms(500);
//i=6
PORTA = ((bits<<6) | (bits >> 8-6));
delay_ms(500);
//i=7
PORTA = ((bits<<7) | (bits >> 8-7));
delay_ms(500);
In VHDL for example, a for loop is converted to the equivalent unrolled loop.