[cfe-dev] vector constructors

Chris Lattner clattner at apple.com
Tue Mar 16 12:19:21 PDT 2010


On Mar 16, 2010, at 12:05 PM, Jochen Wilhelmy wrote:

> Hi!
> 
> 
>> This is already supported with -faltivec, you can enable the LangOptions flag to get this.
>>   
> Unfortunately I didn't get it to work.
> I have langOptions.AltiVec = 1; and I tried
> typedef __vector float float4;
> and
> typedef float __attribute__((ext_vector_type(4))) float4;
> 
> I get this error:
> 
> testc.cpp:51:23:{51:14-51:33}: error: function-style cast to a builtin type can
>      only take one argument
>         float4 b = float4(1, 2, 3, 4);

This works for me:

$ cat t.c
void foo() {
  vector float x;
  x = (vector float)(1,2,3,4);
}
$ clang -cc1 t.c -fsyntax-only -faltivec






More information about the cfe-dev mailing list