Fix arm64 argument alignment abi for composite type of size <= 16 bytes

This commit is contained in:
Urjasvi Suthar
2026-07-14 21:33:39 +05:30
parent a6af2551c6
commit 38788c0348
4 changed files with 60 additions and 15 deletions

View File

@@ -1342,22 +1342,8 @@ namespace lbAbiArm64 {
} else if (size <= 8) {
cast_type = LLVMIntTypeInContext(c, cast(unsigned)(size*8));
} else {
unsigned count = cast(unsigned)((size+7)/8);
LLVMTypeRef llvm_i64 = LLVMIntTypeInContext(c, 64);
LLVMTypeRef *types = gb_alloc_array(temporary_allocator(), LLVMTypeRef, count);
i64 size_copy = size;
for (unsigned i = 0; i < count; i++) {
if (size_copy >= 8) {
types[i] = llvm_i64;
} else {
types[i] = LLVMIntTypeInContext(c, 8*cast(unsigned)size_copy);
}
size_copy -= 8;
}
GB_ASSERT(size_copy <= 0);
cast_type = LLVMStructTypeInContext(c, types, count, true);
cast_type = llvm_array_type(llvm_i64, 2);
}
args[i] = lb_arg_type_direct(type, cast_type, nullptr, nullptr);
} else {