[GHC] #7337: GHC does not generate great code for bit-level rotation

GHC ghc-devs at haskell.org
Sat Feb 27 02:06:57 UTC 2016


#7337: GHC does not generate great code for bit-level rotation
-------------------------------------+-------------------------------------
        Reporter:  bos               |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (NCG)    |              Version:  7.6.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by jberryman):

 FWIW I'm trying my hand at this, though it may take me a while as it's my
 first time working on GHC, and I'm not sure how much time I'll have to
 spend.

 It looks like I can take my lead from the byteswap patches (`git show
 5ae238504 da7db19 1c5b0511 c5d5e3ac 86ca77ecb`). Also I'm considering just
 implementing a rotateR primop since that's what ARM supports (I think) and
 my use case only has constant rotate values which I know GHC would
 simplify to a single instruction if Data.Bits.rotateL was implemented in
 terms of the rotateR primop. Hm, but that would be extra bad for people
 who have variable left rotate values which also might be `0`, because
 they's need to do a AND mask and a subtraction.

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


More information about the ghc-tickets mailing list