[Sparc][clang] make `_Complex` ABI GCC-compatible (#212340)
Modify the ABI of `_Complex` so that it matches GCC for all types,
specifically:
- On SPARC, a `_Complex` value with an integer element type is now
passed and
returned packed into the one or two integer registers it fits in,
matching GCC.
Clang previously passed such a value indirectly and returned it with one
part
per register.
`-fclang-abi-compat=23` restores the previous behavior.
- On SPARC64, a `_Complex char` or `_Complex short` is now
right-justified in its slot in the parameter array, like every other
scalar
narrower than a slot, rather than left-justified the way a small struct
is.
`-fclang-abi-compat=23` restores the previous behavior.
Complex integers are a GNU extension, but generally clang is compatible
with GCC. Really, you might as well be, deviating can only bite users.
I've now validated the implementation with
https://github.com/folkertdev/powerpc-complex-abi-validation which
compiles various signatures using `_Complex` with GCC and Clang and
checks that values make it from one side to the other.
related:
- https://github.com/rust-lang/rust/issues/154023
- https://github.com/llvm/llvm-project/pull/208917
- https://github.com/llvm/llvm-project/pull/212119