[GHC] #1246: <= operators get compiled worse than ==
John Meacham
john at repetae.net
Tue Mar 27 00:15:35 EDT 2007
On Tue, Mar 27, 2007 at 12:41:30AM -0000, GHC wrote:
> Now we get {{{ case n <=# 0# of { True -> ...; False -> ...} }}}. We might
> hope that this gives us equivalent code in the backend but sadly it
> doesn't, the simple version is slower.
>
> We should be able to do better since at the cpu level calculating
> condition codes for == and <= is the same cost, just different
> instructions.
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.
though, there could be other things going on with ghc of course.
John
--
John Meacham - ⑆repetae.net⑆john⑈
More information about the Glasgow-haskell-bugs
mailing list