summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-08-17 12:07:39 -0400
committerErik Schnetter <schnetter@gmail.com>2013-08-17 12:08:01 -0400
commitdba86f8ca7046f96c4d7ab3b8db5e5b9bbad1580 (patch)
tree189f4da729f24689d110e2c85b9dca87c115117e
parent5e59074445e36db39ff7245e33be316549da6c72 (diff)
downloadvecmathlib-dba86f8ca7046f96c4d7ab3b8db5e5b9bbad1580.zip
vecmathlib-dba86f8ca7046f96c4d7ab3b8db5e5b9bbad1580.tar.gz
QPX: Optimize all/any
-rw-r--r--vec_qpx_double4.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/vec_qpx_double4.h b/vec_qpx_double4.h
index 20de208..118815d 100644
--- a/vec_qpx_double4.h
+++ b/vec_qpx_double4.h
@@ -104,11 +104,19 @@ namespace vecmathlib {
bool all() const
{
- return (*this)[0] && (*this)[1] && (*this)[2] && (*this)[3];
+ // return (*this)[0] && (*this)[1] && (*this)[2] && (*this)[3];
+ realvec_t x0123 = *this;
+ realvec_t x1032 = vec_perm(x0123, x0123, vec_gpci(01032));
+ realvec_t y0022 = x0123 && x1032;
+ return y0022[0] && y0022[2];
}
bool any() const
{
- return (*this)[0] || (*this)[1] || (*this)[2] || (*this)[3];
+ // return (*this)[0] || (*this)[1] || (*this)[2] || (*this)[3];
+ realvec_t x0123 = *this;
+ realvec_t x1032 = vec_perm(x0123, x0123, vec_gpci(01032));
+ realvec_t y0022 = x0123 || x1032;
+ return y0022[0] || y0022[2];
}
@@ -537,7 +545,7 @@ namespace vecmathlib {
real_t sum() const
{
// return (*this)[0] + (*this)[1] + (*this)[2] + (*this)[3];
- realvec_t c1 = vec_logical(v, v, 0xf);
+ realvec_t c1 = vec_logical(v, v, 0xf); // +1.0
realvec_t x = vec_xxmadd(v, c1, v);
return x[0] + x[2];
}
OpenPOWER on IntegriCloud