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

Brendan Younger brendan at brendanyounger.com
Tue Jul 29 08:59:35 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.

Brendan Younger



More information about the llvm-dev mailing list