
#9659: Offer branchless conditional (CMOV) primop -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.3 Component: Compiler | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Description changed by dfeuer: Old description:
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`.
New description: I'd like to see something similar to C's `?:`, like {{{#!hs ifI#, boolI# :: Int# -> Int# -> Int# -> Int# }}} We could then write things like {{{#!hs ifI# (x <# y) 12# (x +# 17#) boolI# 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#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler