Skip to content

add extract_bits and deposit_bits intrinsics - #164876

Open
malezjaa wants to merge 1 commit into
rust-lang:mainfrom
malezjaa:add-pext-and-pdep-intrinsics
Open

malezjaa wants to merge 1 commit into
rust-lang:mainfrom
malezjaa:add-pext-and-pdep-intrinsics

Conversation

@malezjaa

@malezjaa malezjaa commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Tracking issue: #149069

LLVM 23 introduced generic intrinsics for pext (extract_bits) and pdep (deposit_bits)

@rustbot

rustbot commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

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

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

Any special-casing of Miri in the standard library requires review.

cc @rust-lang/miri

⚠️ #[miri::intrinsic_fallback_is_spec] must only be used if the function actively checks for all UB cases,
and explores the possible non-determinism of the intrinsic.

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 Oct 24, 2026
@rustbot

rustbot commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

r? @JohnTitor

rustbot has assigned @JohnTitor.
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 37 candidates
  • Random selection from ChrisDenton, JohnTitor, Mark-Simulacrum, thomcc

@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung added the llm-assisted An LLM-assisted PR as defined by the LLM policy. Requires ahead-of-time consent by assignee. label Oct 25, 2026
@RalfJung

Copy link
Copy Markdown
Member

Tests were made by AI, but I understand how they work.

FWIW our policy disallows code generation, and there is no exception for tests. For those you're supposed to have a pre-arranged reviewer who agreed to reviewing LLM code.

@malezjaa

Copy link
Copy Markdown
Contributor Author

Oh right, I'll close this and open a new pr with tests made by me If that's okay

@malezjaa malezjaa closed this Oct 25, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 25, 2026
@RalfJung

Copy link
Copy Markdown
Member

You can also update this PR. Or you can make it a draft and ask for a reviewer on Zulip. Whatever you prefer.

@malezjaa malezjaa reopened this Oct 25, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 25, 2026
Comment thread library/core/src/intrinsics/mod.rs Outdated
#[unstable(feature = "uint_gather_scatter_bits", issue = "149069")]
#[rustc_const_unstable(feature = "uint_gather_scatter_bits", issue = "149069")]
#[miri::intrinsic_fallback_is_spec]
pub const fn pext<T: [const] fallback::Pext>(x: T, mask: T) -> T {

@RalfJung RalfJung Oct 25, 2026 •

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.

These names are extremely opaque and make little sense to me.

Please name intrinsics more like the Rust operation than their often obscure LLVM name. You can mention the LLVM name in the docs.

View changes since the review

@malezjaa
malezjaa force-pushed the add-pext-and-pdep-intrinsics branch from b457daf to 50266b1 Compare October 25, 2026 12:28
@malezjaa malezjaa changed the title add pext and pdep intrinsics add extract_bits and deposit_bits intrinsics Oct 25, 2026
@rust-log-analyzer

This comment has been minimized.

@malezjaa
malezjaa force-pushed the add-pext-and-pdep-intrinsics branch from 50266b1 to 3e22e48 Compare October 25, 2026 13:16

This branch has not been deployed

No deployments
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. llm-assisted An LLM-assisted PR as defined by the LLM policy. Requires ahead-of-time consent by assignee. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants