diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-09-01 23:45:23 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-09-01 23:45:23 -0400 |
commit | ae370822f291af84098b7d56721fa25b38b70a8b (patch) | |
tree | 82af54c76c8eef886938cef9d5e84ee1831905f7 /vec_sse_float4.h | |
parent | 0d32864cbff42a693f9b5c415642746797f5e9ff (diff) | |
download | vecmathlib-ae370822f291af84098b7d56721fa25b38b70a8b.zip vecmathlib-ae370822f291af84098b7d56721fa25b38b70a8b.tar.gz |
Implement more integer functions: abs bitifthen clz isignbit max min popcount rotate
Rename integer signbit to isignbit to avoid name conflicts.
Diffstat (limited to 'vec_sse_float4.h')
-rw-r--r-- | vec_sse_float4.h | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/vec_sse_float4.h b/vec_sse_float4.h index 720cbcd..c8aa593 100644 --- a/vec_sse_float4.h +++ b/vec_sse_float4.h @@ -239,22 +239,26 @@ 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 _mm_srli_epi32(v, n); } + + intvec_t lsr(int_t n) const { return _mm_srli_epi32(v, n); } + intvec_t rotate(int_t n) const; intvec operator>>(int_t n) const { return _mm_srai_epi32(v, n); } intvec operator<<(int_t n) const { return _mm_slli_epi32(v, n); } intvec& operator>>=(int_t n) { return *this=*this>>n; } intvec& operator<<=(int_t n) { return *this=*this<<n; } - intvec lsr(intvec n) const + intvec_t lsr(intvec_t n) const { - intvec r; + intvec_t r; for (int i=0; i<size; ++i) { r.set_elt(i, U((*this)[i]) >> U(n[i])); } return r; } + intvec_t rotate(intvec_t n) const; intvec operator>>(intvec n) const { intvec r; @@ -274,12 +278,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 signbit() const - { - return as_bool(); - } boolvec_t operator==(intvec const& x) const { @@ -310,6 +312,11 @@ namespace vecmathlib { { return ! (*this < x); } + + intvec_t abs() const { return _mm_abs_epi32(v); } + boolvec_t isignbit() const { return as_bool(); } + intvec_t max(intvec_t x) const { return _mm_max_epi32(v, x.v); } + intvec_t min(intvec_t x) const { return _mm_min_epi32(v, x.v); } }; @@ -693,11 +700,37 @@ namespace vecmathlib { return _mm_castsi128_ps(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 _mm_cvtepi32_ps(v); } + 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_SSE_FLOAT4_H |