[cfe-dev] Conversions of ext_vector types

Schoedel, Kevin P kevin.p.schoedel at intel.com
Thu Apr 19 09:00:20 PDT 2012


As a C programmer, I find the behaviour of ext_vector conversions
surprising.

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

 define <4 x float> @f(<4 x float> %a, <4 x i32> %b) nounwind uwtable readnone {
 entry:
   %0 = bitcast <4 x i32> %b to <4 x float>
   %add = fadd <4 x float> %0, %a
   ret <4 x float> %add
 }

I've looked, but not found the story behind this. Would there be
objections to having conversions, like other ext_vector operations,
perform the corresponding scalar operation elementwise instead?

--
Kevin Schoedel kevin.p.schoedel at intel.com +1-519-772-2580
SSG-DPD-ECDL-DMP - Intel Dynamic Mobility and Parallelism




More information about the cfe-dev mailing list