[macstl-dev] Proposal for mixed complex and real arithmetic
Ilya Lipovsky
lipovsky at skycomputers.com
Tue Jul 19 01:20:56 WST 2005
>
> The other possibility is to engineer a vec <complex <float>, 4> that
> contains 2 __vector floats, and restructure valarray <complex <float>
> > to use this. However I used to remember gcc 3.3 had a terrible time
> optimizing structs that contained more than 1 field, as vec <complex
> <float>, 4> would. If you do a test of this structure on 3.4 and it
> works acceptably, we can then change valarray <complex <float> > to
> use this.
>
> Quickly declare a simple vecComplexFloat4 struct with 2 __vector
> floats. Declare a operator+ that adds two vecComplexFloat4's. Then try
> this:
>
> vecComplexFloat4 a, b;
> vecComplexFloat4 c = (a + a + a) + (b + b + b);
>
> On 3.3, the usual thing would be that the compiler did a store and
> then a redundant load for each of the temps a + a etc. Try it on 3.4
> and 4.0 to see if that has changed. If you get positive results on 3.4
> and 4.0, we can adopt that approach instead -- A and B would be
> unchanged, but C would be simpler, at the cost of having to define up
> most of the vec <complex <float>, 4> operators.
And do you think it should lead to run-time overhead? I mean, if you're
working with only 2 floats at a time, you have to use lvsl/lvsr as
you're grabbing the same vector value twice in a loop.
-Ilya
More information about the macstl-dev
mailing list