This is an archive of the discontinued LLVM Phabricator instance.

[WinX86_64 ABI] Handle C99 _Complex as a struct
ClosedPublic

Authored by mkuper on Feb 23 2015, 3:28 AM.

Details

Summary

MSVC does not support C99 _Complex, and apparently has no plans to support it ( https://connect.microsoft.com/VisualStudio/feedback/details/891891/c99-complex-number-support )

ICC, however, does support _Complex on windows x86_64, and treats it, for purposes of parameter passing, as equivalent to a struct containing two fields (for the real and imaginary part). This makes clang handle it the same way.

Diff Detail

Repository
rL LLVM

Event Timeline

mkuper updated this revision to Diff 20497.Feb 23 2015, 3:28 AM
mkuper retitled this revision from to [WinX86_64 ABI] Handle C99 _Complex as a struct.
mkuper updated this object.
mkuper edited the test plan for this revision. (Show Details)
mkuper added reviewers: rnk, majnemer, chapuni.
mkuper added a subscriber: Unknown Object (MLST).
majnemer edited edge metadata.Feb 23 2015, 10:19 AM

How are we doing to mangle _Complex? How does _Complex interact with vectorcall?

Regarding mangling, to the best of my understanding, ICC doesn't support _Complex in C++ mode, and since MSVC doesn't support it at all (only C++ std::complex), this issue never arises.
Regarding vectorcall - I'll have to double-check, but I believe the same holds as for the default x64 calling convention, that is, _Complex is treated equivalently to structs.

Please add a testcase where a _Complex is returned.

majnemer accepted this revision.Feb 24 2015, 12:11 AM
majnemer edited edge metadata.

LGTM, please add a test case for returning _Complex sooner than later though ;)

This revision is now accepted and ready to land.Feb 24 2015, 12:11 AM
This revision was automatically updated to reflect the committed changes.