Fix Hexagon ABI calling convention for small aggregates#151572
Open
androm3da wants to merge 2 commits intorust-lang:mainfrom
Open
Fix Hexagon ABI calling convention for small aggregates#151572androm3da wants to merge 2 commits intorust-lang:mainfrom
androm3da wants to merge 2 commits intorust-lang:mainfrom
Conversation
Small structs (<= 64 bits) were being passed with their fields split into separate arguments instead of being packed into register-sized chunks. This caused ABI mismatches. The fix properly casts small aggregates to consecutive register-sized chunks using Uniform::consecutive(), matching the Hexagon C ABI where small structs are packed into R1:0 register pair. This fixes tests like extern-pass-TwoU16s.rs and extern-pass-TwoU8s.rs.
Collaborator
Member
|
r? compiler |
Correct the handling of aggregate types in extern "C" functions to match the Hexagon ABI specification: - Aggregates up to 32 bits: passed/returned in a single register (R0) - Aggregates 33-64 bits: passed/returned in a register pair (R1:R0) - Aggregates > 64 bits: passed on stack via byval, returned via sret This fixes all tests/ui/abi/extern/ tests for Hexagon, including: - extern-pass-TwoU8s, extern-pass-TwoU16s, extern-pass-TwoU32s - extern-pass-TwoU64s, extern-pass-FiveU16s - extern-return-TwoU8s, extern-return-TwoU16s, extern-return-TwoU32s - extern-return-TwoU64s, extern-return-FiveU16s
Member
|
@rustbot reroll |
Contributor
Author
|
ping @SparrowLii |
Contributor
Author
|
Can I do a @rustbot reroll ... ? |
Contributor
Author
|
ping @jackh726 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small structs (<= 64 bits) were being passed with their fields split into separate arguments instead of being packed into register-sized chunks. This caused ABI mismatches.
The fix properly casts small aggregates to consecutive register-sized chunks using Uniform::consecutive(), matching the Hexagon C ABI where small structs are packed into R1:0 register pair.
This fixes tests like extern-pass-TwoU16s.rs and extern-pass-TwoU8s.rs.