This is an archive of the discontinued LLVM Phabricator instance.

[Sparc] Complex return value ABI compliance.
ClosedPublic

Authored by lero_chris on Jun 3 2016, 4:06 AM.

Details

Summary

According to the Sparc V8 ABI, complex numbers should be passed and returned as pairs of registers:

https://docs.oracle.com/cd/E26502_01/html/E28387/gentextid-2734.html

This fix ensures this is the case. Without this, complex numbers are returned as a struct of two floats, which breaks the ABI rules.

Diff Detail

Repository
rL LLVM

Event Timeline

lero_chris updated this revision to Diff 59527.Jun 3 2016, 4:06 AM
lero_chris retitled this revision from to [Sparc] Complex return value ABI compliance..
lero_chris updated this object.
lero_chris added reviewers: jacob_hansen, jyknight.
lero_chris set the repository for this revision to rL LLVM.
lero_chris added a subscriber: llvm-commits.
jyknight edited edge metadata.Jun 3 2016, 7:12 AM

I would prefer if the change was structured as WebAssemblyABIInfo is: override computeInfo (with the same source code as the base, calling classify*), and then make a new classifyReturnType. That will make it easier for future fixes (e.g. properly supporting "long double", which we don't right now).

Also: we do implement integer complex numbers as well as floats. The ABI doc you linked doesn't seem to address those, but GCC passes them back in multiple integer registers (e.g. "long long complex" writes values into o0 through o3). Your change looks to already do that, as well, but that seems worth a comment and a test.

lero_chris updated this revision to Diff 59880.Jun 7 2016, 6:43 AM
lero_chris edited edge metadata.

Updated code in accordance with feedback.

jyknight accepted this revision.Jun 7 2016, 9:57 AM
jyknight edited edge metadata.
jyknight added inline comments.
tools/clang/lib/CodeGen/TargetInfo.cpp
6877

Shouldn't need DefaultABIInfo:: here.

This revision is now accepted and ready to land.Jun 7 2016, 9:57 AM
lero_chris updated this revision to Diff 60039.Jun 8 2016, 7:41 AM
lero_chris edited edge metadata.

Small change removing unnecessary class qualifier.

lero_chris closed this revision.Jun 8 2016, 7:41 AM