Boost logo

Boost :

Subject: Re: [boost] [XInt] Some after thoughts about SIMD
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2011-03-15 12:50:03


Dave Abrahams wrote:
> At Fri, 11 Mar 2011 12:04:15 -0800,
> Simonson, Lucanus J wrote:
>>
>>>
>>> More seriously, I fail to see an vector operation that is "limited
>>> by the language". I have very eager to see the one you speak about.
>>
>> If you have the same variable in more than one place in an
>> expression
>
> sometimes called "aliasing"
>
>> you can map that expression to different/fewer
>> instructions than if they were all different variables in different
>> places. There is no way to perform that mapping using expression
>> templates because it cannot be detected in template metaprogramming
>> which varaibles are the same, only that they have the same type.
>> Therefor you cannot map expression to the optimal instructions using
>> template metaprogramming.
>
> I beg to differ, at least most of the time. You can detect aliasing
> at runtime and choose an optimal implementation on that basis, and
> when the sameness of the two variables is information available to the
> compiler (as it often is), constant-folding and dead-code-elimination
> will throw away the test and the dead branch, leaving only the optimal
> code.

Clever. I like how you think.

If the two values happened not to be aliases I think the compiler would leave in the compare and branch, which isn't what we would want.

Regards,
Luke


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk