Skip to content

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.

5 participants