Skip to content

Update rustc_codegen_gcc rotate operation document #145278

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

notJoon
Copy link
Contributor

@notJoon notJoon commented Aug 11, 2025

Description

This PR resolves a TODO comment in the rustc_codegen_gcc backend by documenting that the rotate operations (rotate_left and rotate_right) already implement the optimized branchless algorithm from comment.

The existing implementation already uses the optimal branchless rotation pattern:

  • For left rotation: (x << n) | (x >> (-n & (width-1)))
  • For right rotation: (x >> n) | (x << (-n & (width-1)))

This pattern avoids branches and generates efficient machine code across different platforms, which was the goal mentioned in the original TODO.

Changes

@rustbot
Copy link
Collaborator

rustbot commented Aug 11, 2025

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 11, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 11, 2025

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 11, 2025
@joshtriplett joshtriplett changed the title Update rustc_codegen_gcc roate operation document Update rustc_codegen_gcc rotate operation document Aug 11, 2025
@lcnr
Copy link
Contributor

lcnr commented Aug 12, 2025

r? rustc_codegen_gcc

@rustbot
Copy link
Collaborator

rustbot commented Aug 12, 2025

Failed to set assignee to rustc_codegen_gcc: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

@lcnr
Copy link
Contributor

lcnr commented Aug 12, 2025

r? antoyo

@rustbot rustbot assigned antoyo and unassigned lcnr Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants