float vs double
Matthias Kretz
[please enable javascript to see the address]
Tue Aug 21 12:54:16 CEST 2012
On Tuesday 21 August 2012 10:42:38 Kulakov, Igor wrote:
> Meanwhile, could you recommend me something to move algorithms (like
> AliceTPCTracker) in double precision with Vc 0.6.1? I faced the problem
> that double_v and ushort_v lenght is different. Is there some work around?
> Currently I even don't care about speed.
There even isn't any other integer type with Size == double_v::Size. So even a
s/ushort_v/uint_v/ won't help you easily. You could try and build a wrapper
for double_v that wraps four double_v, to get sdouble_v::Size ==
ushort_v::Size == sfloat_v::Size (for SSE). For AVX you only want to wrap two
double_v.
#define do_four_times(_it_, code) \
{ enum { _it_ = 0 }; code } \
{ enum { _it_ = 1 }; code } \
{ enum { _it_ = 2 }; code } \
{ enum { _it_ = 3 }; code }
class sdouble_v
{
private:
double_v d[4];
public:
sdouble_v operator+(sdouble_v x)
{
sdouble_v r;
do_four_times(i,
r.d[i] = d[i] + x.d[i];
)
}
...
};
--
Dipl.-Phys. Matthias Kretz
http://compeng.uni-frankfurt.de/?mkretz
SIMD easy and portable: http://compeng.uni-frankfurt.de/?vc
More information about the Vc-devel
mailing list