Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the integer calling convention, reals are passed without sign extension #82

Merged
merged 1 commit into from
Nov 1, 2018

Conversation

asb
Copy link
Collaborator

@asb asb commented Oct 23, 2018

The previous wording indicated 32-bit floats should be sign-extended
when passed in wider integer registers (e.g. when using the lp64 ABI):

  1. When passed in registers, scalars narrower than XLEN bits are widened
    according to the sign of their type up to 32 bits, then sign-extended to
    XLEN bits.
  2. Floating-point reals are passed the same way as integers of the same
    size
  3. For aggregates, bits unused due to padding, and bits past the end of
    an aggregate whose size in bits is not divisible by XLEN, are undefined.

This isn't obeyed in GCC (see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87690), and it seems likely
that the original wording simply intended to describe the behaviour
regarding selecting registers or passing on the stack, rather than
implying sign-extension.

Reword to say that reals are passed in the same way as aggregates of
the same size, which means when the float is narrower than XLEN the
extra bits are undefined.

…nsion

The previous wording indicated 32-bit floats should be sign-extended
when passed in integer registers (e.g. when using the lp64 ABI):

1) When passed in registers, scalars narrower than XLEN bits are widened
according to the sign of their type up to 32 bits, then sign-extended to
XLEN bits.
2) Floating-point reals are passed the same way as integers of the same
size
3) For aggregates, bits unused due to padding, and bits past the end of
an aggregate whose size in bits is not divisible by XLEN, are undefined.

This isn't obeyed in GCC (see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87690), and it seems likely
that the original wording simply intended to describe the behaviour
regarding selecting registers or passing on the stack, rather than
implying sign-extension.

Reword to say that reals are passed in the same way as aggregates of
the same size, which means when the float is narrower than XLEN the
extra bits are undefined.
@asb
Copy link
Collaborator Author

asb commented Oct 31, 2018

Ping?

@palmer-dabbelt
Copy link
Contributor

My understanding is that this new text matches the behavior of GCC, which is the solution we agreed on in that GCC bug. @jim-wilson does this make sense? I haven't looked deeply enough in to this to be sure.

Copy link
Collaborator

@jim-wilson jim-wilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this makes the psABI match the gcc implementation of the ABI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants