Paolo Bonzini writes: > > > > The short answer is that AltiVec dictated this behavior. :-( Longer > > > answers were given by Ian and Paul, and I agree with them. > > > > OK, so: firstly, is this behaviour actually documented anywhere? In > > AltiVec docs, maybe? > > > http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?topic=/com.ibm.vacpp6m.doc/language/ref/clrc03altivec_types.htm > > "Vector types can be cast to other vector types. The cast does not > perform a conversion: it preserves the 128-bit pattern, but not > necessarily the value. A cast between a vector type and a scalar type is > not allowed."
Everything becomes clear. I would never have started this thread of I'd realized there was a spec somewhere. There doesn't seem to be any way to discover this stuff by reading the gcc docs. > > Secondly, can we fix it? > > > We can do anything we want. Or we can do nothing -- it depends on the > point of view. :-) While looking at PR10735, one or two years ago I set > to implement some rules resembling the ones outlined by Ian, only to > find that I would break the Altivec tests in a horrible way. > > For sure, we cannot fix the Altivec spec. Consider that Altivec does > not even have an instruction for a value-preserving V4SF->V4SI or > V4SI->V4SF conversion. So, is Altivec a de facto standard to be faithfully adhered to by all compilers? A point of departure? Andrew.