Skip to content

Conversation

@willieyz
Copy link
Collaborator

@willieyz willieyz commented Oct 22, 2025

  • We discovered this issue during Add instruction support for Curve25519 armv7-M optimization tasks #341, when we tried to optimize some assembly code that included ldr instructions. The args_in_out_different restriction made it harder for Slothy to find a solution in scenarios where the number of available registers was limited.

  • This PR removes the restriction in the make() function of ldr and ldr_with_imm, namely the line:
    obj.args_in_out_different = [(0, 0)] # Can't have Rd==Ra.
    we believe this is wrong restriction for ldr, ldr_imm, ldrh_with_imm and ldrb_with_imm

@willieyz willieyz force-pushed the fix-wrong-args_in_out_different branch from b905c0b to f4cf524 Compare October 22, 2025 06:29
@willieyz willieyz force-pushed the fix-wrong-args_in_out_different branch from f4cf524 to 508746c Compare October 22, 2025 08:08
@willieyz willieyz marked this pull request as ready for review October 23, 2025 16:41
@mkannwischer mkannwischer force-pushed the fix-wrong-args_in_out_different branch from 508746c to fb9aa3e Compare October 24, 2025 00:42
- This commit removes the restriction in the `make()` function of `ldr`,
  `ldr_with_imm`, `ldrb_with_imm` and  `ldrh_with_imm`, namely the line:

  `obj.args_in_out_different = [(0, 0)] # Can't have Rd==Ra`.

- This restriction makes it harder for Slothy to find a solution
  in scenarios where the number of available registers was limited.

Signed-off-by: willieyz <[email protected]>
@mkannwischer mkannwischer force-pushed the fix-wrong-args_in_out_different branch from fb9aa3e to 2276749 Compare November 19, 2025 06:56
Copy link
Collaborator

@mkannwischer mkannwischer left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @willieyz.

@mkannwischer mkannwischer changed the title archv7-m: removing the wrong args_in_out_different Armv7-M: Removing the wrong args_in_out_different for ldr/ldrb/ldrh Nov 19, 2025
@mkannwischer mkannwischer merged commit bdcf3fd into main Nov 19, 2025
38 checks passed
@mkannwischer mkannwischer deleted the fix-wrong-args_in_out_different branch November 19, 2025 08:00
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.

3 participants