Skip to content

add ACLE random number generation intrinsics#2050

Open
folkertdev wants to merge 3 commits intorust-lang:mainfrom
folkertdev:aarch64-rand
Open

add ACLE random number generation intrinsics#2050
folkertdev wants to merge 3 commits intorust-lang:mainfrom
folkertdev:aarch64-rand

Conversation

@folkertdev
Copy link
Contributor

tracking issue: rust-lang/rust#153514

@folkertdev
Copy link
Contributor Author

cc @adamgemmell to check that this makes sense.

Internally the feature appears to be called rng, but LLVM uses rand as the target feature name. The rand target feature is already stable, it just looks like the intrinsics for it were never added.

@folkertdev folkertdev marked this pull request as ready for review March 6, 2026 20:47
@rustbot
Copy link
Collaborator

rustbot commented Mar 6, 2026

r? @sayantn

rustbot has assigned @sayantn.
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: @Amanieu, @folkertdev, @sayantn
  • @Amanieu, @folkertdev, @sayantn expanded to Amanieu, folkertdev, sayantn
  • Random selection from Amanieu, sayantn

Copy link
Contributor

@sayantn sayantn left a comment

Choose a reason for hiding this comment

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

Mostly lgtm, just some nits

View changes since this review


unsafe extern "unadjusted" {
#[cfg_attr(
any(target_arch = "aarch64", target_arch = "arm64ec"),
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you need these cfg_attrs here, as this is the aarch64 module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right. I based this off of mte.rs so I've removed the cfg_attrs there too.

@folkertdev folkertdev force-pushed the aarch64-rand branch 2 times, most recently from 5db9698 to 0cf01e1 Compare March 12, 2026 21:37
/// SAFETY: See `__arm_mte_create_random_tag`.
#[inline]
#[target_feature(enable = "mte")]
#[cfg_attr(test, assert_instr(addg))]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#[cfg_attr(test, assert_instr(addg))]
#[cfg_attr(test, assert_instr(addg, OFFSET=0))]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants