[GHC] #6135: Unboxed Booleans
GHC
ghc-devs at haskell.org
Tue Jun 11 23:18:00 CEST 2013
#6135: Unboxed Booleans
-------------------------------+--------------------------------------------
Reporter: benl | Owner: jstolarek
Type: feature request | Status: patch
Priority: normal | Milestone: 7.8.1
Component: Compiler | Version: 7.4.1
Resolution: | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Difficulty: Unknown
Testcase: | Blockedby:
Blocking: | Related: #605
-------------------------------+--------------------------------------------
Comment(by simonpj):
I think we should treat all Bool-returning primops identically. I think
it's just the `sameX` family of operators, and they can perfectly well
return `Int#` in the same way that `eqInt#` now does. Then you can
eliminate those cases from the codegen path, which is great.
One thing I'm puzzled about is this. If `>#` yields an `Int#`, how does
that `Int#` get into a register? Do we get code like
{{{
cmp x,y
bne L1
ld R1, 1
goto L2
L1: ld R1, 0
L2: ...now R1 has the Int#...
}}}
Getting the info from the status flags into a value, which we then compare
with 0, would be silly. How is this avoided? Esp when there are several
tests and you do logical operations on the `Int#`?
I looked on the wiki page
http://hackage.haskell.org/trac/ghc/wiki/PrimBool, but could not figure it
out. Maybe worth adding a section to explain this? Thanks
Simon
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6135#comment:69>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list