[OT] compiler optimisations

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 23 23:29:54 PDT 2015


On Thursday, 23 April 2015 at 10:23:57 UTC, Andrea Fontana wrote:
> On Thursday, 23 April 2015 at 10:08:24 UTC, John Colvin wrote:
>>> asm.dlang.org
>>
>> and d.godbolt.org
>>
>> This isn't a D-specific question though, so gcc.godbolt.org 
>> would allow you to test a wider range of backends.
>
> I was wondering if compilers can optimize this:
>
> uint foo3(uint a)
> {
>   return a*!(a/5);
> }
>
> That actually gives the same results.

That is cool ! However, careful, division can stall the pipeline.


More information about the Digitalmars-d mailing list