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]

RE: Status of SSE support in current gcc mainline


> check out:
> 
> http://www.altivec.org/tech_specifications/altivec_pim.pdf
> 
> The idea behind the altivec PIM is using intrinsics like c = vec_add(a,b);
> Based on how 'a' and 'b' are typed the compiler should figure out which
> altivec instruction this maps to.  For example:
> 
>   vector float a,b,c;
> 
>   c = vec_add(a,b); 
> 
> would map to the altivec instruction

Oh, and this requires some form of overloading or compiler black magic (IE
special handling) to do it without making these very special in the
parser/lexer, which isn't available in C.

c = vec_addfp(a,b), where a and b are two vector floats,  would not.
c = vec_add8int(a,b), where a and b are two vector ints,  would not.

You are asking the c compiler to choose the code baesd on the type of the
arguments, without any casting.
How do you declare this builtin function to the compiler, given that the
type of the arguments changes the code of the function?
You use one function for each possible type.
Without overloading, how does it choose which function to use?

Remember, this is C here, not C++.

I was using vec_add as an example of a simple intrinsic, not a complex
overloaded function that does what the PIM says it does.
--Dan



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