This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
loop patches
- To: rth at cygnus dot com
- Subject: loop patches
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Sun, 31 May 1998 23:31:11 -0600
- Cc: egcs-patches at cygnus dot com
- Reply-To: law at cygnus dot com
I'm looking into getting your loop patches running on an x86.
Check this out:
(insn 4492 4491 4494 (set (reg:SI 900)
(ashift:SI (reg/v:SI 27)
(const_int 2))) 229 {ashlsi3} (nil)
(nil))
(insn 4494 4492 4497 (set (reg:SI 901)
(plus:SI (reg:SI 6 %ebp)
(const_int -448))) 142 {addsi3+1} (nil)
(nil))
(insn 4497 4494 4499 (set (reg:SI 903)
(plus:SI (reg:SI 6 %ebp)
(const_int -332))) 142 {addsi3+1} (nil)
(nil))
(insn 4499 4497 4500 (set (reg:SI 904)
(mem/s:SI (plus:SI (reg:SI 903)
(reg:SI 900)))) 53 {movsi+2} (nil)
(nil))
Insn 4494 isn't relavent, so ignore it.
reg27 is the loop counter, reg 903 holds the address of the first
element in an array we're going to walk through, reg 900 is the
offset into the array.
Pretty simple.
After loop optimization it gets turned into:
(insn 8417 8411 4483 (set (reg:SI 1989)
(plus:SI (reg:SI 6 %ebp)
(const_int -604))) -1 (nil)
(nil))
(note 4483 8417 4489 "" NOTE_INSN_LOOP_BEG)
(code_label 4489 4483 4490 1011 "")
(note 4490 4489 4491 ("/puke/law/egcs/egcs/gcc/reload.c") 3444)
(note 4491 4490 4492 "" NOTE_INSN_DELETED)
(insn 4492 4491 4499 (set (reg:SI 900)
(ashift:SI (reg/v:SI 27)
(const_int 2))) -1 (nil)
(nil))
(insn 4499 4492 4500 (set (reg:SI 904)
(mem/s:SI (plus:SI (mult:SI (reg:SI 1989)
(const_int 4))
(const_int 2084)))) -1 (nil)
(nil))
[ ... ]
Later in the loop reg 1989 gets incremented by one.
The address for the memory reference is totally bogus.
I don't know if this is enough to help you pinpoint the problem,
but then again, maybe it is.
jeff