Skip to content

Commit

Permalink
Fix homogeneous_aggregate? check for aarch64 types (#12445)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrberry authored and beta-ziliani committed Sep 8, 2022
1 parent d88b708 commit 4d95e40
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions spec/std/llvm/aarch64_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,18 @@ class LLVM::ABI
info.arg_types[0].should eq(ArgType.indirect(str, nil))
info.return_type.should eq(ArgType.indirect(str, Attribute::StructRet))
end

test "does with homogeneous structs" do |abi, ctx|
str = ctx.struct([ctx.float, ctx.float, ctx.float, ctx.float])
arg_types = [str]
return_type = str

info = abi.abi_info(arg_types, return_type, true, ctx)
info.arg_types.size.should eq(1)

info.arg_types[0].should eq(ArgType.direct(str, ctx.float.array(4)))
info.return_type.should eq(ArgType.direct(str, ctx.float.array(4)))
end
end
{% end %}
end
Expand Down
2 changes: 1 addition & 1 deletion src/llvm/abi/aarch64.cr
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class LLVM::ABI::AArch64 < LLVM::ABI
end

def homogeneous_aggregate?(type)
homog_agg : {Type, UInt64}? = case type
homog_agg : {Type, UInt64}? = case type.kind
when Type::Kind::Float
return {type, 1_u64}
when Type::Kind::Double
Expand Down

0 comments on commit 4d95e40

Please sign in to comment.