Commit graph

2355 commits

Author SHA1 Message Date
Antoni Boucher
e8282659f9 Update to nightly-2026-01-30 2026-01-30 11:16:35 -05:00
Antoni Boucher
dffd4ab825 Ignore failing UI test 2026-01-30 11:16:35 -05:00
Antoni Boucher
d299dce03a Fix the name of failing UI tests 2026-01-30 11:16:35 -05:00
Antoni Boucher
ff4db77564 Fix spelling mistake 2026-01-30 11:16:35 -05:00
Antoni Boucher
ee9967bac0 Fix clippy warning 2026-01-30 11:16:35 -05:00
Antoni Boucher
bd71a5f4b0 Implement new f16/f128 intrinsics and implement dummy va_end 2026-01-28 17:02:09 -05:00
Antoni Boucher
49c9b0a7bf Update to nightly-2026-01-28 2026-01-28 17:01:51 -05:00
Antoni Boucher
7db4614d46 Merge branch 'master' into sync_from_rust_2026_01_28 2026-01-28 15:45:16 -05:00
antoyo
48a52d9c0c
Merge pull request #843 from rust-lang/fix/debuginfo-lang-filename
Set gcc language name and compilation unit name
2026-01-28 14:54:27 -05:00
Antoni Boucher
4a6325de8d Set gcc language name and compilation unit name 2026-01-28 14:13:44 -05:00
antoyo
94e2af7a16
Merge pull request #841 from GuillaumeGomez/more-mapping
Add two new target-specific intrinsics mapping
2026-01-27 08:41:23 -05:00
xtqqczze
b7728f072e Omit standard copyright notice
Remove copyright notices for files licensed under the standard terms (MIT OR Apache-2.0).
2026-01-26 17:31:34 +00:00
Guillaume Gomez
436ae1e0a0 Add regression test for llvm.sqrt.v4f64 and llvm.smax.v4i32 mapping 2026-01-26 18:25:25 +01:00
Guillaume Gomez
25234f8652 Add two new target-specific intrinsics mapping 2026-01-26 18:24:52 +01:00
antoyo
774c8a2912
Merge pull request #840 from GuillaumeGomez/sqrt-f32-intrinsic
Add missing intrinsic translation for `llvm.sqrt.f32`
2026-01-25 21:19:19 -05:00
Guillaume Gomez
d3df4bdba5 Add regression test for <https://github.com/rust-lang/rustc_codegen_gcc/issues/288> 2026-01-25 21:09:22 +01:00
Guillaume Gomez
81acbae770 Add missing intrinsic translation for llvm.sqrt.f32 2026-01-25 21:02:34 +01:00
bors
d8306375a7 Auto merge of #151065 - nagisa:add-preserve-none-abi, r=petrochenkov
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?)
2026-01-25 02:49:32 +00:00
Matthias Krüger
87c0c90ac0 Rollup merge of #151346 - folkertdev:simd-splat, r=workingjubilee
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:

- https://github.com/rust-lang/rust/issues/60637
- https://github.com/rust-lang/rust/issues/137407
- https://github.com/rust-lang/rust/issues/122623
- https://github.com/rust-lang/rust/issues/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.
2026-01-24 21:04:15 +01:00
antoyo
bcb24ceaba
Merge pull request #834 from rust-lang/fix/unreachable-segfault
Fix segfault related to __builtin_unreachable with inline asm
2026-01-24 13:26:20 -05:00
Antoni Boucher
58156c5cab Fix segfault related to __builtin_unreachable with inline asm 2026-01-24 12:30:39 -05:00
Simonas Kazlauskas
0cb56dc92c 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?)
2026-01-24 19:23:17 +02:00
Jacob Pratt
56d32942a5 Rollup merge of #149209 - lto_refactors8, r=jackh726
Move LTO to OngoingCodegen::join

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

Follow up to https://github.com/rust-lang/rust/pull/147810
Part of https://github.com/rust-lang/compiler-team/issues/908
2026-01-21 02:04:01 -05:00
Folkert de Vries
012c4603b7 c_variadic: use Clone instead of LLVM va_copy 2026-01-20 18:38:50 +01:00
Folkert de Vries
e0b87e4dd5 simd_splat: custom error in gcc backend for invalid element type 2026-01-19 16:56:20 +01:00
Folkert de Vries
f11abba641 add simd_splat intrinsic 2026-01-19 16:48:28 +01:00
Guillaume Gomez
9b2d8e5c91
Merge pull request #824 from GuillaumeGomez/regen-intrinsics
Regenerate intrinsics
2026-01-16 22:32:07 +01:00
Guillaume Gomez
2177aa9ac7 Manually include intrinsic conversion that is not present in LLVM files 2026-01-16 18:55:09 +01:00
Guillaume Gomez
4f59819c26 Regenerate intrinsics 2026-01-16 17:46:34 +01:00
Guillaume Gomez
40973efd1c
Merge pull request #823 from GuillaumeGomez/simplify-intrinsics-generation
Simplify intrinsics generation
2026-01-16 17:45:40 +01:00
Guillaume Gomez
c848b28a5d Ignore src/intrinsic/old_archs.rs for typo checks 2026-01-16 17:14:09 +01:00
Guillaume Gomez
3dc60d0bf1 Simplify intrinsics translation generation script 2026-01-16 16:52:09 +01:00
Guillaume Gomez
3e789ed576 Stop cloning old llvmint repositories to generate intrinsics 2026-01-16 16:52:09 +01:00
Nicholas Nethercote
c9a063ced9 Remove Deref/DerefMut impl for Providers.
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.
2026-01-14 15:55:59 +11:00
Martin Nordholts
fe0facf0f6 Finish transition from semitransparent to semiopaque for rustc_macro_transparency 2026-01-08 19:14:45 +01:00
bjorn3
ea8f037c76 Fix compilation of cg_gcc with master feature disabled 2025-12-27 18:41:14 +00:00
bjorn3
5bcd472b86 Partially inline get_fn_addr/get_fn in codegen_llvm_intrinsic_call
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.
2025-12-27 17:46:26 +00:00
bjorn3
56be08eb45 Pass Function to Builder::function_call in cg_gcc 2025-12-27 17:46:26 +00:00
bjorn3
0462ce9934 Don't assume get_fn is only called from codegen_mir in cg_gcc 2025-12-27 17:46:26 +00:00
bjorn3
9ba3ed5423 Move llvm intrinsic call to backend 2025-12-27 17:46:25 +00:00
Guillaume Gomez
bf5283cf6f Merge commit '02f889aec5' 2025-12-21 00:13:38 +01:00
antoyo
02f889aec5
Merge pull request #820 from rust-lang/sync_from_rust_2025_12_20
Sync from rust 2025/12/20
2025-12-20 18:08:23 -05:00
Antoni Boucher
1ac26a7b1c Add new failing tests 2025-12-20 17:31:53 -05:00
Antoni Boucher
93cf63b789 Move libgccjit.so to the new location within the sysroot 2025-12-20 17:08:08 -05:00
Antoni Boucher
cd8cc6ff38 Update to nightly-2025-12-20 2025-12-20 16:43:54 -05:00
Antoni Boucher
cf522c098c Merge branch 'master' into sync_from_rust_2025_12_20 2025-12-20 16:43:21 -05:00
David Wood
11bc2e0907 codegen: implement repr(scalable)
Introduces `BackendRepr::ScalableVector` corresponding to scalable
vector types annotated with `repr(scalable)` which lowers to a scalable
vector type in LLVM.

Co-authored-by: Jamie Cunliffe <Jamie.Cunliffe@arm.com>
2025-12-16 11:00:12 +00:00
Antoni Boucher
f0418b3461 When we cannot load libgccjit.so, show the paths that were tried 2025-12-15 08:35:17 -05:00
bors
09c34cbac3 Auto merge of #149709 - Urgau:overhaul-filenames, r=davidtwco
Overhaul filename handling for cross-compiler consistency

This PR overhauls the way we handle filenames in the compiler and `rmeta` in order to achieve achieve cross-compiler consistency (ie. having the same path no matter if the filename was created in the current compiler session or is coming from `rmeta`).

This is required as some parts of the compiler rely on consistent paths for the soundness of generated code (see rust-lang/rust#148328).

In order to achieved consistency multiple steps are being taken by this PR:
 - by making `RealFileName` immutable
 - by only having `SourceMap::to_real_filename` create `RealFileName`
   - currently `RealFileName` can be created from any `Path` and are remapped afterwards, which creates consistency issue
 - by also making `RealFileName` holds it's working directory, embeddable name and the remapped scopes
   - this removes the need for a `Session`, to know the current(!) scopes and cwd, which is invalid as they may not be equal to the scopes used when creating the filename

In order for `SourceMap::to_real_filename` to know which scopes to apply `FilePathMapping` now takes the current remapping scopes to apply, which makes `FileNameDisplayPreference` and company useless and are removed.

This PR is split-up in multiple commits (unfortunately not atomic), but should help review the changes.

Unblocks https://github.com/rust-lang/rust/pull/147611
Fixes https://github.com/rust-lang/rust/issues/148328
2025-12-13 14:32:09 +00:00
Jacob Pratt
2afb92fe61 Rollup merge of #148837 - estebank:let-else, r=Kivooeo
Use `let...else` instead of `match foo { ... _ => return };` and `if let ... else return`
2025-12-13 00:55:55 -05:00