[GHC] #9251: ghc does not expose branchless max/min operations as primops

GHC ghc-devs at haskell.org
Thu Oct 4 22:47:00 UTC 2018


#9251: ghc does not expose branchless max/min operations as primops
-------------------------------------+-------------------------------------
        Reporter:  carter            |                Owner:  osa1
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.8.2
      Resolution:                    |             Keywords:  newcomer
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #9246             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 ​> His link above has a tiny example program using something called min##
 which is not defined there.

 Whoops! Sorry about that; I had just assumed there was a patch sitting
 there.

 As you suggest, I would start by thinking about providing primops; in
 particular I would start by focusing on `Int#` and `Word#`. As pointed out
 above, floating point is a whole can of worms.

 However, before this I would first try to show that such a primop would
 improve real code. Afterall, introducing a primop means that we are forced
 to maintain that primop for eternity. This carries a cost which we want to
 ensure would be justified by the benefits it brings.

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


More information about the ghc-tickets mailing list