On 24 October 2012 18:12, jerro <a...@a.com> wrote:

>  Simple example:
>>   T opCompound(string seq)(T a, T b, T c) if(seq == "* +") { return
>> _madd(a, b, c); }
>>
>
> It may be useful to have a way to define compound operators for other
> things (although you can already write expression templates), but this is
> an optimization that the compiler back end can do. If you compile this code:
>
> float4 foo(float4 a, float4 b, float4 c){ return a * b + c; }
>
> With gdc with flags -O2 -fma, you get:
>
> 0000000000000000 <_**D3tmp3fooFNhG4fNhG4fNhG4fZNhG4**f>:
>    0:   c4 e2 69 98 c1          vfmadd132ps xmm0,xmm2,xmm1
>    5:   c3                      ret
>

Right, I suspected GDC might do that, but it was just an example. You can
extend that to many more complicated scenarios.
What does it do on less mature architectures like MIPS, PPC, ARM?

Reply via email to