Skip to content

Update GCC subtree#152622

Merged
rust-bors[bot] merged 75 commits intorust-lang:mainfrom
GuillaumeGomez:subtree-update_cg_gcc_2026-02-14
Feb 15, 2026
Merged

Update GCC subtree#152622
rust-bors[bot] merged 75 commits intorust-lang:mainfrom
GuillaumeGomez:subtree-update_cg_gcc_2026-02-14

Conversation

@GuillaumeGomez
Copy link
Member

cc @antoyo
r? ghost

bjorn3 and others added 30 commits November 23, 2025 10:33
This moves all LLVM intrinsic handling out of the regular call path for
cg_gcc and makes it easier to hook into this code for future cg_llvm
changes.
It's described as a "backwards compatibility hack to keep the diff
small". Removing it requires only a modest amount of churn, and the
resulting code is clearer without the invisible derefs.
…ics-generation

Simplify intrinsics generation
Move LTO to OngoingCodegen::join

This will make it easier to in the future move all this code to link_binary.

Follow up to rust-lang#147810
Part of rust-lang/compiler-team#908
This is the conceptual opposite of the rust-cold calling convention and
is particularly useful in combination with the new `explicit_tail_calls`
feature.

For relatively tight loops implemented with tail calling (`become`) each
of the function with the regular calling convention is still responsible
for restoring the initial value of the preserved registers. So it is not
unusual to end up with a situation where each step in the tail call loop
is spilling and reloading registers, along the lines of:

    foo:
        push r12
        ; do things
        pop r12
        jmp next_step

This adds up quickly, especially when most of the clobberable registers
are already used to pass arguments or other uses.

I was thinking of making the name of this ABI a little less LLVM-derived
and more like a conceptual inverse of `rust-cold`, but could not come
with a great name (`rust-cold` is itself not a great name: cold in what
context? from which perspective? is it supposed to mean that the
function is rarely called?)
Fix segfault related to __builtin_unreachable with inline asm
…bilee

add `simd_splat` intrinsic

Add `simd_splat` which lowers to the LLVM canonical splat sequence.

```llvm
insertelement <N x elem> poison, elem %x, i32 0
shufflevector <N x elem> v0, <N x elem> poison, <N x i32> zeroinitializer
```

Right now we try to fake it using one of

```rust
fn splat(x: u32) -> u32x8 {
    u32x8::from_array([x; 8])
}
```

or (in `stdarch`)

```rust
fn splat(value: $elem_type) -> $name {
    #[derive(Copy, Clone)]
    #[repr(simd)]
    struct JustOne([$elem_type; 1]);
    let one = JustOne([value]);
    // SAFETY: 0 is always in-bounds because we're shuffling
    // a simd type with exactly one element.
    unsafe { simd_shuffle!(one, one, [0; $len]) }
}
```

Both of these can confuse the LLVM optimizer, producing sub-par code. Some examples:

- rust-lang#60637
- rust-lang#137407
- rust-lang#122623
- rust-lang#97804

---

As far as I can tell there is no way to provide a fallback implementation for this intrinsic, because there is no `const` way of evaluating the number of elements (there might be issues beyond that, too). So, I added implementations for all 4 backends.

Both GCC and const-eval appear to have some issues with simd vectors containing pointers. I have a workaround for GCC, but haven't yet been able to make const-eval work. See the comments below.

Currently this just adds the intrinsic, it does not actually use it anywhere yet.
…ochenkov

abi: add a rust-preserve-none calling convention

This is the conceptual opposite of the rust-cold calling convention and is particularly useful in combination with the new `explicit_tail_calls` feature.

For relatively tight loops implemented with tail calling (`become`) each of the function with the regular calling convention is still responsible for restoring the initial value of the preserved registers. So it is not unusual to end up with a situation where each step in the tail call loop is spilling and reloading registers, along the lines of:

    foo:
        push r12
        ; do things
        pop r12
        jmp next_step

This adds up quickly, especially when most of the clobberable registers are already used to pass arguments or other uses.

I was thinking of making the name of this ABI a little less LLVM-derived and more like a conceptual inverse of `rust-cold`, but could not come with a great name (`rust-cold` is itself not a great name: cold in what context? from which perspective? is it supposed to mean that the function is rarely called?)
@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 14, 2026
@rust-log-analyzer

This comment has been minimized.

@bjorn3
Copy link
Member

bjorn3 commented Feb 14, 2026

Looks like the subtree merge didn't have any issues this time. I don't see any changes of mine getting reverted.

@GuillaumeGomez
Copy link
Member Author

@bors r+ p=1

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 14, 2026

📌 Commit 1f94802 has been approved by GuillaumeGomez

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. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 14, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 14, 2026
…cc_2026-02-14, r=GuillaumeGomez

Update GCC subtree

cc @antoyo
r? ghost
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 14, 2026
…cc_2026-02-14, r=GuillaumeGomez

Update GCC subtree

cc @antoyo
r? ghost
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 14, 2026

⌛ Testing commit 1f94802 with merge 42d651b...

Workflow: https://github.com/rust-lang/rust/actions/runs/22024338905

rust-bors bot pushed a commit that referenced this pull request Feb 14, 2026
…14, r=GuillaumeGomez

Update GCC subtree

cc @antoyo
r? ghost
@JonathanBrouwer
Copy link
Contributor

@bors yield
Yielding to enclosing rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 14, 2026

Auto build cancelled. Cancelled workflows:

The next pull request likely to be tested is #152632.

rust-bors bot pushed a commit that referenced this pull request Feb 14, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #152622 (Update GCC subtree)
 - #145024 (Optimize indexing slices and strs with inclusive ranges)
 - #151365 (UnsafePinned: implement opsem effects of UnsafeUnpin)
 - #152381 (Do not require `'static` for obtaining reflection information.)
 - #143575 (Remove named lifetimes in some `PartialOrd` & `PartialEq` `impl`s)
 - #152404 (tests: adapt align-offset.rs for InstCombine improvements in LLVM 23)
 - #152582 (rustc_query_impl: Use `ControlFlow` in `visit_waiters` instead of nested options)
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 14, 2026

⌛ Testing commit 1f94802 with merge 7ea8b56...

Workflow: https://github.com/rust-lang/rust/actions/runs/22026070155

rust-bors bot pushed a commit that referenced this pull request Feb 14, 2026
…14, r=GuillaumeGomez

Update GCC subtree

cc @antoyo
r? ghost
@JonathanBrouwer
Copy link
Contributor

@bors yield
Yielding to enclosing rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 14, 2026

Auto build cancelled. Cancelled workflows:

The next pull request likely to be tested is #152632.

rust-bors bot pushed a commit that referenced this pull request Feb 14, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #152622 (Update GCC subtree)
 - #145024 (Optimize indexing slices and strs with inclusive ranges)
 - #151365 (UnsafePinned: implement opsem effects of UnsafeUnpin)
 - #152381 (Do not require `'static` for obtaining reflection information.)
 - #143575 (Remove named lifetimes in some `PartialOrd` & `PartialEq` `impl`s)
 - #152404 (tests: adapt align-offset.rs for InstCombine improvements in LLVM 23)
 - #152582 (rustc_query_impl: Use `ControlFlow` in `visit_waiters` instead of nested options)
@rust-bors rust-bors bot merged commit 0318407 into rust-lang:main Feb 15, 2026
11 of 12 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 15, 2026
rust-timer added a commit that referenced this pull request Feb 15, 2026
Rollup merge of #152622 - GuillaumeGomez:subtree-update_cg_gcc_2026-02-14, r=GuillaumeGomez

Update GCC subtree

cc @antoyo
r? ghost
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Feb 15, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#152622 (Update GCC subtree)
 - rust-lang/rust#145024 (Optimize indexing slices and strs with inclusive ranges)
 - rust-lang/rust#151365 (UnsafePinned: implement opsem effects of UnsafeUnpin)
 - rust-lang/rust#152381 (Do not require `'static` for obtaining reflection information.)
 - rust-lang/rust#143575 (Remove named lifetimes in some `PartialOrd` & `PartialEq` `impl`s)
 - rust-lang/rust#152404 (tests: adapt align-offset.rs for InstCombine improvements in LLVM 23)
 - rust-lang/rust#152582 (rustc_query_impl: Use `ControlFlow` in `visit_waiters` instead of nested options)
@GuillaumeGomez GuillaumeGomez deleted the subtree-update_cg_gcc_2026-02-14 branch February 15, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

has-merge-commits PR has merge commits, merge with caution. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.