recent troubles with float vectors & bitwise ops

tbp tbptbp@gmail.com
Thu Aug 23 12:42:00 GMT 2007


Paolo Bonzini wrote:
> Because it's *not* strictly typed.  Strict typing means that you accept 
> the same things accepted for the element type.  So it's not a 
> regression, it's a bug fix.
# cat regressionorbugfix.cc
typedef float v4sf_t __attribute__ ((__vector_size__ (16)));
typedef int v4si_t __attribute__ ((__vector_size__ (16)));
v4sf_t foo(v4sf_t a, v4sf_t b, v4sf_t c) {
	return a + (b | c);
}
v4sf_t bar(v4sf_t a, v4sf_t b, v4sf_t c) {
	return a + (v4sf_t) ((v4si_t) b | (v4si_t) c);
}
int main() { return 0; }

0000000000400a30 <foo(float __vector, float __vector, float __vector)>:
   400a30:       orps   %xmm2,%xmm1
   400a33:       addps  %xmm1,%xmm0
   400a36:       retq

0000000000400a40 <bar(float __vector, float __vector, float __vector)>:
   400a40:       por    %xmm2,%xmm1
   400a44:       addps  %xmm1,%xmm0
   400a47:       retq

I'm surely not qualified to argue about typing, but you'd need a rather 
strong distortion field to not characterize that as a regression.



More information about the Gcc mailing list