I'm trying to squeeze the last bit of optimization out of a program using Intel C++ 10.1 (because with later versions I'm getting slower code - I'll look into that later).

When looking at the vectorization reports, I noticed 2 things I hadn't expected, and I wonder if they can be solved (without rewriting lots of code - total code base is over 2 MB and I'm working on it alone). I've tried to google them but didn't find any useful answers.

This one seems to be the most important:

fft_abs_sse2[2*cc] = max(fft_abs_sse2[2*cc], strength * m);

.\Clip1Ch.cpp(1999): (col. 13) remark: vector dependence: proven ANTI dependence between fft_abs_sse2 line 1999, and fft_abs_sse2 line 1999.

.\Clip1Ch.cpp(1999): (col. 13) remark: vector dependence: proven ANTI dependence between fft_abs_sse2 line 1999, and fft_abs_sse2 line 1999.

.\Clip1Ch.cpp(1999): (col. 13) remark: vector dependence: proven FLOW dependence between fft_abs_sse2 line 1999, and fft_abs_sse2 line 1999.

.\Clip1Ch.cpp(1999): (col. 13) remark: vector dependence: proven FLOW dependence between fft_abs_sse2 line 1999, and fft_abs_sse2 line 1999.

.\Clip1Ch.cpp(1999): (col. 13) remark: vector dependence: proven ANTI dependence between fft_abs_sse2 line 1999, and fft_abs_sse2 line 1999.

...

While I know that there's an _mm_max_ SIMD instruction. Problem might be the definition of max, I'm using:

#define max(a,b) (((a)>(b)) ? (a) : (b))

The compiler might see this as an **if** instruction if it's unable to optimize everything out. Is there a better definition for max that doesn't cause the compiler to see dependencies where there are none?

Another situation that occurs very frequently in my code is this:

for (int c=0; c<f1; c++)

{

temp[2*c] *= one_DIV_bass_static_clip_level_dynamic;

temp[2*c+1] *= one_DIV_bass_static_clip_level_dynamic;

}

Clearly, there are no dependencies between temp[2*c] and temp[2*c+1], but the compiler thinks otherwise:

.\Clip1Ch.cpp(797): (col. 9) remark: loop was not vectorized: existence of vector dependence.

.\Clip1Ch.cpp(800): (col. 13) remark: vector dependence: proven FLOW dependence between temp line 800, and temp line 799.

.\Clip1Ch.cpp(800): (col. 13) remark: vector dependence: proven ANTI dependence between temp line 800, and temp line 799.

.\Clip1Ch.cpp(800): (col. 13) remark: vector dependence: proven OUTPUT dependence between temp line 800, and temp line 799.

I think if these two situations are solved at least 50% of the loops that currently don't get vectorized will be. Your help is greatly appreciated :)