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

GHC ghc-devs at haskell.org
Fri Jun 12 19:13:06 UTC 2015


#9251: ghc does not expose branchless max/min operations as primops
-------------------------------------+-------------------------------------
        Reporter:  carter            |                   Owner:
            Type:  task              |                  Status:  new
        Priority:  normal            |               Milestone:  7.12.1
       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 Revisions:
-------------------------------------+-------------------------------------

Comment (by osa1):

 I'm trying to understand this ticket; do we need to compile these
 functions:

 {{{
 minDbl :: Double -> Double -> Double
 minDbl !d1 !d2 = if d1 < d2 then d1 else d2

 minDbl' :: Double -> Double -> Double
 minDbl' !d1 !d2 = if d2 < d1 then d2 else d1
 }}}

 to branchless code(using `movsd` with right argument ordering, and
 similarly
 `movss` for `Float`), or are we only interested in branchless `Ord.min`,
 `Ord.max`
 etc.? E.g. something like this:

 {{{
 mindbl'' :: Double -> Double -> double
 mindbl'' (D# d1) (D# d2) = ... use new primop here ...
 }}}

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


More information about the ghc-tickets mailing list