Skip to content

atomic volatile: add intrinsics - #160058

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
RalfJung:atomic-volatile
Aug 17, 2026
Merged

atomic volatile: add intrinsics#160058
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
RalfJung:atomic-volatile

Conversation

@RalfJung

@RalfJung RalfJung commented Jul 28, 2026

Copy link
Copy Markdown
Member

View all comments

Extend the atomic load/store intrinsics to also support volatile atomic load/store.
Tracking issue: #158947.
Library APIs that use these intrinsics will be added inn a future PR.

The GCC and cranelift implementations ignore the volatile flag, not sure how that should be implemented for them.

@rustbot

rustbot commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

rustc_codegen_gcc is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_gcc instead.

cc @antoyo, @GuillaumeGomez

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @oli-obk, @lcnr

rustc_codegen_cranelift is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_cranelift instead.

cc @bjorn3

miri is developed in its own repository. If the Miri part of this change can be broken out, consider making this change to rust-lang/miri instead. However, if Miri needs adjusting for rustc changes, just ignore this message.

cc @rust-lang/miri

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 28, 2026
@rustbot

rustbot commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

r? @nia-e

rustbot has assigned @nia-e.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 12 candidates
  • Random selection from 6 candidates

@rust-log-analyzer

This comment has been minimized.

@nia-e

nia-e commented Jul 28, 2026

Copy link
Copy Markdown
Member

library stuff looks fine, but the rest is not my prerogative :D

r? compiler

@rustbot rustbot assigned TaKO8Ki and unassigned nia-e Jul 28, 2026
@rust-log-analyzer

This comment has been minimized.

@bjorn3

bjorn3 commented Jul 28, 2026

Copy link
Copy Markdown
Member

Cranelift doesn't currently have a way to do volatile memory operations. In the past this was not an issue given the lack of optimizations on memory operations, but those recently got added, so volatile support now needs to be added on the Cranelift side.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred to the CTFE machinery

cc @oli-obk, @lcnr

@rustbot

This comment has been minimized.

@RalfJung

Copy link
Copy Markdown
Member Author

Rerolling since we have not heard from the assigned reviewer.
@rustbot reroll

@rustbot rustbot assigned JohnTitor and unassigned TaKO8Ki Aug 16, 2026
_ty: Type<'gcc>,
ptr: RValue<'gcc>,
order: AtomicOrdering,
_volatile: bool, // FIXME we are ignoring this

@RalfJung RalfJung Aug 16, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

cc @antoyo, @GuillaumeGomez what do you propose we do about these FIXME? How should volatile atomic operations be handled in the GCC backend?

View changes since the review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Usually, you make something volatile by calling make_volatile() on the type used for the operation, but it seems it is already done here.
And I don't remember why we already call make_volatile() here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah okay. I have adjusted the comment accordingly, thanks.

@rustbot

rustbot commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@JohnTitor JohnTitor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The changes except for Cranelift look good. I'd ask for the maintainers but if it's ok to leave FIXMEs on Cranelift, feel free to r=me+(other reviewers).

View changes since this review

@bjorn3

bjorn3 commented Aug 17, 2026

Copy link
Copy Markdown
Member

cg_clif changes LGTM.

@RalfJung

Copy link
Copy Markdown
Member Author

@bors r=JohnTitor

@bjorn3

bjorn3 commented Aug 17, 2026

Copy link
Copy Markdown
Member

Github tells me "Merge status cannot be loaded", maybe that is why bors ignores it?

@bors r=JohnTitor

@bjorn3

bjorn3 commented Aug 17, 2026

Copy link
Copy Markdown
Member

There is an active github outage according to the status page.

@rust-bors

rust-bors Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 78a3e30 has been approved by JohnTitor

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Aug 17, 2026
@RalfJung

Copy link
Copy Markdown
Member Author

Yeah everything is super slow currently or doesn't load at all.

@rust-bors

rust-bors Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 78a3e30 has been approved by JohnTitor

It is now in the queue for this repository.

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 17, 2026
atomic volatile: add intrinsics

Extend the atomic load/store intrinsics to also support volatile atomic load/store.
Tracking issue: rust-lang#158947.
Library APIs that use these intrinsics will be added inn a future PR.

The GCC and cranelift implementations ignore the volatile flag, not sure how that should be implemented for them.
rust-bors Bot pushed a commit that referenced this pull request Aug 17, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #161221 (`rust-analyzer` subtree update)
 - #161232 (Subtree sync for rustc_codegen_cranelift)
 - #160058 (atomic volatile: add intrinsics)
 - #161206 (Library lock file update)
 - #160905 (implement <IpAddr, SocketAddr>::unspecified_from())
 - #160986 (Move `LateParamRegion` to `rustc_type_ir`)
 - #161145 (Remove references to the obsolete `try-perf` branch)
 - #161197 (citool: update rust crates)
 - #161225 (Add regression test for lint panic on nested generic with default type param)
 - #161229 (rustc_target: couple AArch64 LLVM and cfg pauthtest ABIs)
 - #161230 (rename `#[rustc_dump_predicates]` to `#[rustc_dump_clauses]`)
 - #161237 (Remove jdno from infra-ci rotation)
@rust-bors
rust-bors Bot merged commit 765bc48 into rust-lang:main Aug 17, 2026
13 checks passed
rust-bors Bot pushed a commit that referenced this pull request Aug 17, 2026
Rollup merge of #160058 - RalfJung:atomic-volatile, r=JohnTitor

atomic volatile: add intrinsics

Extend the atomic load/store intrinsics to also support volatile atomic load/store.
Tracking issue: #158947.
Library APIs that use these intrinsics will be added inn a future PR.

The GCC and cranelift implementations ignore the volatile flag, not sure how that should be implemented for them.
@rustbot rustbot added this to the 1.100.0 milestone Aug 17, 2026
@RalfJung
RalfJung deleted the atomic-volatile branch August 18, 2026 08:44
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Aug 19, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#161221 (`rust-analyzer` subtree update)
 - rust-lang/rust#161232 (Subtree sync for rustc_codegen_cranelift)
 - rust-lang/rust#160058 (atomic volatile: add intrinsics)
 - rust-lang/rust#161206 (Library lock file update)
 - rust-lang/rust#160905 (implement <IpAddr, SocketAddr>::unspecified_from())
 - rust-lang/rust#160986 (Move `LateParamRegion` to `rustc_type_ir`)
 - rust-lang/rust#161145 (Remove references to the obsolete `try-perf` branch)
 - rust-lang/rust#161197 (citool: update rust crates)
 - rust-lang/rust#161225 (Add regression test for lint panic on nested generic with default type param)
 - rust-lang/rust#161229 (rustc_target: couple AArch64 LLVM and cfg pauthtest ABIs)
 - rust-lang/rust#161230 (rename `#[rustc_dump_predicates]` to `#[rustc_dump_clauses]`)
 - rust-lang/rust#161237 (Remove jdno from infra-ci rotation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants