[clang] [llvm] [clang][SPARC] Pass 16-aligned 16-byte structs as i128 in CC (PR #155829)

via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 29 04:25:56 PDT 2025


================
@@ -275,10 +276,14 @@ SparcV9ABIInfo::classifyType(QualType Ty, unsigned SizeLimit) const {
   // Try to use the original type for coercion.
   llvm::Type *CoerceTy = CB.isUsableType(StrTy) ? StrTy : CB.getType();
 
+  // We use a pair of i64 for 9-16 byte aggregate with 8 byte alignment.
+  // For 9-16 byte aggregates with 16 byte alignment, we use i128.
+  llvm::Type *WideTy = llvm::Type::getIntNTy(getVMContext(), 128);
+  bool UseI128 = (Size > 64) && (Size <= 128) && (Alignment == 128);
----------------
koachan wrote:

Structs larger than 16 bytes are passed indirectly, but returned in registers.

> Structures or unions larger than sixteen bytes are copied by the caller and passed indirectly; the caller will pass the address of a correctly aligned structure value.

> Structure and union return types up to thirty-two bytes in size are returned in registers.

I think for that case it's already tested in sparcv9-abi.c as the `struct medium` case?

https://github.com/llvm/llvm-project/pull/155829


More information about the cfe-commits mailing list