[Libreoffice-commits] core.git: Branch 'feature/fixes11' - sc/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.com
Thu Nov 5 03:19:55 PST 2015
sc/source/core/inc/arraysumfunctor.hxx | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
New commits:
commit b35c38c6e44b0df0fc2c5a3983ecd7547b964691
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Thu Nov 5 12:14:06 2015 +0100
invalid array index when pCurrent pointer is incremented
If pCurrent is incremented (when the input double array is not
alligned) we can't use i as the array index anymore as it refers
correctly to elements in input double array only. Changing back
to pointer arithmetic.
Change-Id: Id498a4182d28cae067195853e96f7169063853e2
diff --git a/sc/source/core/inc/arraysumfunctor.hxx b/sc/source/core/inc/arraysumfunctor.hxx
index fc1b915..776c514 100644
--- a/sc/source/core/inc/arraysumfunctor.hxx
+++ b/sc/source/core/inc/arraysumfunctor.hxx
@@ -39,7 +39,6 @@ public:
double operator() ()
{
static bool hasSSE2 = tools::cpuid::hasSSE2();
- printf("SSE used %d\n", hasSSE2);
double fSum = 0.0;
size_t i = 0;
@@ -81,17 +80,21 @@ private:
for (; i < nUnrolledSize; i += 8)
{
- __m128d load1 = _mm_load_pd(&pCurrent[i]);
+ __m128d load1 = _mm_load_pd(pCurrent);
sum1 = _mm_add_pd(sum1, load1);
+ pCurrent += 2;
- __m128d load2 = _mm_load_pd(&pCurrent[i + 2]);
+ __m128d load2 = _mm_load_pd(pCurrent);
sum2 = _mm_add_pd(sum2, load2);
+ pCurrent += 2;
- __m128d load3 = _mm_load_pd(&pCurrent[i + 4]);
+ __m128d load3 = _mm_load_pd(pCurrent);
sum3 = _mm_add_pd(sum3, load3);
+ pCurrent += 2;
- __m128d load4 = _mm_load_pd(&pCurrent[i + 6]);
+ __m128d load4 = _mm_load_pd(pCurrent);
sum4 = _mm_add_pd(sum4, load4);
+ pCurrent += 2;
}
sum1 = _mm_add_pd(_mm_add_pd(sum1, sum2), _mm_add_pd(sum3, sum4));
More information about the Libreoffice-commits
mailing list