[GHC] #9340: Implement new `clz` inline primop

GHC ghc-devs at haskell.org
Thu Aug 14 10:29:37 UTC 2014


#9340: Implement new `clz` inline primop
-------------------------------------+-------------------------------------
              Reporter:  hvr         |            Owner:  hvr
                  Type:  feature     |           Status:  patch
  request                            |        Milestone:  7.10.1
              Priority:  normal      |          Version:  7.8.2
             Component:  Compiler    |         Keywords:  primop clz
  (CodeGen)                          |     Architecture:  Unknown/Multiple
            Resolution:              |       Difficulty:  Unknown
      Operating System:              |       Blocked By:
  Unknown/Multiple                   |  Related Tickets:
       Type of failure:              |
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:  Phab:D144   |
-------------------------------------+-------------------------------------

Comment (by Herbert Valerio Riedel <hvr@…>):

 In [changeset:"e0c1767d0ea8d12e0a4badf43682a08784e379c6/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="e0c1767d0ea8d12e0a4badf43682a08784e379c6"
 Implement new CLZ and CTZ primops (re #9340)

 This implements the new primops

   clz#, clz32#, clz64#,
   ctz#, ctz32#, ctz64#

 which provide efficient implementations of the popular
 count-leading-zero and count-trailing-zero respectively
 (see testcase for a pure Haskell reference implementation).

 On x86, NCG as well as LLVM generates code based on the BSF/BSR
 instructions (which need extra logic to make the 0-case well-defined).

 Test Plan: validate and succesful tests on i686 and amd64

 Reviewers: rwbarton, simonmar, ezyang, austin

 Subscribers: simonmar, relrod, ezyang, carter

 Differential Revision: https://phabricator.haskell.org/D144

 GHC Trac Issues: #9340
 }}}

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


More information about the ghc-tickets mailing list