Skip to content

Stabilize LoongArch64 SIMD Intrinsics - #2221

Open
heiher wants to merge 2 commits into
rust-lang:mainfrom
heiher:stabilize-loong64-simd
Open

Stabilize LoongArch64 SIMD Intrinsics#2221
heiher wants to merge 2 commits into
rust-lang:mainfrom
heiher:stabilize-loong64-simd

Conversation

@heiher

@heiher heiher commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Tracking issue: rust-lang/rust#162508

LoongArch64 SIMD intrinsics are already used by rustc itself and by a number of downstream projects. Experience from these real-world uses indicates that the API is ready for stabilization. Stabilizing the intrinsics would remove the nightly requirement for applications that currently depend on them.

API surface

Note for subtree update

Remove this line: https://github.com/rust-lang/rust/blob/1edd55dcfcd573872c727fa3e086369a71661ee0/compiler/rustc_span/src/lib.rs#L20

@rustbot

rustbot commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

r? @folkertdev

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

Comment on lines 910 to 915
#[inline]
#[target_feature(enable = "lasx")]
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
#[stable(feature = "stdarch_loongarch_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn lasx_xvsrar_b(a: m256i, b: m256i) -> m256i {
unsafe { transmute(__lasx_xvsrar_b(transmute(a), transmute(b))) }
}

@tgross35 tgross35 Sep 9, 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.

What's the reason for changing the feature name?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What's the reason for changing the feature name?

There are also some unstable APIs gated by stdarch_loongarch. Having both stable and unstable APIs gated by the same feature name causes the following error:

error[E0711]: feature `stdarch_loongarch` is declared stable, but was previously declared unstable

Also, putting the SIMD intrinsics under stdarch_loongarch_simd makes the categorization more explicit, similar to stdarch_loongarch_crc.

@tgross35

tgross35 commented Sep 9, 2026

Copy link
Copy Markdown
Member

Note that this stabilizes more cases of rustc_legacy_const_generics, which was discussed at rust-lang/rust#149654. Cc @rust-lang/lang

Nominating since that's probably worth clarifying, and also this is a lot of surface area with potential sharp edges.

@rustbot label +I-libs-nominated

@rustbot

rustbot commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Error: The feature relabel is not enabled in this repository.
To enable it add its section in the triagebot.toml in the root of the repository.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@heiher

heiher commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Note that this stabilizes more cases of rustc_legacy_const_generics, which was discussed at rust-lang/rust#149654.

Thanks for pointing this out. As far as I know, no projects currently depend on the LoongArch SIMD API signatures using the rustc_legacy_const_generics form, so there are no legacy compatibility concerns here. If adding new instances of rustc_legacy_const_generics is not desirable, we can simply remove it.

@heiher
heiher force-pushed the stabilize-loong64-simd branch from 5f1c38d to bc04e14 Compare September 9, 2026 13:11
@heiher

heiher commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

rustc_legacy_const_generics has been removed from LoongArch64 SIMD in v2.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants