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

s390x: Basic support for IaddIfcout #3012

Merged
merged 1 commit into from
Jun 22, 2021

Conversation

uweigand
Copy link
Member

This adds enough support for the IaddIfcout opcode to make the
code emitted by dynamic_addr work on s390x.

Note: On s390x, the condition code mask that has to be used to
implement unsigned_add_overflow_condition does not match any of
the masks for the "normal" condition codes, so this design is
not really a good match for s390x ...

@github-actions github-actions bot added the cranelift Issues related to the Cranelift code generator label Jun 22, 2021
Copy link
Member

@cfallin cfallin left a comment

Choose a reason for hiding this comment

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

Thanks!

Just a request for a little more detail/description below to help future readers, but otherwise LGTM.

As a meta-level comment, I do think that a more self-contained instruction here -- maybe "add and trap on overflow" or something like that? -- would probably be better, as it wouldn't require special handling of flags. (The original design was pretty x86-centric, for sure.) But that's a future refactor, and this should work for now!

// can simply rely on the condition code here. However, the encoding is
// different.
assert!(condcode == IntCC::UnsignedGreaterThan);
cond = Cond::from_mask(2 | 1);
Copy link
Member

Choose a reason for hiding this comment

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

Could we add a comment here noting what these constants are (which condition flags) and how the combination of the add instruction generated by IaddIfcout and the condcode here will properly trap?

Perhaps also a note in unsigned_add_overflow_condition() would be helpful in order to describe how the condition code is actually specially handled in the one place this is known to be used.

This adds enough support for the IaddIfcout opcode to make the
code emitted by dynamic_addr work on s390x.

Note: On s390x, the condition code mask that has to be used to
implement unsigned_add_overflow_condition does not match any of
the masks for the "normal" condition codes, so this design is
not really a good match for s390x ...
@uweigand
Copy link
Member Author

Added comments.

As a meta-level comment, I do think that a more self-contained instruction here -- maybe "add and trap on overflow" or something like that? -- would probably be better, as it wouldn't require special handling of flags.

Either that, or at least some new value like IntCC::Carry (analogous to the existing IntCC::Overflow).

@cfallin cfallin merged commit b8c0ac7 into bytecodealliance:main Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants