This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Examples of Pushing into _m256d

Tags: None
(comma "," separated)
JLoveless
Registered Member
Posts
6
Karma
0

Examples of Pushing into _m256d

Tue Jun 05, 2012 11:30 pm
I am in need of an intrinsic function (for rounding) of a VectorXd , and I was hoping someone had an example of the push into the _m256d .
Basically, is the VectorXd 32 byte aligned? If so is it as simple as something like (shown here with add)

void
avx_add(double *src,double *res)
{
__m256d *iptr = (__m256d*)res;
__m256d t = _mm256_load_pd(src);
*iptr = _mm256_add_pd(t,t);
}


int main(VectortXd EigenVec)
{
int length = EigenVec.size(); //is aligned correctly?

// Allocate aligned memory for result
double *res = _mm_malloc(length*sizeof(double),32);

for(int i=0;i<length;i+=4) {
avx_add(EigenVec+i,res+i);
}
return res;
}

?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Eigen's VectorXd are indeed aligned on a 32 bytes boundary.
JLoveless
Registered Member
Posts
6
Karma
0

Re: Examples of Pushing into _m256d

Wed Jun 06, 2012 1:09 pm
thanks!


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell