This is the mail archive of the gcc@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]

Re: Re-run of loop pass


Joern Rennecke writes:
 > > On a 2's complement machine, start is UINT_MAX, start + 5 is 4
 > > due to unsigned arithmetic, i is assigned -1, and j is assigned 0.
 > > The test fails immediately since an unsigned compare is performed
 > > and (unsigned int) -1 is not less than 4.  f() thus returns 0.
 > 
 > So what prevents yout patched compiler from unrolling he test case?

The loop gets completely unrolled but there is still a guard
instruction at the top of the loop to bypass the loop if necessary.

Here's the code for the c4x.

_f:
	ldiu	ar2,r0
	addi	5,r0
	cmpi3	r0,ar2
	bhsd	L3        <= unsigned delayed branch  (higher or same)
	ldiu	0,r1
	nop
	nop
	ldiu	5,r1
L3:
	ldiu	r1,r0
	rets

(Hmmm, looking at this code, there's a grand oppoprtunity for a
conditional load that was missed.)

Michael.


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