summaryrefslogtreecommitdiffstats
path: root/vec_sse_float1.h
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-09-01 23:45:23 -0400
committerErik Schnetter <schnetter@gmail.com>2013-09-01 23:45:23 -0400
commitae370822f291af84098b7d56721fa25b38b70a8b (patch)
tree82af54c76c8eef886938cef9d5e84ee1831905f7 /vec_sse_float1.h
parent0d32864cbff42a693f9b5c415642746797f5e9ff (diff)
downloadvecmathlib-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_float1.h')
-rw-r--r--vec_sse_float1.h35
1 files changed, 29 insertions, 6 deletions
diff --git a/vec_sse_float1.h b/vec_sse_float1.h
index a339cf5..2976275 100644
--- a/vec_sse_float1.h
+++ b/vec_sse_float1.h
@@ -185,28 +185,30 @@ 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 U(v) >> U(n); }
+
+ intvec_t lsr(int_t n) const { return U(v) >> U(n); }
+ intvec_t rotate(int_t n) const;
intvec operator>>(int_t n) const { return v>>n; }
intvec operator<<(int_t n) const { return 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 { return U(v) >> U(n); }
+ intvec_t lsr(intvec_t n) const { return U(v) >> U(n); }
+ intvec_t rotate(intvec_t n) const;
intvec operator>>(intvec n) const { return v>>n; }
intvec operator<<(intvec n) const { return v<<n; }
intvec& operator>>=(intvec n) { return *this=*this>>n; }
intvec& operator<<=(intvec n) { return *this=*this<<n; }
+ intvec_t clz() const { return __builtin_clz(v); }
+ intvec_t popcount() const { return __builtin_popcount(v); }
- boolvec_t signbit() const
- {
- return *this < IV(I(0));
- }
boolvec_t operator==(intvec const& x) const { return v==x.v; }
boolvec_t operator!=(intvec const& x) const { return v!=x.v; }
@@ -214,6 +216,11 @@ namespace vecmathlib {
boolvec_t operator<=(intvec const& x) const { return v<=x.v; }
boolvec_t operator>(intvec const& x) const { return v>x.v; }
boolvec_t operator>=(intvec const& x) const { return v>=x.v; }
+
+ intvec_t abs() const { return std::abs(v); }
+ boolvec_t isignbit() const { return v<0; }
+ intvec_t max(intvec_t x) const { return std::max(v, x.v); }
+ intvec_t min(intvec_t x) const { return std::min(v, x.v); }
};
@@ -546,12 +553,28 @@ namespace vecmathlib {
return FP::as_float(v);
}
+ inline intvec<float,1> intvec<float,1>::bitifthen(intvec_t x,
+ intvec_t y) const
+ {
+ return MF::vml_bitifthen(*this, x, y);
+ }
+
inline realvec<float,1> intvec<float,1>::convert_float() const
{
// return FP::convert_float(v);
return _mm_cvtss_f32(_mm_cvtsi32_ss(_mm_setzero_ps(), v));
}
+ inline intvec<float,1> intvec<float,1>::rotate(int_t n) const
+ {
+ return MF::vml_rotate(*this, n);
+ }
+
+ inline intvec<float,1> intvec<float,1>::rotate(intvec_t n) const
+ {
+ return MF::vml_rotate(*this, n);
+ }
+
} // namespace vecmathlib
#endif // #ifndef VEC_SSE_FLOAT1_H
OpenPOWER on IntegriCloud