I'm curious on the performance issues. IIRC, common x86 C calling convention does returning structs by requiring the caller to allocate memory for the struct (on the stack or otherwise) and then pass a pointer. If that happens then it becomes no different then if you had simply allocated the array on the stack and then passed a pointer to it to the function.
Are the performance issues in the case the architecture does aggregate type returning differently?
If you know your target and know your compiler very well (and make sure that nothing changes the assumptions made over time) then I suppose you can take advantage of that. C++ also has return value optimization but there is no way for the author of the code to know if the various platforms/compilers will actually optimize it, so blindly relying on it can result in poor performance.
And yes, different platforms handle it differently. IIRC SysV PowerPC only supports up to 64 bits in r3,r4 but AIX POWER forces all returned structures into memory. I think SPARC ABI prior to V9 did not use registers either.
Are the performance issues in the case the architecture does aggregate type returning differently?