[clang] [Sparc][clang] make `_Complex` ABI GCC-compatible (PR #212340)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 5 05:56:22 PDT 2026
================
@@ -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) {
----------------
koachan wrote:
AFAIK `int` will have ElementTypeSize == 32 right?
Don't we need to extend it?
https://github.com/llvm/llvm-project/pull/212340
More information about the cfe-commits
mailing list