summaryrefslogtreecommitdiffstats
path: root/vec_sse_float1.h
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-09-02 23:01:06 -0400
committerErik Schnetter <schnetter@gmail.com>2013-09-02 23:01:06 -0400
commit3ceeb3729cf510ba5c27a1d90d0ff31d0e90c158 (patch)
tree47e7582ebda9c019f22cec1e1cff2011e0645b9d /vec_sse_float1.h
parent46a79cb4547463b1f4b6269507954c68bd402d6b (diff)
downloadvecmathlib-3ceeb3729cf510ba5c27a1d90d0ff31d0e90c158.zip
vecmathlib-3ceeb3729cf510ba5c27a1d90d0ff31d0e90c158.tar.gz
SSE/AVX: Use nicer type names
Diffstat (limited to 'vec_sse_float1.h')
-rw-r--r--vec_sse_float1.h215
1 files changed, 112 insertions, 103 deletions
diff --git a/vec_sse_float1.h b/vec_sse_float1.h
index bfc90d9..f038cd6 100644
--- a/vec_sse_float1.h
+++ b/vec_sse_float1.h
@@ -78,7 +78,7 @@ namespace vecmathlib {
operator bvector_t() const { return v; }
bool operator[](int n) const { return v; }
- boolvec& set_elt(int n, bool a) { return v=a, *this; }
+ boolvec_t& set_elt(int n, bool a) { return v=a, *this; }
@@ -87,12 +87,12 @@ namespace vecmathlib {
- boolvec operator!() const { return !v; }
+ boolvec_t operator!() const { return !v; }
- boolvec operator&&(boolvec x) const { return v && x.v; }
- boolvec operator||(boolvec x) const { return v || x.v; }
- boolvec operator==(boolvec x) const { return bool(v) == bool(x.v); }
- boolvec operator!=(boolvec x) const { return bool(v) != bool(x.v); }
+ boolvec_t operator&&(boolvec_t x) const { return v && x.v; }
+ boolvec_t operator||(boolvec_t x) const { return v || x.v; }
+ boolvec_t operator==(boolvec_t x) const { return bool(v) == bool(x.v); }
+ boolvec_t operator!=(boolvec_t x) const { return bool(v) != bool(x.v); }
bool all() const { return *this; }
bool any() const { return *this; }
@@ -143,11 +143,11 @@ namespace vecmathlib {
// intvec& operator=(intvec const& x) { return v=x.v, *this; }
intvec(int_t a): v(a) {}
intvec(int_t const* as): v(as[0]) {}
- static intvec iota() { return intvec(I(0)); }
+ static intvec_t iota() { return intvec(I(0)); }
operator ivector_t() const { return v; }
int_t operator[](int n) const { return v; }
- intvec& set_elt(int n, int_t a) { return v=a, *this; }
+ intvec_t& set_elt(int n, int_t a) { return v=a, *this; }
@@ -158,32 +158,32 @@ namespace vecmathlib {
- intvec operator+() const { return +v; }
- intvec operator-() const { return -v; }
+ intvec_t operator+() const { return +v; }
+ intvec_t operator-() const { return -v; }
- intvec operator+(intvec x) const { return v+x.v; }
- intvec operator-(intvec x) const { return v-x.v; }
- intvec operator*(intvec x) const { return v*x.v; }
- intvec operator/(intvec x) const { return v/x.v; }
- intvec operator%(intvec x) const { return v%x.v; }
+ intvec_t operator+(intvec_t x) const { return v+x.v; }
+ intvec_t operator-(intvec_t x) const { return v-x.v; }
+ intvec_t operator*(intvec_t x) const { return v*x.v; }
+ intvec_t operator/(intvec_t x) const { return v/x.v; }
+ intvec_t operator%(intvec_t x) const { return v%x.v; }
- intvec& operator+=(intvec const& x) { return *this=*this+x; }
- intvec& operator-=(intvec const& x) { return *this=*this-x; }
- intvec& operator*=(intvec const& x) { return *this=*this*x; }
- intvec& operator/=(intvec const& x) { return *this=*this/x; }
- intvec& operator%=(intvec const& x) { return *this=*this%x; }
+ intvec_t& operator+=(intvec_t const& x) { return *this=*this+x; }
+ intvec_t& operator-=(intvec_t const& x) { return *this=*this-x; }
+ intvec_t& operator*=(intvec_t const& x) { return *this=*this*x; }
+ intvec_t& operator/=(intvec_t const& x) { return *this=*this/x; }
+ intvec_t& operator%=(intvec_t const& x) { return *this=*this%x; }
- intvec operator~() const { return ~v; }
+ intvec_t operator~() const { return ~v; }
- intvec operator&(intvec x) const { return v&x.v; }
- intvec operator|(intvec x) const { return v|x.v; }
- intvec operator^(intvec x) const { return v^x.v; }
+ intvec_t operator&(intvec_t x) const { return v&x.v; }
+ intvec_t operator|(intvec_t x) const { return v|x.v; }
+ intvec_t operator^(intvec_t x) const { return v^x.v; }
- intvec& operator&=(intvec const& x) { return *this=*this&x; }
- intvec& operator|=(intvec const& x) { return *this=*this|x; }
- intvec& operator^=(intvec const& x) { return *this=*this^x; }
+ intvec_t& operator&=(intvec_t const& x) { return *this=*this&x; }
+ intvec_t& operator|=(intvec_t const& x) { return *this=*this|x; }
+ intvec_t& operator^=(intvec_t const& x) { return *this=*this^x; }
intvec_t bitifthen(intvec_t x, intvec_t y) const;
@@ -191,31 +191,31 @@ namespace vecmathlib {
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_t operator>>(int_t n) const { return v>>n; }
+ intvec_t 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_t& operator>>=(int_t n) { return *this=*this>>n; }
+ intvec_t& operator<<=(int_t n) { return *this=*this<<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_t operator>>(intvec_t n) const { return v>>n; }
+ intvec_t operator<<(intvec_t n) const { return v<<n; }
- intvec& operator>>=(intvec n) { return *this=*this>>n; }
- intvec& operator<<=(intvec n) { return *this=*this<<n; }
+ intvec_t& operator>>=(intvec_t n) { return *this=*this>>n; }
+ intvec_t& operator<<=(intvec_t n) { return *this=*this<<n; }
intvec_t clz() const { return __builtin_clz(v); }
intvec_t popcount() const { return __builtin_popcount(v); }
- 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; }
- 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; }
+ boolvec_t operator==(intvec_t const& x) const { return v==x.v; }
+ boolvec_t operator!=(intvec_t const& x) const { return v!=x.v; }
+ boolvec_t operator<(intvec_t const& x) const { return v<x.v; }
+ boolvec_t operator<=(intvec_t const& x) const { return v<=x.v; }
+ boolvec_t operator>(intvec_t const& x) const { return v>x.v; }
+ boolvec_t operator>=(intvec_t const& x) const { return v>=x.v; }
intvec_t abs() const { return std::abs(v); }
boolvec_t isignbit() const { return v<0; }
@@ -272,7 +272,7 @@ namespace vecmathlib {
operator vector_t() const { return v; }
real_t operator[](int n) const { return v; }
- realvec& set_elt(int n, real_t a) { return v=a, *this; }
+ realvec_t& set_elt(int n, real_t a) { return v=a, *this; }
@@ -358,18 +358,18 @@ namespace vecmathlib {
- realvec operator+() const { return +v; }
- realvec operator-() const { return -v; }
+ realvec_t operator+() const { return +v; }
+ realvec_t operator-() const { return -v; }
- realvec operator+(realvec x) const { return v+x.v; }
- realvec operator-(realvec x) const { return v-x.v; }
- realvec operator*(realvec x) const { return v*x.v; }
- realvec operator/(realvec x) const { return v/x.v; }
+ realvec_t operator+(realvec_t x) const { return v+x.v; }
+ realvec_t operator-(realvec_t x) const { return v-x.v; }
+ realvec_t operator*(realvec_t x) const { return v*x.v; }
+ realvec_t operator/(realvec_t x) const { return v/x.v; }
- realvec& operator+=(realvec const& x) { return *this=*this+x; }
- realvec& operator-=(realvec const& x) { return *this=*this-x; }
- realvec& operator*=(realvec const& x) { return *this=*this*x; }
- realvec& operator/=(realvec const& x) { return *this=*this/x; }
+ realvec_t& operator+=(realvec_t const& x) { return *this=*this+x; }
+ realvec_t& operator-=(realvec_t const& x) { return *this=*this-x; }
+ realvec_t& operator*=(realvec_t const& x) { return *this=*this*x; }
+ realvec_t& operator/=(realvec_t const& x) { return *this=*this/x; }
real_t maxval() const { return *this; }
real_t minval() const { return *this; }
@@ -378,24 +378,24 @@ namespace vecmathlib {
- boolvec_t operator==(realvec const& x) const { return v==x.v; }
- boolvec_t operator!=(realvec const& x) const { return v!=x.v; }
- boolvec_t operator<(realvec const& x) const { return v<x.v; }
- boolvec_t operator<=(realvec const& x) const { return v<=x.v; }
- boolvec_t operator>(realvec const& x) const { return v>x.v; }
- boolvec_t operator>=(realvec const& x) const { return v>=x.v; }
+ boolvec_t operator==(realvec_t const& x) const { return v==x.v; }
+ boolvec_t operator!=(realvec_t const& x) const { return v!=x.v; }
+ boolvec_t operator<(realvec_t const& x) const { return v<x.v; }
+ boolvec_t operator<=(realvec_t const& x) const { return v<=x.v; }
+ boolvec_t operator>(realvec_t const& x) const { return v>x.v; }
+ boolvec_t operator>=(realvec_t const& x) const { return v>=x.v; }
- realvec acos() const { return MF::vml_acos(*this); }
- realvec acosh() const { return MF::vml_acosh(*this); }
- realvec asin() const { return MF::vml_asin(*this); }
- realvec asinh() const { return MF::vml_asinh(*this); }
- realvec atan() const { return MF::vml_atan(*this); }
- realvec atan2(realvec y) const { return MF::vml_atan2(*this, y); }
- realvec atanh() const { return MF::vml_atanh(*this); }
- realvec cbrt() const { return MF::vml_cbrt(*this); }
- realvec ceil() const
+ realvec_t acos() const { return MF::vml_acos(*this); }
+ realvec_t acosh() const { return MF::vml_acosh(*this); }
+ realvec_t asin() const { return MF::vml_asin(*this); }
+ realvec_t asinh() const { return MF::vml_asinh(*this); }
+ realvec_t atan() const { return MF::vml_atan(*this); }
+ realvec_t atan2(realvec_t y) const { return MF::vml_atan2(*this, y); }
+ realvec_t atanh() const { return MF::vml_atanh(*this); }
+ realvec_t cbrt() const { return MF::vml_cbrt(*this); }
+ realvec_t ceil() const
{
#ifdef __SSE4_1__
return to_float(_mm_ceil_ss(from_float(v), from_float(v)));
@@ -403,16 +403,16 @@ namespace vecmathlib {
return vml_std::ceil(v);
#endif
}
- realvec copysign(realvec y) const { return vml_std::copysign(v, y.v); }
- realvec cos() const { return MF::vml_cos(*this); }
- realvec cosh() const { return MF::vml_cosh(*this); }
- realvec exp() const { return MF::vml_exp(*this); }
- realvec exp10() const { return MF::vml_exp10(*this); }
- realvec exp2() const { return MF::vml_exp2(*this); }
- realvec expm1() const { return MF::vml_expm1(*this); }
- realvec fabs() const { return vml_std::fabs(v); }
- realvec fdim(realvec y) const { return MF::vml_fdim(*this, y); }
- realvec floor() const
+ realvec_t copysign(realvec_t y) const { return vml_std::copysign(v, y.v); }
+ realvec_t cos() const { return MF::vml_cos(*this); }
+ realvec_t cosh() const { return MF::vml_cosh(*this); }
+ realvec_t exp() const { return MF::vml_exp(*this); }
+ realvec_t exp10() const { return MF::vml_exp10(*this); }
+ realvec_t exp2() const { return MF::vml_exp2(*this); }
+ realvec_t expm1() const { return MF::vml_expm1(*this); }
+ realvec_t fabs() const { return vml_std::fabs(v); }
+ realvec_t fdim(realvec_t y) const { return MF::vml_fdim(*this, y); }
+ realvec_t floor() const
{
#ifdef __SSE4_1__
return to_float(_mm_floor_ss(from_float(v), from_float(v)));
@@ -420,27 +420,30 @@ namespace vecmathlib {
return vml_std::floor(v);
#endif
}
- realvec fma(realvec y, realvec z) const { return MF::vml_fma(*this, y, z); }
- realvec fmax(realvec y) const
+ realvec_t fma(realvec_t y, realvec_t z) const
+ {
+ return MF::vml_fma(*this, y, z);
+ }
+ realvec_t fmax(realvec_t y) const
{
return to_float(_mm_max_ss(from_float(v), from_float(y.v)));
}
- realvec fmin(realvec y) const
+ realvec_t fmin(realvec_t y) const
{
return to_float(_mm_min_ss(from_float(v), from_float(y.v)));
}
- realvec fmod(realvec y) const { return vml_std::fmod(v, y.v); }
- realvec frexp(intvec_t* irp) const
+ realvec_t fmod(realvec_t y) const { return vml_std::fmod(v, y.v); }
+ realvec_t frexp(intvec_t* irp) const
{
int iri;
- realvec r = vml_std::frexp(v, &iri);
+ realvec_t r = vml_std::frexp(v, &iri);
int_t ir = iri;
if (isinf()) ir = std::numeric_limits<int_t>::max();
if (isnan()) ir = std::numeric_limits<int_t>::min();
irp->v = ir;
return r;
}
- realvec hypot(realvec y) const { return MF::vml_hypot(*this, y); }
+ realvec_t hypot(realvec_t y) const { return MF::vml_hypot(*this, y); }
intvec_t ilogb() const
{
int_t r = vml_std::ilogb(v);
@@ -476,17 +479,23 @@ namespace vecmathlib {
#endif
}
boolvec_t isnormal() const { return vml_std::isnormal(v); }
- realvec ldexp(int_t n) const { return vml_std::ldexp(v, n); }
- realvec ldexp(intvec_t n) const { return vml_std::ldexp(v, n); }
- realvec log() const { return MF::vml_log(*this); }
- realvec log10() const { return MF::vml_log10(*this); }
- realvec log1p() const { return MF::vml_log1p(*this); }
- realvec log2() const { return MF::vml_log2(*this); }
- realvec nextafter(realvec y) const { return MF::vml_nextafter(*this, y); }
- realvec pow(realvec y) const { return MF::vml_pow(*this, y); }
- realvec rcp() const { return R(1.0)/v; }
- realvec remainder(realvec y) const { return vml_std::remainder(v, y.v); }
- realvec rint() const
+ realvec_t ldexp(int_t n) const { return vml_std::ldexp(v, n); }
+ realvec_t ldexp(intvec_t n) const { return vml_std::ldexp(v, n); }
+ realvec_t log() const { return MF::vml_log(*this); }
+ realvec_t log10() const { return MF::vml_log10(*this); }
+ realvec_t log1p() const { return MF::vml_log1p(*this); }
+ realvec_t log2() const { return MF::vml_log2(*this); }
+ realvec_t nextafter(realvec_t y) const
+ {
+ return MF::vml_nextafter(*this, y);
+ }
+ realvec_t pow(realvec_t y) const { return MF::vml_pow(*this, y); }
+ realvec_t rcp() const { return R(1.0)/v; }
+ realvec_t remainder(realvec_t y) const
+ {
+ return vml_std::remainder(v, y.v);
+ }
+ realvec_t rint() const
{
#ifdef __SSE4_1__
return to_float(_mm_round_ss(from_float(v), from_float(v),
@@ -495,15 +504,15 @@ namespace vecmathlib {
return MF::vml_rint(*this);
#endif
}
- realvec round() const { return MF::vml_round(*this); }
- realvec rsqrt() const { return MF::vml_rsqrt(*this); }
+ realvec_t round() const { return MF::vml_round(*this); }
+ realvec_t rsqrt() const { return MF::vml_rsqrt(*this); }
boolvec_t signbit() const { return vml_std::signbit(v); }
- realvec sin() const { return MF::vml_sin(*this); }
- realvec sinh() const { return MF::vml_sinh(*this); }
- realvec sqrt() const { return to_float(_mm_sqrt_ss(from_float(v))); }
- realvec tan() const { return MF::vml_tan(*this); }
- realvec tanh() const { return MF::vml_tanh(*this); }
- realvec trunc() const
+ realvec_t sin() const { return MF::vml_sin(*this); }
+ realvec_t sinh() const { return MF::vml_sinh(*this); }
+ realvec_t sqrt() const { return to_float(_mm_sqrt_ss(from_float(v))); }
+ realvec_t tan() const { return MF::vml_tan(*this); }
+ realvec_t tanh() const { return MF::vml_tanh(*this); }
+ realvec_t trunc() const
{
#ifdef __SSE4_1__
return to_float(_mm_round_ss(from_float(v), from_float(v),
OpenPOWER on IntegriCloud