This is an archive of the discontinued LLVM Phabricator instance.

[X86] ABI breaking change for x86-32: pass 3 vector arguments in-register instead of 4, except on Darwin
ClosedPublic

Authored by mkuper on May 10 2015, 1:21 AM.

Details

Summary

This changes the ABI used on 32-bit x86 for passing vector arguments.
Currently, clang passes 4 arguments in-register, and everything else on the stack, on all platforms.

This is different from the behavior of gcc, icc, and msvc, all of which pass 3 arguments in-register. The 3-register convention is documented, unofficially, in Agner's calling convention guide, and, officially, in the recently released version 1.0 of the i386 psABI (see https://01.org/sites/default/files/file_attach/intel386-psabi-1.0.pdf ).

This patch changes the behavior on all platforms except Darwin. The Darwin ABI is kept as is, because:
a) Clang is the mainstream compiler for the platform, which means that existing code is much more likely to rely on the current ABI.
b) The current behavior is documented (in the OS X ABI Function Call Guide).

See also PR21510.

Please feel free to add more reviewers that have a stake in this.

Diff Detail

Repository
rL LLVM

Event Timeline

mkuper updated this revision to Diff 25424.May 10 2015, 1:21 AM
mkuper retitled this revision from to [X86] ABI breaking change for x86-32: pass 3 vector arguments in-register instead of 4, except on Darwin.
mkuper updated this object.
mkuper edited the test plan for this revision. (Show Details)
mkuper added a subscriber: Unknown Object (MLST).
rnk accepted this revision.May 11 2015, 1:35 PM
rnk edited edge metadata.

I think this is definitely the right change for Linux, Darwin, and Windows.

What about the BSDs, though? They switched to clang as the system compiler some time ago. They might want either the Darwin behavior for compatibility or the standard Sys V behavior for better conformance. You should bug Ed Maste and Joerg is already CCd.

This revision is now accepted and ready to land.May 11 2015, 1:35 PM

Thanks, Reid!

And yes, that's why I added Joerg.
(I recall talking to him about this on IRC when this originally came up in December, and he did not object to making the change on BSD, but I may be mis-remembering...)

joerg edited edge metadata.May 12 2015, 1:51 AM

I don't think it matters either way for NetBSD, at most a few things in pkgsrc are affected.

This revision was automatically updated to reflect the committed changes.
emaste edited edge metadata.May 21 2015, 9:34 AM
emaste added subscribers: dim, bapt.

I didn't spot this when first posted, but I'll belatedly add that I think this is the right change for FreeBSD as well.

Clang has been our system compiler for quite some time but a reasonable portion of the ports tree is built with GCC, and interop and psABI conformance concerns probably override a potential slightly bumpy transition.