[cfe-dev] problems with vector code

Anton Lokhmotov Anton.Lokhmotov at arm.com
Tue Mar 23 10:32:30 PDT 2010


> sorry, I didn't have altivec enabled and didn't know that it has to be
> enabled also for cl style vector casts.
> therefore (float4)(a,b,c,d) compiles comma operators, i.e. (float4)(d).

...which is not would you expect when you explicitly request
AltiVec-support! (Hence my bug report:
http://llvm.org/bugs/show_bug.cgi?id=6412)

This has also reminded me of another gripe I have.  

Could anyone tell me please why Clang compiles this

typedef float float4 __attribute__((ext_vector_type(4)));
float4 vadd4(float4 a, float4 b) { return a+b; }

into

define <2 x double> @vadd4(<2 x double>, <2 x double>) nounwind {

???

Note that <4 x float> is converted to <2 x double> even when
cgOpts.OptimizationLevel=0,  cgOpts.DisableLLVMOpts=1.  But e.g. float17
compiles as expected?

Anton L.





More information about the cfe-dev mailing list