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
@Enselic
Copy link
Member

Enselic commented Nov 20, 2025

@GuillaumeGomez i noticed you and @antoyo are the only members of https://github.com/rust-lang/team/blob/main/teams/wg-gcc-backend.toml.

Is there anything blocking you from r:ing and not just approving?

@GuillaumeGomez
Copy link
Member

Just waiting for @antoyo to have a look.

Copy link
Contributor

@antoyo antoyo left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.

The next time you want to make changes only in rustc_codegen_gcc, please make a PR directly in the subtree repository.

View changes since this review

@antoyo
Copy link
Contributor

antoyo commented Dec 13, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 13, 2025

📌 Commit 6d2e82b has been approved by antoyo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 13, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Dec 13, 2025
…toyo

Update `rustc_codegen_gcc` rotate operation document

## 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

- Removed the TODO comment that suggested implementing the algorithm from https://blog.regehr.org/archives/1063
bors added a commit that referenced this pull request Dec 13, 2025
Rollup of 11 pull requests

Successful merges:

 - #145278 (Update `rustc_codegen_gcc` rotate operation document)
 - #148825 (Add SystemTime::{MIN, MAX})
 - #148837 (Use `let...else` instead of `match foo { ... _ => return };` and `if let ... else return`)
 - #149177 (Add proper suggestion for associated function with unknown field)
 - #149843 (Inherit attributes in delegation)
 - #149860 (Fix: Prevent macro-expanded extern crates from shadowing extern arguments)
 - #149874 (Weak for Arc pointer is marked as DynSend/DynSync)
 - #149903 (Remove unused code in `cfg_old`)
 - #149911 (bootstrap: Don't pass an unused `--color` to compiletest)
 - #149916 (Add a sanity check in case of any duplicate nodes)
 - #149924 (`declare_lint_pass` for `INLINE_ALWAYS_MISMATCHING_TARGET_FEATURES`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Dec 13, 2025
Rollup of 10 pull requests

Successful merges:

 - #145278 (Update `rustc_codegen_gcc` rotate operation document)
 - #148837 (Use `let...else` instead of `match foo { ... _ => return };` and `if let ... else return`)
 - #149177 (Add proper suggestion for associated function with unknown field)
 - #149843 (Inherit attributes in delegation)
 - #149860 (Fix: Prevent macro-expanded extern crates from shadowing extern arguments)
 - #149874 (Weak for Arc pointer is marked as DynSend/DynSync)
 - #149903 (Remove unused code in `cfg_old`)
 - #149911 (bootstrap: Don't pass an unused `--color` to compiletest)
 - #149916 (Add a sanity check in case of any duplicate nodes)
 - #149924 (`declare_lint_pass` for `INLINE_ALWAYS_MISMATCHING_TARGET_FEATURES`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 397339e into rust-lang:main Dec 13, 2025
10 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Dec 13, 2025
rust-timer added a commit that referenced this pull request Dec 13, 2025
Rollup merge of #145278 - notJoon:doc/rotate-operation, r=antoyo

Update `rustc_codegen_gcc` rotate operation document

## 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

- Removed the TODO comment that suggested implementing the algorithm from https://blog.regehr.org/archives/1063
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

7 participants