================
@@ -277,6 +313,22 @@ ABIArgInfo SparcV9ABIInfo::classifyType(QualType Ty,
unsigned SizeLimit,
return ABIArgInfo::getExtend(Ty);
}
+ // When being GCC-compatible, cast a complex char, short and int to an
integer
+ // type of the right size to get the correct scalar-like behavior. Other
+ // complex types fall through and are treated like a struct containing the
+ // real and imaginary parts, e.g. `{ i64, i64 }` or `{ double, double }`.
+ if (IsComplexGnuABI) {
+ const auto *CT = Ty->getAs<ComplexType>();
+ if (CT && CT->getElementType()->isIntegerType()) {
+ uint64_t ElementTypeSize = Context.getTypeSize(CT->getElementType());
+ if (ElementTypeSize < 32) {
----------------
folkertdev wrote:
I've changed that to `<= 32`, it already worked in practice before (so,
fallthrough had the same effect) but based on the GCC source this is probably
more correct. I tried `<= 64` too but that failed.
https://github.com/gcc-mirror/gcc/blob/28f2250ad1d37f49edb0efd1d88e3877257ab4a1/gcc/config/sparc/sparc.cc#L6646-L6655
I'm validating the implementation with a cross-compiling version of
https://github.com/Gankra/abi-cafe, which just fuzzes the cartesian product of
clang (on this branch) versus GCC with a wide variety of signatures.
https://github.com/llvm/llvm-project/pull/212340
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits