On 24 October 2012 18:12, jerro <span dir="ltr"><<a href="mailto:a@a.com" target="_blank">a@a.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Simple example:<br>
  T opCompound(string seq)(T a, T b, T c) if(seq == "* +") { return<br>
_madd(a, b, c); }<br>
</blockquote>
<br></div>
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:<br>


<br>
float4 foo(float4 a, float4 b, float4 c){ return a * b + c; }<br>
<br>
With gdc with flags -O2 -fma, you get:<br>
<br>
0000000000000000 <_<u></u>D3tmp3fooFNhG4fNhG4fNhG4fZNhG4<u></u>f>:<br>
   0:   c4 e2 69 98 c1          vfmadd132ps xmm0,xmm2,xmm1<br>
   5:   c3                      ret<br>
</blockquote></div><br><div>Right, I suspected GDC might do that, but it was just an example. You can extend that to many more complicated scenarios.</div><div>What does it do on less mature architectures like MIPS, PPC, ARM?</div>