Boost logo

Boost Users :

From: Joel FALCOU (joel.falcou_at_[hidden])
Date: 2008-03-01 06:28:21


Hello,

I've started using boost::proto "prototype" to leverage the kernel code of
my expression templates based library and I wanted to know how the
followign can be done.

Let's say such a statement is made :

matrix<float> a,b,c,r;
r = (a/b)+a+mul(b,c);

using Proto i was able to turn this into a SIMD aware code that use
SSE2 or Altivec (dependign on the platform) to operate.
However, in Altivec, the sub-expression a+mul(b,c) can be mapped to
a single, 3-ary vec_madd function that efficiently performs the mul-add
operations.
This replacement leads to a 80-90% incrase of performacnes compared to
chaining mul and add.

My question is : how can I use proto to detect such pattern (madd is an
example, there is a lot of such pattern in SIMD code)
and build a new expression in which the a+mul(b,c) expression is
replaced by the madd(a,b,c) expression ?

Thanks in advance.

PS : if this proto related question doesn't fit here, can someone
redirect me to the correct list or people ?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net