Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7833 Discussions

## what does it mean? : A scalar L-value may not be assigned under a vector condition. It is an error.

New Contributor II
692 Views

Hello Everybody,

I started vector programming just recently using ICL and I am really enjoying Intel facilities in this regard.

I just come across a stetement as highlighted below, however I have a hard time making sense of it. In particular I don't understand what is meant by "vector condition".

I would appreciate if sb please elaborate as I am new to vector programming.

Regards

https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/optimization-and-programming-guide/vectorization/explicit-vector-programming/user-mandated-or-simd-vectorization.html

1 Solution
Black Belt
676 Views

scalar means non-vector (single) variable
L-value means left of =

vector condition... means a vector of conditions (not necessarily all having the same values)

result = yes, no, no, yes // make up your mind, what does this mean???

Jim Dempsey

7 Replies
Black Belt
677 Views

scalar means non-vector (single) variable
L-value means left of =

vector condition... means a vector of conditions (not necessarily all having the same values)

result = yes, no, no, yes // make up your mind, what does this mean???

Jim Dempsey

New Contributor II
673 Views

So, If I understand your point correctly, it simply means that given a vector of boolean condition vector (eg. vectorized version of an if condition (deciding which R-value to be assigned to a scaler L-value) ), we logically can't decide which value to assign to a single scaler L-value and thus should be avoided.

Is that correct ????

Regards

Black Belt
656 Views

Yes, however, keep in mind that there are instructions that can return a scalar result from a function performed on a vector. For example

float _mm512_reduce_gmax_ps (__m512 a)

Jim Dempsey

New Contributor II
645 Views

Yes I totally understand that ... I have done some vector programming before and I graps your points. It is just sometimes I don't know the compiler-related terms very well and it makes me ask stupid questions just to confirm my understanding.

I keep Intel Intrinsics Guide under my plow and check the execution cycles for different interinsics every now and then.

I just converted a pretty large Matlab code to C++  and it is a hassle to vertorize manually so I am trying to learn nots and bolts of Intel's Auto Vectorization before I make any stupid mistakes ...

Moderator
617 Views

Hi Mike,

Regards,

Vidya

New Contributor II
598 Views

Feel free to close the thread.

thanks so much !

Moderator
585 Views

Hi Mike,

Thanks for the confirmation!

As this issue has been resolved, we will no longer respond to this thread.