Skip to content

Rollup of 5 pull requests#154757

Closed
matthiaskrgr wants to merge 14 commits intorust-lang:mainfrom
matthiaskrgr:rollup-IMZZ0nA
Closed

Rollup of 5 pull requests#154757
matthiaskrgr wants to merge 14 commits intorust-lang:mainfrom
matthiaskrgr:rollup-IMZZ0nA

Conversation

@matthiaskrgr
Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

malezjaa and others added 14 commits April 1, 2026 15:03
Instead of just using regular struct lowering for these types, which
results in an incorrect ABI (e.g. returning indirectly), use
`BackendRepr::ScalableVector` which will lower to the correct type and
be passed in registers.

This also enables some simplifications for generating alloca of scalable
vectors and greater re-use of `scalable_vector_parts`.

A LLVM codegen test demonstrating the changed IR this generates is
included in the next commit alongside some intrinsics that make these
tuples usable.
Clang changed to representing tuples of scalable vectors as
structs rather than as wide vectors (that is, scalable vector types
where the `N` part of the `<vscale x N x ty>` type was multiplied by
the number of vectors). rustc mirrored this in the initial implementation
of scalable vectors.

Earlier versions of our patches used the wide vector representation and
our intrinsic patches used the legacy
`llvm.aarch64.sve.tuple.{create,get,set}{2,3,4}` intrinsics for creating
these tuples/getting/setting the vectors, which were only supported
due to LLVM's `AutoUpgrade` pass converting these intrinsics into
`llvm.vector.insert`. `AutoUpgrade` only supports these legacy intrinsics
with the wide vector representation.

With the current struct representation, Clang has special handling in
codegen for generating `insertvalue`/`extractvalue` instructions for
these operations, which must be replicated by rustc's codegen for our
intrinsics to use. This patch implements new intrinsics in
`core::intrinsics::scalable` (mirroring the structure of
`core::intrinsics::simd`) which rustc lowers to the appropriate
`insertvalue`/`extractvalue` instructions.
Generate debuginfo for scalable vectors, following the structure that
Clang generates for scalable vectors.
Abstract over the existing `simd_cast` intrinsic to implement a new
`sve_cast` intrinsic - this is better than allowing scalable vectors to
be used with all of the generic `simd_*` intrinsics.
various fixes for scalable vectors

These are a handful of patches fixing bugs with the current `#[rustc_scalable_vector]` infrastructure so that we can upstream the intrinsics to stdarch:

1. Instead of just using regular struct lowering for tuples of scalable vectors, which results in an incorrect ABI (e.g. returning indirectly), we change to using `BackendRepr::ScalableVector` which will lower to the correct type and be passed in registers.
2. Clang changed from representing tuples of scalable vectors as structs rather than as wide vectors (that is, scalable vector types where the `N` part of the `<vscale x N x ty>` type was multiplied by the number of vectors). rustc mirrored this in the initial implementation of scalable vectors that didn't land.

   When our early patches used the wide vector representation, our intrinsic patches used the legacy `llvm.aarch64.sve.tuple.{create,get,set}{2,3,4}` intrinsics for creating these tuples/getting/setting the vectors, which were only supported due to LLVM's `AutoUpgrade` pass converting these intrinsics into `llvm.vector.insert`. `AutoUpgrade` only supports these legacy intrinsics with the wide vector representation.

   With the current struct representation, Clang has special handling in codegen for generating `insertvalue`/`extractvalue` instructions for these operations, which must be replicated by rustc's codegen for our intrinsics to use.

   We add a new `core::intrinsics::scalable` module (never intended to be stable, just used by the stdarch intrinsics, gated by `core_intrinsics`) and add new intrinsics which rustc lowers to the appropriate `insertvalue`/`extractvalue` instructions.
3. Add generation of debuginfo for scalable vectors, following the DWARF that Clang generates.
4. Some intrinsics need something like `simd_cast`, which will work for scalable vectors too, so this implements a new `sve_cast` intrinsic that uses the same internals as `simd_cast`. This seemed better than permitting scalable vectors to be used with the `simd_*` intrinsics more generally as I can't guarantee this would work for all of them.

This is a relatively large patch but most of it is tests, and each commit should be relatively standalone. It's a little bit easier to upstream them together to avoid needing to stack them.  It's possible that some more compiler fixes will be forthcoming but it's looking like this might be all at the moment.

Depends on rust-lang#153653

r? @workingjubilee (discussed on Zulip)
…d_privacy-gate, r=BoxyUwU

Add  `min_adt_const_params` gate

Add `min_adt_const_params` feature gate to disallow `ConstParamTy_` impl for types which fields visibility mismatches with struct itself

r? BoxyUwU
…asinh, r=tgross35

use libm for acosh and asinh for f16, f32, and f64

Fixes rust-lang#153878

Uses libm for `acosh` and `asinh` for `f16`, `f32`, and `f64`.
I didn't change impl for f128 as i couldn't find existing function for these in libm
…le-impls, r=TaKO8Ki

Remove an unused `StableHash` impl.

r? @TaKO8Ki
Add comment to borrow-checker

As requested by @lcnr

r? @lcnr
@rust-bors rust-bors bot added the rollup A PR which is a rollup label Apr 3, 2026
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-meta Area: Issues & PRs about the rust-lang/rust repository itself 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 Apr 3, 2026
@matthiaskrgr
Copy link
Copy Markdown
Member Author

@bors r+ rollup=never p=5

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 3, 2026

📌 Commit 6bbea3d has been approved by matthiaskrgr

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 Apr 3, 2026
@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Apr 3, 2026
Rollup of 5 pull requests

Successful merges:

 - #153286 (various fixes for scalable vectors)
 - #153592 (Add  `min_adt_const_params` gate)
 - #154051 (use libm for acosh and asinh for f16, f32, and f64)
 - #154743 (Remove an unused `StableHash` impl.)
 - #154752 (Add comment to borrow-checker)
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job dist-i586-gnu-i586-i686-musl failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- num::floats::acosh::test_f32 stdout ----

thread 'num::floats::acosh::test_f32' (485751) panicked at /rustc/7714c6e523c3fed7bb3a6f7b693f6d7245cbf3a0/library/coretests/tests/num/floats.rs:1745:9:
89.415985 is not approximately equal to 89.415985 (threshold 1e-6, difference 1.1252064e-6)
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/7714c6e523c3fed7bb3a6f7b693f6d7245cbf3a0/library/std/src/panicking.rs:689:5
   1: core::panicking::panic_fmt
             at /rustc/7714c6e523c3fed7bb3a6f7b693f6d7245cbf3a0/library/core/src/panicking.rs:80:14
   2: coretests::num::floats::acosh::test_f32::do_panic::runtime
             at /rustc/7714c6e523c3fed7bb3a6f7b693f6d7245cbf3a0/library/coretests/tests/num/floats.rs:246:9
   3: coretests::num::floats::acosh::test_f32::do_panic
             at /rustc/7714c6e523c3fed7bb3a6f7b693f6d7245cbf3a0/library/coretests/tests/num/floats.rs:246:9
   4: coretests::num::floats::acosh::test_f32
             at /rustc/7714c6e523c3fed7bb3a6f7b693f6d7245cbf3a0/library/coretests/tests/num/floats.rs:246:9
   5: coretests::num::floats::acosh::test_f32::{closure#0}
             at /rustc/7714c6e523c3fed7bb3a6f7b693f6d7245cbf3a0/library/coretests/tests/num/floats.rs:338:26
---
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- num::floats::acosh::test_f32 stdout end ----
---- num::floats::asinh::test_f32 stdout ----

thread 'num::floats::asinh::test_f32' (485754) panicked at /rustc/7714c6e523c3fed7bb3a6f7b693f6d7245cbf3a0/library/coretests/tests/num/floats.rs:1714:9:
89.415985 is not approximately equal to 89.415985 (threshold 1e-6, difference 1.1252064e-6)
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/7714c6e523c3fed7bb3a6f7b693f6d7245cbf3a0/library/std/src/panicking.rs:689:5
   1: core::panicking::panic_fmt
             at /rustc/7714c6e523c3fed7bb3a6f7b693f6d7245cbf3a0/library/core/src/panicking.rs:80:14
   2: coretests::num::floats::asinh::test_f32::do_panic::runtime
             at /rustc/7714c6e523c3fed7bb3a6f7b693f6d7245cbf3a0/library/coretests/tests/num/floats.rs:246:9
   3: coretests::num::floats::asinh::test_f32::do_panic
             at /rustc/7714c6e523c3fed7bb3a6f7b693f6d7245cbf3a0/library/coretests/tests/num/floats.rs:246:9
   4: coretests::num::floats::asinh::test_f32
             at /rustc/7714c6e523c3fed7bb3a6f7b693f6d7245cbf3a0/library/coretests/tests/num/floats.rs:246:9
   5: coretests::num::floats::asinh::test_f32::{closure#0}
             at /rustc/7714c6e523c3fed7bb3a6f7b693f6d7245cbf3a0/library/coretests/tests/num/floats.rs:338:26

@rust-bors rust-bors bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 3, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 3, 2026

💔 Test for 7714c6e failed: CI. Failed job:

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 3, 2026

This pull request was unapproved due to being closed.

@rust-bors rust-bors bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 3, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 3, 2026
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. A-meta Area: Issues & PRs about the rust-lang/rust repository itself rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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