[LLVMdev] Vector types as function arguments and interfacing with C

Duncan Sands baldrick at free.fr
Tue Jul 29 09:41:54 PDT 2008


Hi,

> I want to be able to write a function like this
> 
> define <2 x double> @add(<2 x double> %a, <2 x double> %b) nounwind {
> 	%c = add <2 x double> %a, %b
> 	ret <2 x double> %c
> }
> 
> and then call it from C code.  What is the appropriate translation of  
> the <2 x double> vector type into C?  I've tried packed structs and  
> "typedef double vec_double __attribute__ ((__vector_size__ (16)))" but  
> in both cases, it seems that GCC passes these in as pointers rather  
> than in registers.

try reading about the gcc vector extensions in the "C Extensions" chapter
of the gcc docs.

Ciao,

Duncan.



More information about the llvm-dev mailing list