Commit graph

4938 commits

Author SHA1 Message Date
bjorn3
047a10643b Sync from rust e703dff8fe 2025-06-12 16:18:26 +00:00
bjorn3
30c48bcb55 Use Operand::constant() in a couple of places
Also reduce visibility of a function
2025-06-10 09:39:50 +00:00
Jubilee Young
d5e9833af3 Remove rustc's notion of "preferred" alignment AKA __alignof
In PR 90877 T-lang decided not to remove `intrinsics::pref_align_of`.
However, the intrinsic and its supporting code
1.  is a nightly feature, so can be removed at compiler/libs discretion
2.  requires considerable effort in the compiler to support, as it
    necessarily complicates every single site reasoning about alignment
3.  has been justified based on relevance to codegen, but it is only a
    requirement for C++ (not C, not Rust) stack frame layout for AIX,
    in ways Rust would not consider even with increased C++ interop
4.  is only used by rustc to overalign some globals, not correctness
5.  can be adequately replaced by other rules for globals, as it mostly
    affects alignments for a few types under 16 bytes of alignment
6.  has only one clear benefactor: automating C -> Rust translation
    for GNU extensions like `__alignof`
7.  such code was likely intended to be `alignof` or `_Alignof`,
    because the GNU extension is a "false friend" of the C keyword,
    which makes the choice to support such a mapping very questionable
8.  makes it easy to do incorrect codegen in the compiler by its mere
    presence as usual Rust rules of alignment (e.g. `size == align * N`)
    do not hold with preferred alignment

The implementation is clearly damaging the code quality of the compiler.
Thus it is within the compiler team's purview to simply rip it out.
If T-lang wishes to have this intrinsic restored for c2rust's benefit,
it would have to use a radically different implementation that somehow
does not cause internal incorrectness.

Until then, remove the intrinsic and its supporting code, as one tool
and an ill-considered GCC extension cannot justify risking correctness.

Because we touch a fair amount of the compiler to change this at all,
and unfortunately the duplication of AbiAndPrefAlign is deep-rooted,
we keep an "AbiAlign" type which we can wean code off later.
2025-06-08 16:41:46 -07:00
bjorn3
7988b8c0b3 Rustup to rustc 1.89.0-nightly (cdd545be1 2025-06-07) 2025-06-08 11:42:13 +00:00
bjorn3
d0040227d9 Sync from rust cdd545be1b 2025-06-08 10:29:24 +00:00
Ralf Jung
18b12218a4 intrinsics: use const generic to set atomic ordering 2025-06-07 21:45:58 +02:00
bjorn3
4e3bf2da2f Rustup to rustc 1.89.0-nightly (44f415c1d 2025-06-06) 2025-06-07 14:18:29 +00:00
bjorn3
46e0b2158e Sync from rust 44f415c1d6 2025-06-07 13:48:38 +00:00
bors
83be7a8960 Auto merge of #141964 - sayantn:update-stdarch, r=Amanieu
Update stdarch submodule

Updates the stdarch submodule.

## Merged PRs

 - rust-lang/stdarch#1797
 - rust-lang/stdarch#1758
 - rust-lang/stdarch#1798
 - rust-lang/stdarch#1811
 - rust-lang/stdarch#1810
 - rust-lang/stdarch#1807
 - rust-lang/stdarch#1806
 - rust-lang/stdarch#1812
 - rust-lang/stdarch#1795
 - rust-lang/stdarch#1796
 - rust-lang/stdarch#1813
 - rust-lang/stdarch#1816
 - rust-lang/stdarch#1818
 - rust-lang/stdarch#1820
 - rust-lang/stdarch#1819

r? `@Amanieu`
`@rustbot` label T-libs-api

Closes rust-lang/rust#111137
2025-06-07 12:25:59 +00:00
Guillaume Gomez
363003951c Rollup merge of #142103 - scottmcm:fieldidx-in-interp, r=oli-obk
Update `InterpCx::project_field` to take `FieldIdx`

As suggested by Ralf in https://github.com/rust-lang/rust/pull/142005#discussion_r2125839015
2025-06-06 23:53:18 +02:00
Scott McMurray
2192d869d0 Update InterpCx::project_field to take FieldIdx
As suggested by Ralf in 142005.
2025-06-05 19:15:56 -07:00
Oli Scherer
59549af369 Replace some Option<Span> with Span and use DUMMY_SP instead of None 2025-06-05 14:14:59 +00:00
bjorn3
bcac194b24 Rustup to rustc 1.89.0-nightly (4b27a04cc 2025-06-04) 2025-06-05 09:35:09 +00:00
bjorn3
8f889f843b Sync from rust 4b27a04cc8 2025-06-05 09:28:46 +00:00
Scott McMurray
57d0559160 Change tag_field to FieldIdx in Variants::Multiple
It was already available as a generic parameter anyway, and it's not like we'll ever put a tag in the 5-billionth field.
2025-06-03 23:42:21 -07:00
bors
112e5e8721 Auto merge of #141984 - matthiaskrgr:rollup-wy6j9ca, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#137725 (Add `iter` macro)
 - rust-lang/rust#141455 (std: abort the process on failure to allocate a TLS key)
 - rust-lang/rust#141569 (Replace ad-hoc ABI "adjustments" with an `AbiMap` to `CanonAbi`)
 - rust-lang/rust#141698 (Use the informative error as the main const eval error message)
 - rust-lang/rust#141925 (Remove bootstrap cfgs from library/)
 - rust-lang/rust#141943 (Remove pre-expansion AST stats.)
 - rust-lang/rust#141945 (Remove `Path::is_ident`.)
 - rust-lang/rust#141957 (Add missing `dyn` keywords to tests that do not test for them Part 2)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-03 23:15:53 +00:00
Matthias Krüger
582ad1f6f3 Rollup merge of #141569 - workingjubilee:canonicalize-abi, r=bjorn3
Replace ad-hoc ABI "adjustments" with an `AbiMap` to `CanonAbi`

Our `conv_from_spec_abi`, `adjust_abi`, and `is_abi_supported` combine to give us a very confusing way of reasoning about what _actual_ calling convention we want to lower our code to and whether we want to compile the resulting code at all. Instead of leaving this code as a miniature adventure game in which someone tries to combine stateful mutations into a Rube Goldberg machine that will let them escape the maze and arrive at the promised land of codegen, we let `AbiMap` devour this complexity. Once you have an `AbiMap`, you can answer which `ExternAbi`s will lower to what `CanonAbi`s (and whether they will lower at all).

Removed:
- `conv_from_spec_abi` replaced by `AbiMap::canonize_abi`
- `adjust_abi` replaced by same
- `Conv::PreserveAll` as unused
- `Conv::Cold` as unused
- `enum Conv` replaced by `enum CanonAbi`

target-spec.json changes:
- If you have a target-spec.json then now your "entry-abi" key will be specified in terms of one of the `"{abi}"` strings Rust recognizes, e.g.
```json
    "entry-abi": "C",
    "entry-abi": "win64",
    "entry-abi": "aapcs",
```
2025-06-03 21:53:36 +02:00
bors
decbfcda13 Auto merge of #141229 - tgross35:builtins-josh-subtree, r=Kobzol
Merge `compiler-builtins` as a Josh subtree

Use the Josh [1] utility to add `compiler-builtins` as a subtree, which
will allow us to stop using crates.io for updates. This is intended to
help resolve some problems when unstable features change and require
code changes in `compiler-builtins`, which sometimes gets trapped in a
bootstrap cycle.

This was done using `josh-filter` built from the r24.10.04 tag:

    git fetch https://github.com/rust-lang/compiler-builtins.git 233434412fe7eced8f1ddbfeddabef1d55e493bd
    josh-filter ":prefix=library/compiler-builtins" FETCH_HEAD
    git merge --allow-unrelated FILTERED_HEAD

The HEAD in the `compiler-builtins` repository is 233434412f ("fix an if
statement that can be collapsed").

[1]: https://github.com/josh-project/josh
2025-06-03 19:52:05 +00:00
Jubilee Young
12be26f928 cg_clif: convert to CanonAbi 2025-06-03 10:04:19 -07:00
sayantn
b97136c817 Add impl for llvm.roundeven in cg_clif
- remove unused `llvm.aarch64.neon.frintn` from cg_clif
2025-06-03 20:37:10 +05:30
bjorn3
814ef9f080 Rustup to rustc 1.89.0-nightly (5d707b07e 2025-06-02) 2025-06-03 08:51:18 +00:00
bjorn3
bc74556fa4 Rustup to rustc 1.89.0-nightly (70b3f4666 2025-05-30) 2025-05-31 13:43:30 +00:00
bjorn3
26242be173 Sync from rust 70b3f4666e 2025-05-31 13:37:50 +00:00
Ralf Jung
99e783d4e9 atomic_load intrinsic: use const generic parameter for ordering 2025-05-28 22:57:55 +02:00
Trevor Gross
ea26272c94 clif: Provide better output messages for failed copies 2025-05-28 15:15:43 +00:00
bjorn3
2357fb6578 Merge branch 'sync_from_rust' 2025-05-25 18:55:47 +00:00
bjorn3
4f24d142d9 Merge commit '979dcf8e2f' into sync_cg_clif-2025-05-25 2025-05-25 18:51:16 +00:00
bjorn3
979dcf8e2f Rustup to rustc 1.89.0-nightly (5e16c6620 2025-05-24) 2025-05-25 18:39:17 +00:00
bjorn3
aa04a27268 Sync from rust 5e16c66206 2025-05-25 18:33:21 +00:00
bjorn3
0da0dac6ea
Merge pull request #1574 from beetrees/f16-f128-mvp
Add `f16`/`f128` support
2025-05-24 15:38:31 +02:00
beetrees
02195f56c7
Enable tests and compiler-builtins for f16/f128 2025-05-24 13:51:53 +01:00
beetrees
2055f01323
Add f16/f128 intrinsic support 2025-05-24 13:51:53 +01:00
beetrees
e46186f994
Add support for casting to and from f16/f128 2025-05-24 13:45:19 +01:00
beetrees
38d48dbe08
Add f16/f128 comparison support 2025-05-24 13:45:19 +01:00
beetrees
27a9590d3d
Add f16/f128 +/-/*///% support 2025-05-24 13:45:19 +01:00
beetrees
87c425b9e1
Add basic support for f16/f128 values 2025-05-24 13:45:19 +01:00
beetrees
f0fb19ccc8
Add missing float libcalls to compiler_builtins.rs 2025-05-24 13:45:12 +01:00
beetrees
dcd3168c97
Use correct sign extension on __powi*f2 arguments 2025-05-23 15:51:51 +01:00
bjorn3
7c026ea31d
Add missing space in usage.md 2025-05-23 16:41:37 +02:00
beetrees
3ab6af049b
Use Cranelift bitcast instead of store & load to bitcast between vectors and non-vectors (#1580) 2025-05-21 15:59:52 +02:00
Trevor Gross
ff1a5ab4c3 Rename cfg_match! to cfg_select!
At [1] it was pointed out that `cfg_match!` syntax does not actually
align well with match syntax, which is a possible source of confusion.
The comment points out that usage is instead more similar to ecosystem
`select!` macros. Rename `cfg_match!` to `cfg_select!` to match this.

Tracking issue: https://github.com/rust-lang/rust/issues/115585

[1]: https://github.com/rust-lang/rust/issues/115585#issuecomment-2346307605
2025-05-20 21:16:23 +00:00
stefnotch
8e3d0b2b03
Update availability of Cranelift (#1579)
- include source
2025-05-20 17:17:36 +02:00
bjorn3
4c39287e34 Update to Cranelift 0.120 2025-05-20 12:59:03 +00:00
bjorn3
81af658cb3 Make clif ir debug output a bit nicer 2025-05-20 12:16:04 +00:00
bjorn3
04c7e5a7e3 Rustup to rustc 1.89.0-nightly (60dabef95 2025-05-19) 2025-05-20 09:43:45 +00:00
bjorn3
0e43247bc9 Fix rustc testsuite 2025-05-18 16:29:38 +00:00
bjorn3
bc02a99f8f Rustup to rustc 1.89.0-nightly (777d37277 2025-05-17) 2025-05-18 14:30:42 +00:00
bjorn3
7b670d243f Sync from rust 777d372772 2025-05-18 14:21:04 +00:00
Urgau
e6d288ba17 Use intrinsics for {f16,f32,f64,f128}::{minimum,maximum} operations 2025-05-09 17:11:23 +02:00
bjorn3
2f8f464390 Fix mini_core on Windows and macOS 2025-05-07 14:08:11 +00:00