#7014: RULES for bitwise logic and shift primops ---------------------------------+------------------------------------------ Reporter: akio | Owner: simonpj Type: feature request | Status: patch Priority: normal | Milestone: 7.6.1 Component: Compiler | Version: 7.4.2 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------
Comment(by simonpj): Paolo, I'm more or less happy with the patch, with the following suggestions: * The local function `primop_rule` now always returns a singleton list; any multi-rule stuff is done within that single rule. So I suggest making the top-level `primOpRule` function do the pattern matching, and return one rule: {{{ primOpRule :: PrimOp -> Name -> CoreRule primOpRule IntAddOp nm = mkPrimOpRule nm 2 [ binaryLit (intOp2 (+)) , identity zeroi ] ..etc... }}} * That turns `relop` and `rules` into top-level functions, which can have type signatures and helpful names. * I'd prefer to eta-expand `rules`. Otherwise the `msum` is a bit cryptic. * You may be able to use `convFloating` less often, by having a variant of `getLiteral` or whatever for floating, et `getFloatingLiteral`, used for floating primops. * Can you comment the `Int` argument of `getLiteral`? Then go ahead and commit. Thanks! Simon -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7014#comment:10> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs