Can someone teach me a little about CPU prefetching as a c++ programmer? I understand the gist of it but I have some more detailed questions:
Lets say I declare an array, arr, like so:
float arr[1000];
Now, if I loop from the beginning of the array to the end, as I understand, cache coherance is maximum, and prefetching is utilized.
for(int i =0;i<1000;++i)
arr[i] += 1;
...but if I run the array backwards, will it prefetch automatically in the backwards direction as well?
Basically my question is: do processors prefetch data Around an adress, or does it only grab subsequent data tthrogh prefetching?