[Bug target/91841] vector_size(8) passes MMX register without emms cleanup
ubizjak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Sep 21 09:38:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91841
Uroš Bizjak <ubizjak at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hjl.tools at gmail dot com
--- Comment #5 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Matthias Kretz from comment #4)
> (In reply to Uroš Bizjak from comment #3)
> > [f]emms should be emitted by an intrinsic (_mm_empty), inserted by the
> > programmer. The programmer can mix FP and MMX instructions in the same
> > function, so there is no way for compiler to automatically emit emms.
>
> But that was my original point. In #0 the programmer did not mix FP and MMX
> instructions, only float and ushort [[gnu::vector_size(8)]] (which isn't
> even the same type as __m64) operations. The compiler did it. ;-) In that
> case, I understand 2.2.1 p3 as a requirement on the compiler. I sure agree
> that the use of MMX intrinsics puts the responsibility with the developer,
> but use of vector_size(8)?
Hm, ICC is of no help here, as it ignores attribute:
f(unsigned short):
push rbp #6.28
mov rbp, rsp #6.28
sub rsp, 16 #6.28
mov WORD PTR [-16+rbp], di #6.28
movzx eax, WORD PTR [-16+rbp] #6.37
leave #6.37
ret #6.37
Let's ask ABI expert about this.
> > Obviously, when the function returns value in %mm0 register (or in %fp),
> > emms should not be inserted at function exit.
>
> Right. Does that mean you agree the ABI document is contradicting itself?
Yes, unfortunately.
More information about the Gcc-bugs
mailing list