diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-09-02 13:48:45 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-09-02 13:48:45 -0400 |
commit | acae301f6613c57b120769717f11db05f2f7284c (patch) | |
tree | 6c1f07c7f0b3a40cadbfb00eb59af3b4d0bbdaaf | |
parent | cb309aa994a4488d7056f182b48668a423f0d5fe (diff) | |
download | vecmathlib-acae301f6613c57b120769717f11db05f2f7284c.zip vecmathlib-acae301f6613c57b120769717f11db05f2f7284c.tar.gz |
Correct new integer functions for Altivec/VSX
-rw-r--r-- | vec_altivec_float4.h | 41 | ||||
-rw-r--r-- | vec_vsx_double2.h | 41 |
2 files changed, 69 insertions, 13 deletions
diff --git a/vec_altivec_float4.h b/vec_altivec_float4.h index 26f798e..36f0281 100644 --- a/vec_altivec_float4.h +++ b/vec_altivec_float4.h @@ -201,15 +201,12 @@ namespace vecmathlib { intvec& operator|=(intvec const& x) { return *this=*this|x; } intvec& operator^=(intvec const& x) { return *this=*this^x; } - intvec_t bitifthen(intvec_t x, intvec_t y) const - { - return MF::vml_bitifthen(*this, x, y); - } + intvec_t bitifthen(intvec_t x, intvec_t y) const; intvec_t lsr(int_t n) const { return lsr(IV(n)); } - intvec_t rotate(int_t n) const { MF::vml_rotate(*this, n); } + intvec_t rotate(int_t n) const; intvec operator>>(int_t n) const { return *this >> IV(n); } intvec operator<<(int_t n) const { return *this << IV(n); } intvec& operator>>=(int_t n) { return *this=*this>>n; } @@ -219,7 +216,7 @@ namespace vecmathlib { { return vec_sr(v, (__vector unsigned int)n.v); } - intvec_t rotate(intvec_t n) const { MF::vml_rotate(*this, n); } + intvec_t rotate(intvec_t n) const; intvec operator>>(intvec n) const { return vec_sra(v, (__vector unsigned int)n.v); @@ -231,8 +228,8 @@ namespace vecmathlib { intvec& operator>>=(intvec n) { return *this=*this>>n; } intvec& operator<<=(intvec n) { return *this=*this<<n; } - intvec_t clz() const { return MF::vml_clz(*this); } - intvec_t popcount() const { return MF::vml_popcount(*this); } + intvec_t clz() const; + intvec_t popcount() const; @@ -244,9 +241,9 @@ namespace vecmathlib { boolvec_t operator>=(intvec const& x) const { return !(*this < x); } intvec_t abs() const { return vec_abs(v); } + boolvec_t isignbit() const { return (*this >> (bits-1)).as_bool(); } intvec_t max(intvec_t x) const { return vec_max(v, x.v); } intvec_t min(intvec_t x) const { return vec_min(v, x.v); } - boolvec_t isignbit() const { return MF::vml_isignbit(*this); } }; @@ -590,11 +587,37 @@ namespace vecmathlib { return (__vector float)v; } + inline intvec<float,4> intvec<float,4>::bitifthen(intvec_t x, + intvec_t y) const + { + return MF::vml_bitifthen(*this, x, y); + } + + inline intvec<float,4> intvec<float,4>::clz() const + { + return MF::vml_clz(*this); + } + inline realvec<float,4> intvec<float,4>::convert_float() const { return vec_ctf(v, 0); } + inline intvec<float,4> intvec<float,4>::popcount() const + { + return MF::vml_popcount(*this); + } + + inline intvec<float,4> intvec<float,4>::rotate(int_t n) const + { + return MF::vml_rotate(*this, n); + } + + inline intvec<float,4> intvec<float,4>::rotate(intvec_t n) const + { + return MF::vml_rotate(*this, n); + } + } // namespace vecmathlib #endif // #ifndef VEC_ALTIVEC_FLOAT4_H diff --git a/vec_vsx_double2.h b/vec_vsx_double2.h index 6505cdb..5104293 100644 --- a/vec_vsx_double2.h +++ b/vec_vsx_double2.h @@ -282,9 +282,12 @@ namespace vecmathlib { intvec& operator|=(intvec const& x) { return *this=*this|x; } intvec& operator^=(intvec const& x) { return *this=*this^x; } + intvec_t bitifthen(intvec_t x, intvec_t y) const; + intvec lsr(int_t n) const { return lsr(IV(n)); } + intvec_t rotate(int_t n) const; intvec operator>>(int_t n) const { return *this >> IV(n); } intvec operator<<(int_t n) const { return *this << IV(n); } intvec& operator>>=(int_t n) { return *this=*this>>n; } @@ -299,6 +302,7 @@ namespace vecmathlib { } return r; } + intvec_t rotate(intvec_t n) const; intvec operator>>(intvec n) const { // return vec_sra(v, (__vector unsigned long long)n.v); @@ -320,12 +324,10 @@ namespace vecmathlib { intvec& operator>>=(intvec n) { return *this=*this>>n; } intvec& operator<<=(intvec n) { return *this=*this<<n; } + intvec_t clz() const; + intvec_t popcount() const; - boolvec_t isignbit() const - { - return (*this >> (bits-1)).as_bool(); - } boolvec_t operator==(intvec const& x) const { @@ -364,6 +366,11 @@ namespace vecmathlib { { return ! (*this < x); } + + intvec_t abs() const { return vec_abs(v); } + boolvec_t isignbit() const { return (*this >> (bits-1)).as_bool(); } + intvec_t max(intvec_t x) const { return vec_max(v, x.v); } + intvec_t min(intvec_t x) const { return vec_min(v, x.v); } }; @@ -675,12 +682,38 @@ namespace vecmathlib { return (__vector double)v; } + inline intvec<float,4> intvec<float,4>::bitifthen(intvec_t x, + intvec_t y) const + { + return MF::vml_bitifthen(*this, x, y); + } + + inline intvec<double,2> intvec<double,2>::clz() const + { + return MF::vml_clz(*this); + } + inline realvec<double,2> intvec<double,2>::convert_float() const { // return vec_ctd(v, 0); return MF::vml_convert_float(*this); } + inline intvec<double,2> intvec<double,2>::popcount() const + { + return MF::vml_popcount(*this); + } + + inline intvec<double,2> intvec<double,2>::rotate(int_t n) const + { + return MF::vml_rotate(*this, n); + } + + inline intvec<double,2> intvec<double,2>::rotate(intvec_t n) const + { + return MF::vml_rotate(*this, n); + } + } // namespace vecmathlib #endif // #ifndef VEC_VSX_DOUBLE2_H |