This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

loop patches



OK.  I've got a reasonable testcase.

int noperands;
void
find_reloads ()
{
  register int i, j;
  int this_alternative[10 ];
  int goal_alternative[10 ];
  char goal_alternative_win[10 ];
    {
	  for (i = 0; i < noperands; i++)
	    {
	      goal_alternative_win[i] = 1;
	      goal_alternative[i] = this_alternative[i];
	    }
    }
}

Compile with  -O2 on an x86 with your patches installed.


>From the .gcse dump we have:

(insn 23 21 25 (set (reg:SI 24)
        (plus:SI (reg:SI 6 %ebp)
            (const_int -92))) 142 {addsi3+1} (nil)
    (nil))

(insn 25 23 27 (set (mem/s:QI (plus:SI (reg:SI 24)
                (reg/v:SI 21)))
        (const_int 1)) 63 {movqi+1} (nil)
    (nil))

(insn 27 25 29 (set (reg:SI 25)
        (ashift:SI (reg/v:SI 21)
            (const_int 2))) 229 {ashlsi3} (nil)
    (nil))

(insn 29 27 32 (set (reg:SI 26)
        (plus:SI (reg:SI 6 %ebp)
            (const_int -80))) 142 {addsi3+1} (nil)
    (nil))

(insn 32 29 34 (set (reg:SI 28)
        (plus:SI (reg:SI 6 %ebp)
            (const_int -40))) 142 {addsi3+1} (nil)
    (nil))

(insn 34 32 35 (set (reg:SI 29)
        (mem/s:SI (plus:SI (reg:SI 28)
                (reg:SI 25)))) 53 {movsi+2} (nil)
    (nil))


Of partciular interest is insn 34.  reg28 is the start of the array
on the stack.  reg25 is the scaled loop counter.


>From .loop we have:

giv at 34 reduced to (plus:SI (mult:SI (reg:SI 32)
        (const_int 4))
    (const_int 328))

(insn 74 68 11 (set (reg:SI 32)                                                
        (plus:SI (reg:SI 6 %ebp)             
            (const_int -92))) -1 (nil)
    (nil))                               

(note 11 74 19 "" NOTE_INSN_LOOP_BEG) 

(code_label 19 11 21 5 "")       

(note 21 19 25 "" NOTE_INSN_DELETED)       

(insn 25 21 27 (set (mem/s:QI (reg:SI 32))
        (const_int 1)) -1 (nil)
    (nil))

(insn 27 25 34 (set (reg:SI 25)
        (ashift:SI (reg/v:SI 21)
            (const_int 2))) -1 (nil)
    (nil))

(insn 34 27 35 (set (reg:SI 29)
        (mem/s:SI (plus:SI (mult:SI (reg:SI 32)
                    (const_int 4))
                (const_int 328)))) -1 (nil)
    (nil))


With a later increment of reg32.

Obviously the memory address at insn 34 has been scrogged.

jeff





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]