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

Make-reference-arguments also applies to #swap #818

Merged
merged 1 commit into from
Jun 3, 2024
Merged

Make-reference-arguments also applies to #swap #818

merged 1 commit into from
Jun 3, 2024

Conversation

vbgl
Copy link
Member

@vbgl vbgl commented May 30, 2024

Fixes #815

let sig := [:: sig; sig ] in
Let: (prologue, es) := make_prologue ii X 0 sig es in
Let: (xs, epilogue) := make_epilogue ii X sig xs in
ok (prologue ++ MkI ii (Copn xs tg (Opseudo_op (pseudo_operator.Oswap ty)) es) :: epilogue)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a code like this
let tg := if Nat.eqb (size prologue) 2 &&
Nat.eqb (size epilogue) 2 then AT_none else tg in
(* I don't know why but I have a syntax error if I use == instead of Nat.eqb *)

Copy link
Contributor

Choose a reason for hiding this comment

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

The idea is that it is clearly a case where we compute address to swap them, but where the swap instruction will be never used.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you understand the syntax error ?

Copy link
Member Author

Choose a reason for hiding this comment

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

No. Coq notations dark magic.

Copy link
Contributor

Choose a reason for hiding this comment

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

We do not include all_ssreflect so you need to import eqType and probably ssrnat to be able to use == here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed. Thanks. Fixed.

bgregoir
bgregoir previously approved these changes Jun 3, 2024
@vbgl
Copy link
Member Author

vbgl commented Jun 3, 2024

Just rebased to address merge conflicts in the changelog.

@bgregoir bgregoir merged commit 43db2d8 into main Jun 3, 2024
1 check passed
@bgregoir bgregoir deleted the mra-swap branch June 3, 2024 18:25
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.

Swapping arrays
3 participants