[GHC] #6135: Unboxed Booleans

GHC ghc-devs at haskell.org
Thu Jun 12 22:45:21 UTC 2014


#6135: Unboxed Booleans
---------------------------------------------+-----------------------------
        Reporter:  benl                      |            Owner:  jstolarek
            Type:  feature request           |           Status:  closed
        Priority:  normal                    |        Milestone:  7.8.1
       Component:  Compiler                  |          Version:  7.4.1
      Resolution:  fixed                     |         Keywords:
Operating System:  Unknown/Multiple          |     Architecture:
 Type of failure:  None/Unknown              |  Unknown/Multiple
       Test Case:  primops/should_run/T6135  |       Difficulty:  Unknown
        Blocking:                            |       Blocked By:  8103,
                                             |  8103
                                             |  Related Tickets:  #605
---------------------------------------------+-----------------------------

Comment (by altaic):

 Replying to [comment:91 Lemming]:
 > Replying to [comment:90 carter]:
 > > @lemming, Bool# is now Int# afaik, could you explain what you mean?
 even if we used a i1 rep, it still needs a full register! So theres no
 lost for the in register rep to be Int#, afaik
 >
 > `Int#` represents a large range of integers, whereas `i1` in LLVM has
 only values 0 and 1. That is, LLVM can optimize based on the knowledge of
 the restricted value set of `i1`, but it certainly fails to do so on `i32`
 or `i64`.

 Two of the advantages in representing Bool# as an i1 is that llvm can
 vectorize them, and arrays of i1 can fit in an i32 or i64. Off the top of
 my head, I don't know of any software that makes use of large arrays of
 booleans, but in that case this sort of optimization would likely be very
 effective.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/6135#comment:92>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list