On Mon, Mar 26, 2007 at 09:23:13PM -0700, Stefan O'Rear wrote:
> On Mon, Mar 26, 2007 at 09:15:35PM -0700, John Meacham wrote:
> > actually, this is not true for the specific case of testing against zero
> > on x86 at least. there is a 'zero flag' that is set whenever the result
> > of an operation is zero. whereas for compares, you actually need to load
> > zero into a register and cmp against it.
>
> Uh, you mean normal operations don't set the sign flag? (I'm just an
> assembly programmer and am perfectly willing to defer to a compiler
> writer on such issues, but it seems like a strange assertion...)
They certainly do, but in this particular case, the 'decrement' (n - 1)
happens to set the zero flag if n is one so we get that comparison for
free. We don't have a flag which immediately tells us whether n <= 0
however so we have to perform that comparison separately.
John
--
John Meacham - ⑆repetae.net⑆john⑈
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs