add SSE2 versions of sin, cos, log, exp using code from Julien

Pommier. They are for float only, and they return exactly the same
result as the standard versions in about 90% of the cases. Otherwise the max error
is below 1e-7. However, for very large values (>1e3) the accuracy of sin and cos
slighlty decrease. They are about 3 or 4 times faster than 4 calls to their respective
standard versions. So, is it ok to enable them by default in their respective functors ?
This commit is contained in:
Gael Guennebaud
2009-03-25 12:26:13 +00:00
parent 64fbd93cd9
commit 17860e578c
6 changed files with 651 additions and 119 deletions

View File

@@ -45,8 +45,10 @@ typedef __vector __bool int v4bi;
#define USE_CONST_v1i_ const v4ui v1i_ = vec_splat_u32(-1)
#define USE_CONST_v0f_ USE_CONST_v1i_; const v4f v0f_ = (v4f) vec_sl(v1i_, v1i_)
template<> struct ei_packet_traits<float> { typedef v4f type; enum {size=4}; };
template<> struct ei_packet_traits<int> { typedef v4i type; enum {size=4}; };
template<> struct ei_packet_traits<float> : ei_default_packet_traits
{ typedef v4f type; enum {size=4}; };
template<> struct ei_packet_traits<int> : ei_default_packet_traits
{ typedef v4i type; enum {size=4}; };
template<> struct ei_unpacket_traits<v4f> { typedef float type; enum {size=4}; };
template<> struct ei_unpacket_traits<v4i> { typedef int type; enum {size=4}; };