Diagnostic 15122: function can't be vectorized: too many registers required to return value (big vector length)

Cause:

Here the return type of the function foo() is complex data type with double which occupies 128 bits. Now specifying a vectorlength(32) clause while declaring SIMD-enabled function, demands 32 XMM registers to return the result from the function foo(). But there are only 16 XMM registers on hardware. So the compiler emits this diagnostic message intimating the user that the function cannot be vectorized because the function is demanding too many SIMD registers (in other words too big vector length). Below is an example for this scenario:

Example:

#include <complex.h>
__declspec(vector(vectorlength(32)))
double _Complex foo(int x){
  return x;
}


$ icc toomany.c -c -vec-report2
toomany.c(3): (col. 27) remark: function can't be vectorized: too many registers required to return value (big vector length)
toomany.c(3): (col. 27) error #13397: vector function was not vectorized
toomany.c(3): (col. 27) remark: function can't be vectorized: too many registers required to return value (big vector length)
toomany.c(3): (col. 27) error #13397: vector function was not vectorized
toomany.c(3): (col. 27) remark: function can't be vectorized: too many registers required to return value (big vector length)
toomany.c(3): (col. 27) error #13397: vector function was not vectorized
toomany.c(3): (col. 27) remark: function can't be vectorized: too many registers required to return value (big vector length)
toomany.c(3): (col. 27) error #13397: vector function was not vectorized
compilation aborted for toomany.c (code 1)

Resolution:

The way to work around this problem is specify any valid vectorlength less than 32.

For more complete information about compiler optimizations, see our Optimization Notice.