[Haskell] Expecting more inlining for bit shifting

roconnor at theorem.ca roconnor at theorem.ca
Wed Oct 18 07:00:18 EDT 2006

On Tue, 17 Oct 2006, John Meacham wrote:

> On Mon, Oct 09, 2006 at 03:54:41PM +0100, Ian Lynagh wrote:
>> It might be possible, but it sounds tricky. I guess it would have to go
>> something like "try inlining this, run the simplifier, see if it got
>> small enough, if not back out", which could waste a lot of work if it
>> fails in lots of cases.
> I would think the easiest way to go about this would be to extend the
> rules pragma.
> {-# RULES "shift/const-inline"  forall x y# . shift x y# = ... #-}

I'm not sure this approach is best.  In my case the ... needs to be the 
entire body of the shift code.  It would be ridiculous to have two copies 
of the same code.  What would be better is a hint pragma that says, 
``inline me if the following set of parameters are literals''.

Russell O'Connor                                      <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''

More information about the Glasgow-haskell-users mailing list