[GHC] #9659: Offer branchless conditional (CMOV) primop

GHC ghc-devs at haskell.org
Thu Oct 2 21:07:18 UTC 2014


#9659: Offer branchless conditional (CMOV) primop
-------------------------------------+-------------------------------------
       Reporter:  dfeuer             |                   Owner:
           Type:  feature request    |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.8.3
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:
     Blocked By:                     |  None/Unknown
Related Tickets:                     |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 I'd like to see something similar to C's `?:`, like

 {{{#!hs
 ifInt#, boolInt# :: Int# -> Int# -> Int# -> Int#
 }}}

 We could then write things like

 {{{#!hs
 ifInt# (x <# y) 12# (x +# 17#)
 boolInt# potato cannon (y ># 2)
 }}}

 When the value of the test is difficult to predict, this would be better
 than the usual branching `if` or `case`.

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


More information about the ghc-tickets mailing list