This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Vectorizer question


On 5/16/2012 4:01 PM, Iyer, Balaji V wrote:
Hello Everyone,
	I have a question regarding the vectorizer. In the following code below...

Int func (int x, int y)
{
	If (x==y)
		Return (x+y);
	Else
		Return (x-y);
}

If we force the x and y to be vectors of vectorlength 4, then will the if-statement get a vector of booleans or does it get 1 boolean that compares 2 very large values? I guess another way to ask is that, will it logically break it up into 4 if-statements or just 1?

Any help is greatly appreciated!

Thanks,

Balaji V. Iyer.

PS. Please CC me in response so that I can get to it quickly.
Is this about vector extensions to C, or about other languages such as C++ or Fortran? In Fortran, it's definitely an array of logical, in the case where the compiler can't optimize it away. This would more likely be written
return x==y ? x+y : x-y;


--
Tim Prince


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]