summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-08-18 20:37:04 -0400
committerErik Schnetter <schnetter@gmail.com>2013-08-18 20:37:04 -0400
commit0cce57bb7e6b446e079d9a6496f3a0ced65ce58b (patch)
tree5aced371687f2358ad8a36891f80de2feb63471d
parenteddceff67f561ffa74b954fa7f32a32a0a49a088 (diff)
downloadvecmathlib-0cce57bb7e6b446e079d9a6496f3a0ced65ce58b.zip
vecmathlib-0cce57bb7e6b446e079d9a6496f3a0ced65ce58b.tar.gz
QPX: Undo using const& to pass QPX vectors
I hear that the QPX API does allow passing structs containing a single vector in a vector register.
-rw-r--r--vec_qpx_double4.h132
1 files changed, 66 insertions, 66 deletions
diff --git a/vec_qpx_double4.h b/vec_qpx_double4.h
index ac6f7b5..0bd5ba5 100644
--- a/vec_qpx_double4.h
+++ b/vec_qpx_double4.h
@@ -69,7 +69,7 @@ namespace vecmathlib {
// efficient on PowerPC, which won't pass them in registers
// TODO: do this for all PowerPC vector architectures (Altivec,
// VSX)
- boolvec(const bvector_t& x): v(x) {}
+ boolvec(bvector_t x): v(x) {}
boolvec(bool a): v(vec_splats(from_bool(a))) {}
boolvec(const bool* as)
{
@@ -95,13 +95,13 @@ namespace vecmathlib {
boolvec operator!() const { return vec_not(v); }
- boolvec operator&&(const boolvec& x) const { return vec_and(v, x.v); }
- boolvec operator||(const boolvec& x) const { return vec_or(v, x.v); }
- boolvec operator==(const boolvec& x) const
+ boolvec operator&&(boolvec x) const { return vec_and(v, x.v); }
+ boolvec operator||(boolvec x) const { return vec_or(v, x.v); }
+ boolvec operator==(boolvec x) const
{
return vec_logical(v, x.v, 0x9);
}
- boolvec operator!=(const boolvec& x) const { return vec_xor(v, x.v); }
+ boolvec operator!=(boolvec x) const { return vec_xor(v, x.v); }
bool all() const
{
@@ -123,9 +123,9 @@ namespace vecmathlib {
// ifthen(condition, then-value, else-value)
- boolvec_t ifthen(const boolvec_t& x, const boolvec_t& y) const;
- intvec_t ifthen(const intvec_t& x, const intvec_t& y) const; // defined after intvec
- realvec_t ifthen(const realvec_t& x, const realvec_t& y) const; // defined after realvec
+ boolvec_t ifthen(boolvec_t x, boolvec_t y) const;
+ intvec_t ifthen(intvec_t x, intvec_t y) const; // defined after intvec
+ realvec_t ifthen(realvec_t x, realvec_t y) const; // defined after realvec
};
@@ -164,7 +164,7 @@ namespace vecmathlib {
// be passed in registers
// intvec(const intvec& x): v(x.v) {}
// intvec& operator=(const intvec& x) { return v=x.v, *this; }
- intvec(const ivector_t& x): v(x) {}
+ intvec(ivector_t x): v(x) {}
intvec(int_t a): v(vec_splats(FP::as_float(a))) {}
intvec(const int_t* as)
{
@@ -204,21 +204,21 @@ namespace vecmathlib {
return r;
}
- intvec operator+(const intvec& x) const
+ intvec operator+(intvec x) const
{
intvec r;
for (int d=0; d<size; ++d) r.set_elt(d, (*this)[d] + x[d]);
return r;
}
- intvec operator-(const intvec& x) const
+ intvec operator-(intvec x) const
{
intvec r;
for (int d=0; d<size; ++d) r.set_elt(d, (*this)[d] - x[d]);
return r;
}
- intvec& operator+=(const intvec& x) { return *this=*this+x; }
- intvec& operator-=(const intvec& x) { return *this=*this-x; }
+ intvec& operator+=(intvec x) { return *this=*this+x; }
+ intvec& operator-=(intvec x) { return *this=*this-x; }
@@ -229,28 +229,28 @@ namespace vecmathlib {
return r;
}
- intvec operator&(const intvec& x) const
+ intvec operator&(intvec x) const
{
intvec r;
for (int d=0; d<size; ++d) r.set_elt(d, (*this)[d] & x[d]);
return r;
}
- intvec operator|(const intvec& x) const
+ intvec operator|(intvec x) const
{
intvec r;
for (int d=0; d<size; ++d) r.set_elt(d, (*this)[d] | x[d]);
return r;
}
- intvec operator^(const intvec& x) const
+ intvec operator^(intvec x) const
{
intvec r;
for (int d=0; d<size; ++d) r.set_elt(d, (*this)[d] ^ x[d]);
return r;
}
- intvec& operator&=(const intvec& x) { return *this=*this&x; }
- intvec& operator|=(const intvec& x) { return *this=*this|x; }
- intvec& operator^=(const intvec& x) { return *this=*this^x; }
+ intvec& operator&=(intvec x) { return *this=*this&x; }
+ intvec& operator|=(intvec x) { return *this=*this|x; }
+ intvec& operator^=(intvec x) { return *this=*this^x; }
@@ -275,26 +275,26 @@ namespace vecmathlib {
intvec& operator>>=(int_t n) { return *this=*this>>n; }
intvec& operator<<=(int_t n) { return *this=*this<<n; }
- intvec lsr(const intvec& n) const
+ intvec lsr(intvec n) const
{
intvec r;
for (int d=0; d<size; ++d) r.set_elt(d, U((*this)[d]) >> U(n[d]));
return r;
}
- intvec operator>>(const intvec& n) const
+ intvec operator>>(intvec n) const
{
intvec r;
for (int d=0; d<size; ++d) r.set_elt(d, (*this)[d] >> n[d]);
return r;
}
- intvec operator<<(const intvec& n) const
+ intvec operator<<(intvec n) const
{
intvec r;
for (int d=0; d<size; ++d) r.set_elt(d, (*this)[d] << n[d]);
return r;
}
- intvec& operator>>=(const intvec& n) { return *this=*this>>n; }
- intvec& operator<<=(const intvec& n) { return *this=*this<<n; }
+ intvec& operator>>=(intvec n) { return *this=*this>>n; }
+ intvec& operator<<=(intvec n) { return *this=*this<<n; }
@@ -303,37 +303,37 @@ namespace vecmathlib {
return *this < IV(I(0));
}
- boolvec_t operator==(const intvec& x) const
+ boolvec_t operator==(intvec x) const
{
boolvec_t r;
for (int d=0; d<size; ++d) r.set_elt(d, (*this)[d] == x[d]);
return r;
}
- boolvec_t operator!=(const intvec& x) const
+ boolvec_t operator!=(intvec x) const
{
boolvec_t r;
for (int d=0; d<size; ++d) r.set_elt(d, (*this)[d] != x[d]);
return r;
}
- boolvec_t operator<(const intvec& x) const
+ boolvec_t operator<(intvec x) const
{
boolvec_t r;
for (int d=0; d<size; ++d) r.set_elt(d, (*this)[d] < x[d]);
return r;
}
- boolvec_t operator<=(const intvec& x) const
+ boolvec_t operator<=(intvec x) const
{
boolvec_t r;
for (int d=0; d<size; ++d) r.set_elt(d, (*this)[d] <= x[d]);
return r;
}
- boolvec_t operator>(const intvec& x) const
+ boolvec_t operator>(intvec x) const
{
boolvec_t r;
for (int d=0; d<size; ++d) r.set_elt(d, (*this)[d] > x[d]);
return r;
}
- boolvec_t operator>=(const intvec& x) const
+ boolvec_t operator>=(intvec x) const
{
boolvec_t r;
for (int d=0; d<size; ++d) r.set_elt(d, (*this)[d] >= x[d]);
@@ -380,7 +380,7 @@ namespace vecmathlib {
// be passed in registers
// realvec(const realvec& x): v(x.v) {}
// realvec& operator=(const realvec& x) { return v=x.v, *this; }
- realvec(const vector_t& x): v(x) {}
+ realvec(vector_t x): v(x) {}
realvec(real_t a): v(vec_splats(a)) {}
realvec(const real_t* as)
{
@@ -419,7 +419,7 @@ namespace vecmathlib {
// TODO: use load instruction with fixed offset
return loadu(p+ioff);
}
- realvec_t loada(const real_t* p, const mask_t& m) const
+ realvec_t loada(const real_t* p, mask_t m) const
{
VML_ASSERT(intptr_t(p) % alignment == 0);
if (__builtin_expect(all(m.m), true)) {
@@ -428,7 +428,7 @@ namespace vecmathlib {
return m.m.ifthen(loada(p), *this);
}
}
- realvec_t loadu(const real_t* p, const mask_t& m) const
+ realvec_t loadu(const real_t* p, mask_t m) const
{
if (__builtin_expect(m.all_m, true)) {
return loadu(p);
@@ -436,7 +436,7 @@ namespace vecmathlib {
return m.m.ifthen(loadu(p), *this);
}
}
- realvec_t loadu(const real_t* p, std::ptrdiff_t ioff, const mask_t& m) const
+ realvec_t loadu(const real_t* p, std::ptrdiff_t ioff, mask_t m) const
{
VML_ASSERT(intptr_t(p) % alignment == 0);
if (ioff % realvec::size == 0) return loada(p+ioff, m);
@@ -465,7 +465,7 @@ namespace vecmathlib {
if (ioff % realvec::size == 0) return storea(p+ioff);
storeu(p+ioff);
}
- void storea(real_t* p, const mask_t& m) const
+ void storea(real_t* p, mask_t m) const
{
VML_ASSERT(intptr_t(p) % alignment == 0);
if (__builtin_expect(m.all_m, true)) {
@@ -477,7 +477,7 @@ namespace vecmathlib {
if (m.m[3]) p[3] = (*this)[3];
}
}
- void storeu(real_t* p, const mask_t& m) const
+ void storeu(real_t* p, mask_t m) const
{
if (__builtin_expect(m.all_m, true)) {
storeu(p);
@@ -488,7 +488,7 @@ namespace vecmathlib {
if (m.m[3]) p[3] = (*this)[3];
}
}
- void storeu(real_t* p, std::ptrdiff_t ioff, const mask_t& m) const
+ void storeu(real_t* p, std::ptrdiff_t ioff, mask_t m) const
{
VML_ASSERT(intptr_t(p) % alignment == 0);
if (ioff % realvec::size == 0) return storea(p+ioff, m);
@@ -505,19 +505,19 @@ namespace vecmathlib {
realvec operator+() const { return *this; }
realvec operator-() const { return vec_neg(v); }
- realvec operator+(const realvec& x) const { return vec_add(v, x.v); }
- realvec operator-(const realvec& x) const { return vec_sub(v, x.v); }
- realvec operator*(const realvec& x) const { return vec_mul(v, x.v); }
- realvec operator/(const realvec& x) const
+ realvec operator+(realvec x) const { return vec_add(v, x.v); }
+ realvec operator-(realvec x) const { return vec_sub(v, x.v); }
+ realvec operator*(realvec x) const { return vec_mul(v, x.v); }
+ realvec operator/(realvec x) const
{
// return vec_swdiv_nochk(v, x.v);
return div_fastd4(v, x.v);
}
- realvec& operator+=(const realvec& x) { return *this=*this+x; }
- realvec& operator-=(const realvec& x) { return *this=*this-x; }
- realvec& operator*=(const realvec& x) { return *this=*this*x; }
- realvec& operator/=(const realvec& x) { return *this=*this/x; }
+ realvec& operator+=(realvec x) { return *this=*this+x; }
+ realvec& operator-=(realvec x) { return *this=*this-x; }
+ realvec& operator*=(realvec x) { return *this=*this*x; }
+ realvec& operator/=(realvec x) { return *this=*this/x; }
real_t maxval() const
{
@@ -553,10 +553,10 @@ namespace vecmathlib {
- boolvec_t operator==(const realvec& x) const { return vec_cmpeq(v, x.v); }
- boolvec_t operator!=(const realvec& x) const { return ! (*this == x); }
- boolvec_t operator<(const realvec& x) const { return vec_cmplt(v, x.v); }
- boolvec_t operator<=(const realvec& x) const
+ boolvec_t operator==(realvec x) const { return vec_cmpeq(v, x.v); }
+ boolvec_t operator!=(realvec x) const { return ! (*this == x); }
+ boolvec_t operator<(realvec x) const { return vec_cmplt(v, x.v); }
+ boolvec_t operator<=(realvec x) const
{
#ifdef VML_HAVE_NAN
return *this < x || *this == x;
@@ -564,8 +564,8 @@ namespace vecmathlib {
return ! (*this > x);
#endif
}
- boolvec_t operator>(const realvec& x) const { return vec_cmpgt(v, x.v); }
- boolvec_t operator>=(const realvec& x) const
+ boolvec_t operator>(realvec x) const { return vec_cmpgt(v, x.v); }
+ boolvec_t operator>=(realvec x) const
{
#ifdef VML_HAVE_NAN
return *this > x || *this == x;
@@ -581,11 +581,11 @@ namespace vecmathlib {
realvec asin() const { return asind4(v); }
realvec asinh() const { return asinhd4(v); }
realvec atan() const { return atand4(v); }
- realvec atan2(const realvec& y) const { return atan2d4(v, y.v); }
+ realvec atan2(realvec y) const { return atan2d4(v, y.v); }
realvec atanh() const { return atanhd4(v); }
realvec cbrt() const { return cbrtd4(v); }
realvec ceil() const { return vec_ceil(v); }
- realvec copysign(const realvec& y) const { return vec_cpsgn(y.v, v); }
+ realvec copysign(realvec y) const { return vec_cpsgn(y.v, v); }
realvec cos() const { return cosd4(v); }
realvec cosh() const { return coshd4(v); }
realvec exp() const { return expd4(v); }
@@ -593,17 +593,17 @@ namespace vecmathlib {
realvec exp2() const { return exp2d4(v); }
realvec expm1() const { return expm1d4(v); }
realvec fabs() const { return vec_abs(v); }
- realvec fdim(const realvec& y) const { return MF::vml_fdim(*this, y); }
+ realvec fdim(realvec y) const { return MF::vml_fdim(*this, y); }
realvec floor() const { return vec_floor(v); }
- realvec fma(const realvec& y, const realvec& z) const
+ realvec fma(realvec y, realvec z) const
{
return vec_madd(v, y.v, z.v);
}
- realvec fmax(const realvec& y) const { return MF::vml_fmax(v, y.v); }
- realvec fmin(const realvec& y) const { return MF::vml_fmin(v, y.v); }
- realvec fmod(const realvec& y) const { return MF::vml_fmod(*this, y); }
+ realvec fmax(realvec y) const { return MF::vml_fmax(v, y.v); }
+ realvec fmin(realvec y) const { return MF::vml_fmin(v, y.v); }
+ realvec fmod(realvec y) const { return MF::vml_fmod(*this, y); }
realvec frexp(intvec_t& r) const { return MF::vml_frexp(*this, r); }
- realvec hypot(const realvec& y) const { return hypotd4(v, y.v); }
+ realvec hypot(realvec y) const { return hypotd4(v, y.v); }
intvec_t ilogb() const
{
// int_t ilogb_[] = {
@@ -627,7 +627,7 @@ namespace vecmathlib {
}
boolvec_t isnormal() const { return MF::vml_isnormal(*this); }
realvec ldexp(int_t n) const { return ldexp(intvec_t(n)); }
- realvec ldexp(const intvec_t& n) const
+ realvec ldexp(intvec_t n) const
{
real_t ldexp_[] = {
std::ldexp((*this)[0], n[0]),
@@ -641,13 +641,13 @@ namespace vecmathlib {
realvec log10() const { return log10d4(v); }
realvec log1p() const { return log1pd4(v); }
realvec log2() const { return log2d4(v); }
- realvec nextafter(const realvec& y) const
+ realvec nextafter(realvec y) const
{
return MF::vml_nextafter(*this, y);
}
- realvec pow(const realvec& y) const { return powd4(v, y.v); }
+ realvec pow(realvec y) const { return powd4(v, y.v); }
realvec rcp() const { return recip_fastd4(v); }
- realvec remainder(const realvec& y) const
+ realvec remainder(realvec y) const
{
return MF::vml_remainder(*this, y);
}
@@ -704,21 +704,21 @@ namespace vecmathlib {
inline
boolvec<double,4>
- boolvec<double,4>::ifthen(const boolvec_t& x, const boolvec_t& y) const
+ boolvec<double,4>::ifthen(boolvec_t x, boolvec_t y) const
{
return ifthen(x.as_int(), y.as_int()).as_bool();
}
inline
intvec<double,4>
- boolvec<double,4>::ifthen(const intvec_t& x, const intvec_t& y) const
+ boolvec<double,4>::ifthen(intvec_t x, intvec_t y) const
{
return ifthen(x.as_float(), y.as_float()).as_int();
}
inline
realvec<double,4>
- boolvec<double,4>::ifthen(const realvec_t& x, const realvec_t& y) const
+ boolvec<double,4>::ifthen(realvec_t x, realvec_t y) const
{
return vec_sel(y.v, x.v, v);
}
OpenPOWER on IntegriCloud