Ternary operator in loop condition

Michael Hayes m.hayes@elec.canterbury.ac.nz
Sun Jan 31 23:58:00 GMT 1999

Jeffrey A Law writes:

 > I wonder if our time would be better spent trying to hoist this puppy out
 > of the loop or on something completely different.  There's a little bird
 > telling me we're not worrying about the common case for when we want to
 > unroll loops :-)

Right, this would be the more general and my preferred solution.
However, it's also the much harder problem to solve ;-(

Currently we do a pitiful job of hoisting invariants out of the loop
termination testing instructions and it's easy to overlook that the
termination testing code is executed every iteration.  If the
iteration count is invariant and can be hoisted out we've got a lot to


More information about the Gcc mailing list