So, I have the following code, which seems very simple to me:
#define MODS_COUNT 5 int start1 = <calc at runtime>; int start2 = <calc at runtime>; for (int j=0; j<MODS_COUNT; j++) // loop 5 times doing simple addition. logModifiers[start1 + j] += logModsThis[start2 + j];
This loop is part of the outer loop (not sure if it matters)
The compiler says: message : loop was not vectorized: vectorization possible but seems inefficient.
Why can't this cycle be vectorized? It seems to me very simple. How can I force a vector to test performance?
I have an Intel C ++ 2013 compiler update.
The full code is here if anyone is interested: http://pastebin.com/Z6H5ZejW
Edit: I understand that the compiler decided that it was inefficient. I'm asking:
Why is this inefficient?
How can I make him so that I can compare myself?
Edit2: If I change it to 4 instead of 5, then it will be vectorized. What makes 5 ineffective? I thought that this can be done in 2 instructions, the first is 4, and the second is "normal", 1 instead of 5 instructions.
source share