summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-07-06 11:26:19 -0400
committerErik Schnetter <schnetter@gmail.com>2013-07-06 11:26:19 -0400
commita08e3f63de017a4f9f8b9559bb02725e7e527545 (patch)
tree2538840263b240338b31220c44d3666a57f7721f
parentd76ef6a1ca729105e10834713b6d3793eb64d166 (diff)
downloadvecmathlib-a08e3f63de017a4f9f8b9559bb02725e7e527545.zip
vecmathlib-a08e3f63de017a4f9f8b9559bb02725e7e527545.tar.gz
Improve SSE/AVX convert_int
-rw-r--r--vec_avx_double4.h14
-rw-r--r--vec_sse_double2.h12
2 files changed, 24 insertions, 2 deletions
diff --git a/vec_avx_double4.h b/vec_avx_double4.h
index f45855c..1a7cdce 100644
--- a/vec_avx_double4.h
+++ b/vec_avx_double4.h
@@ -496,7 +496,19 @@ namespace vecmathlib {
intvec_t as_int() const { return _mm256_castpd_si256(v); }
- intvec_t convert_int() const { return MF::vml_convert_int(*this); }
+ intvec_t convert_int() const
+ {
+#ifdef __x86_64__
+ intvec_t r;
+ r.set_elt(0, _mm_cvttsd_si64(_mm_set_sd((*this)[0])));
+ r.set_elt(1, _mm_cvttsd_si64(_mm_set_sd((*this)[1])));
+ r.set_elt(2, _mm_cvttsd_si64(_mm_set_sd((*this)[2])));
+ r.set_elt(3, _mm_cvttsd_si64(_mm_set_sd((*this)[3])));
+ return r;
+#else
+ return floatprops::convert_int(v);
+#endif
+ }
diff --git a/vec_sse_double2.h b/vec_sse_double2.h
index 2467c7f..1db1ec6 100644
--- a/vec_sse_double2.h
+++ b/vec_sse_double2.h
@@ -465,7 +465,17 @@ namespace vecmathlib {
intvec_t as_int() const { return _mm_castpd_si128(v); }
- intvec_t convert_int() const { return MF::vml_convert_int(*this); }
+ intvec_t convert_int() const
+ {
+#ifdef __x86_64__
+ intvec_t r;
+ r.set_elt(0, _mm_cvttsd_si64(_mm_set_sd((*this)[0])));
+ r.set_elt(1, _mm_cvttsd_si64(_mm_set_sd((*this)[1])));
+ return r;
+#else
+ return floatprops::convert_int(v);
+#endif
+ }
OpenPOWER on IntegriCloud