Commit graph

2372 commits

Author SHA1 Message Date
Antoni Boucher
458adbd66a Implement fptoint_sat for f16 and f128 2026-02-13 08:12:59 -05:00
Antoni Boucher
c2b8abd810 Update to nightly-2026-02-13 2026-02-13 07:49:27 -05:00
Antoni Boucher
5b2cfe3e75 Merge branch 'master' into sync_from_rust_2026_02_12 2026-02-12 16:19:00 -05:00
Jacob Pratt
d0b2d841e7 Rollup merge of #152478 - bjorn3:lto_refactors10, r=wesleywiser
Remove tm_factory field from CodegenContext

This is necessary to support serializing the `CodegenContext` to a `.rlink` file in the future for moving LTO to the `-Zlink-only` step.

Follow up to https://github.com/rust-lang/rust/pull/149209
Part of https://github.com/rust-lang/compiler-team/issues/908
2026-02-12 00:41:08 -05:00
Jacob Pratt
4e244c7cd5 Rollup merge of #150768 - bjorn3:llvm_intrinsic_no_fn_abi, r=wesleywiser
Don't compute FnAbi for LLVM intrinsics in backends

~~This removes support for `extern "unadjusted"` for anything other than LLVM intrinsics. It only makes sense in the context of calling LLVM intrinsics anyway as it exposes the way the LLVM backend internally represents types. Perhaps it should be renamed to `extern "llvm-intrinsic"`?~~

Follow up to https://github.com/rust-lang/rust/pull/148533
2026-02-12 00:41:06 -05:00
antoyo
740a55f641
Merge pull request #849 from him2him2/fix-typos
Fix typos across documentation
2026-02-11 18:02:05 -05:00
ron
dd1b72a0d8
Fix typos and grammar in documentation
- Readme.md: add missing "you" ("If don't" → "If you don't")
- Readme.md: fix wrong preposition ("without this backend" → "with this backend")
- Readme.md: fix double space
- doc/errors.md: fix transposed letters ("libgccijt" → "libgccjit")
- doc/debugging.md: remove extra word ("Run do the command" → "Run the command")
- doc/debugging.md: fix past participle ("cannot be ran" → "cannot be run")
- doc/tips.md: add missing verb ("won't a chance" → "won't have a chance")
- doc/gimple.md: fix preposition ("interested into" → "interested in")
2026-02-11 17:38:07 -05:00
antoyo
30bd49283c
Merge pull request #844 from rust-lang/sync_from_rust_2026_01_28
Sync from rust 2026/01/28
2026-02-11 17:33:53 -05:00
Antoni Boucher
809af1f635 Fix clippy warnings 2026-02-11 16:23:56 -05:00
bjorn3
a75ff82177 Remove tm_factory field from CodegenContext
This is necessary to support serializing the CodegenContext to a .rlink
file in the future for moving LTO to the -Zlink-only step.
2026-02-11 12:18:04 +00:00
bjorn3
14527b257f Move target machine factory error reporting into codegen backend 2026-02-11 10:53:38 +00:00
bjorn3
e4e725aec6 Convert to inline diagnostics in all codegen backends 2026-02-04 13:12:49 +00:00
Antoni Boucher
e4b746486c Ignore test when 128-bit integers are disabled 2026-01-30 11:49:52 -05:00
Antoni Boucher
a04934421f Switch to new_array_type_u64 2026-01-30 11:16:35 -05:00
Antoni Boucher
fb32a3f52e Update GCC version 2026-01-30 11:16:35 -05:00
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