Adding constant folding for Integer div and mod

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding constant folding for Integer div and mod

Jan Stolarek
It seems that currently there are no built-in constant folding rules for Integer div and mod. I plan on adding those rules, but before I do that I wanted to ask whether there is a good reason that these rules don't exist?

Janek



Reply | Threaded
Open this post in threaded view
|

Adding constant folding for Integer div and mod

Bryan O'Sullivan
On Fri, Jul 19, 2013 at 9:58 AM, Jan Stolarek <jan.stolarek at p.lodz.pl>wrote:

> It seems that currently there are no built-in constant folding rules for
> Integer div and mod. I plan on adding those rules, but before I do that I
> wanted to ask whether there is a good reason that these rules don't exist?
>

I would guess that Integer arithmetic doesn't affect people's performance
much, because a lot of people steer away from Integer. I'd be focusing my
attention on fixed-width numeric types and floating point, as likely to
have a much larger real-world impact.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130719/25f47e2b/attachment.htm>

Reply | Threaded
Open this post in threaded view
|

Adding constant folding for Integer div and mod

Carter Schonwald
that said, please be *conservative* on how  you optimize floats, i'd rather
not have accidental unexpected numerical instability.  Its much easier to
validate correctness of optimizations for Words and Ints rather than Floats
and Doubles, the latter are complicated critters


On Fri, Jul 19, 2013 at 1:25 PM, Bryan O'Sullivan <bos at serpentine.com>wrote:

>
> On Fri, Jul 19, 2013 at 9:58 AM, Jan Stolarek <jan.stolarek at p.lodz.pl>wrote:
>
>> It seems that currently there are no built-in constant folding rules for
>> Integer div and mod. I plan on adding those rules, but before I do that I
>> wanted to ask whether there is a good reason that these rules don't exist?
>>
>
> I would guess that Integer arithmetic doesn't affect people's performance
> much, because a lot of people steer away from Integer. I'd be focusing my
> attention on fixed-width numeric types and floating point, as likely to
> have a much larger real-world impact.
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130719/c2b8849d/attachment.htm>

Reply | Threaded
Open this post in threaded view
|

Adding constant folding for Integer div and mod

Ian Lynagh-2
In reply to this post by Jan Stolarek
On Fri, Jul 19, 2013 at 06:58:39PM +0200, Jan Stolarek wrote:
> It seems that currently there are no built-in constant folding rules for Integer div and mod. I plan on adding those rules, but before I do that I wanted to ask whether there is a good reason that these rules don't exist?

I can't think of one. If you discover one, please add it as a comment
where the rules would otherwise be.


Thanks
Ian
--
Ian Lynagh, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com/



Reply | Threaded
Open this post in threaded view
|

Adding constant folding for Integer div and mod

Jan Stolarek
> I can't think of one. If you discover one, please add it as a comment
> where the rules would otherwise be.
I already added the rules because it was very straightforward - they are bundled in the patches
for #6135.

Janek