http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57156



--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> 2013-05-03 
12:27:05 UTC ---

(In reply to comment #5)

> (In reply to comment #4)

> > I wouldn't know how to counter this for the _mm_cmpeq_epi8 case

> 

> Actually, I have yet to find something in the standard that says using an

> uninitialized __m128 is undefined behavior. ;)

> Thus the only standard that would define the rules here would be Intel's, no?

> And from reading their docs I understand that calling an intrinsics maps to 
> the

> behavior you'd get when using the associated instruction. In this case

> comparing any XMM register with itself will result in what I expect.



The standard says that using uninitialized variables invoke undefined

behavior.  That doesn't magically exclude types that are not explicitely

covered by the standard.  Doing



 int a;

 _Bool true = a == a;



is undefined as well, so is



 int a;

 int zero = a ^ a;



You cannot translate optimized assembler back to C in this way.



Well, you can.  Sth like



 register int a asm("eax");

 int zero = a ^ a;



should do it.

Reply via email to