You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like this was originally changed (broken) in 651c183 back in 2013.
https://reviews.llvm.org/D59744 is a recent attempt to fix this bug, but was reverted because it broke (at least) chromium on x86-32 -- in part due to to bug 42319.
I think that it's likely preferable to continue violating this ABI requirement indefinitely, and not fix this. Clang has already been violating it for 7+ years, and there's not a whole lot of demand to change here.
And, unfortunately, there's a very significant downside to changing, here. Adding any more usage of MMX is a giant foot-gun, due to the x87/mmx mode-switching issues.
After llvm/llvm-bugzilla-archive#42320 is implemented, there will be no use of MMX from clang, aside from inline-assembly. Adding back the hassle of accidental MMX mode-switch when passing or returning an __m64 would be extremely unfortunate -- it's just not worth it.
I do think it's unfortunate that GCC's and clang's ABI when built with -mno-mmx are not compatible.
E.g. given this function:
__m64 mmx() {
return (__m64)55LL;
}
gcc -O2 -mno-mmx -m32 treats it as if the return type was 'struct X { int a, int b}':
mmx():
movl 4(%esp), %eax
movl $55, (%eax)
movl $0, 4(%eax)
ret $4
clang -O2 -mno-mmx -m32 treats it as if the return type were 'long long':
mmx(): # @mmx()
movl $55, %eax
xorl %edx, %edx
retl
Extended Description
According to i386 ABI, __m64 values should be passed by mmx registers.
The text was updated successfully, but these errors were encountered: