Commit aef11580 authored by berenger-bramas's avatar berenger-bramas
Browse files

Add the prefetch (intel/gcc) support,

Use it into iterators of list and vector.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@125 2616d619-271b-44dc-8df4-d4a8f33a7222
parent e132a442
......@@ -179,7 +179,10 @@ public:
/** To gotoNext on the list */
void gotoNext(){
if(this->iter) this->iter = this->iter->next;
if(this->iter){
this->iter = this->iter->next;
if(this->iter) Prefetch_Write(this->iter->next);
}
}
/**
......@@ -236,7 +239,10 @@ public:
/** to gotoNext on the list */
void gotoNext(){
if(this->iter) this->iter = this->iter->next;
if(this->iter){
this->iter = this->iter->next;
if(this->iter) Prefetch_Read(this->iter->next);
}
}
/**
......
......@@ -194,6 +194,7 @@ public:
void gotoNext(){
++this->index;
Prefetch_Write(&this->vector->array[this->index + 1]);
}
bool hasNotFinished() const{
......@@ -227,6 +228,7 @@ public:
void gotoNext(){
++this->index;
Prefetch_Read(&this->vector->array[this->index + 1]);
}
bool hasNotFinished() const{
......
......@@ -50,5 +50,23 @@ static const int MaxTreeHeight = 20;
#define FRestrict __restrict__
#endif
///////////////////////////////////////////////////////
// Prefetch
///////////////////////////////////////////////////////
#ifdef __GNUC__
#define Prefetch_Read(X) __builtin_prefetch(X)
#define Prefetch_Write(X) __builtin_prefetch(X,1,1)
#else
#ifdef __INTEL_COMPILER
#define Prefetch_Read(X) _mm_prefetch(X,_MM_HINT_T0)
#define Prefetch_Write(X) _mm_prefetch(X,_MM_HINT_T0)
#else
#warning compiler is not defined
#define Prefetch_Read(X)
#define Prefetch_Write(X)
#endif
#endif
#endif //FGLOBAL_HPP
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment