Boost logo

Boost :

Subject: Re: [boost] [XInt] Some after thoughts about SIMD
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-03-12 07:16:32


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.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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