Implement DSDOT with unchanged sdot microkernels

This commit is contained in:
Martin Kroeker 2017-10-16 23:27:51 +02:00 committed by GitHub
parent c460027dbe
commit 8ac87c1cb6
1 changed files with 20 additions and 3 deletions

View File

@ -68,7 +68,11 @@ static void sdot_kernel_16(BLASLONG n, FLOAT *x, FLOAT *y, FLOAT *d)
#endif #endif
#if defined (DSDOT)
double CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y)
#else
FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y) FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y)
#endif
{ {
BLASLONG i=0; BLASLONG i=0;
BLASLONG ix=0,iy=0; BLASLONG ix=0,iy=0;
@ -91,12 +95,19 @@ FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y)
i = n1; i = n1;
while(i < n) while(i < n)
{ {
#if defined(DSDOT)
dot += (double)y[i] * (double)x[i] ;
#else
dot += y[i] * x[i] ; dot += y[i] * x[i] ;
#endif
i++ ; i++ ;
} }
#if defined(DSDOT)
dot+=(double)mydot;
#else
dot+=mydot; dot+=mydot;
#endif
return(dot); return(dot);
@ -106,8 +117,11 @@ FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y)
while(i < n1) while(i < n1)
{ {
#if defined (DSDOT)
dot += (double)y[iy] * (double)x[ix] + (double)y[iy+inc_y] * (double)x[ix+inc_x];
#else
dot += y[iy] * x[ix] + y[iy+inc_y] * x[ix+inc_x]; dot += y[iy] * x[ix] + y[iy+inc_y] * x[ix+inc_x];
#endif
ix += inc_x*2 ; ix += inc_x*2 ;
iy += inc_y*2 ; iy += inc_y*2 ;
i+=2 ; i+=2 ;
@ -116,8 +130,11 @@ FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y)
while(i < n) while(i < n)
{ {
#if defined (DSDOT)
dot += (double)y[iy] * (double)x[ix] ;
#else
dot += y[iy] * x[ix] ; dot += y[iy] * x[ix] ;
#endif
ix += inc_x ; ix += inc_x ;
iy += inc_y ; iy += inc_y ;
i++ ; i++ ;