Commit Graph

3957 Commits

Author SHA1 Message Date
bjorn3
dff600d1d3 Sync from rust 5bd5d214ef 2024-01-26 18:11:31 +00:00
bjorn3
f78617994a Update rand test
This contains a fix for a recently introduced warning.
2024-01-26 18:08:00 +00:00
bjorn3
604c8a7cf8 Accept [u8; N] bitmasks in simd_select_bitmask
Fixes rust-lang/rustc_codegen_cranelift#1446
2024-01-26 14:19:11 +00:00
bjorn3
dc7ed1680c Update to Cranelift 0.104 2024-01-26 11:18:14 +00:00
bjorn3
1fba58ed94 Update actions/checkout and actions/cache 2024-01-26 11:06:55 +00:00
bjorn3
7d3b29399d Use sess.cfg_version instead of rustc_version_str()
This makes it easier to patch cg_clif to be statically linked as part of
rustc.
2024-01-25 21:21:27 +00:00
bors
50a067d7f8 Auto merge of #119911 - NCGThompson:is-statically-known, r=oli-obk
Replacement of #114390: Add new intrinsic `is_var_statically_known` and optimize pow for powers of two

This adds a new intrinsic `is_val_statically_known` that lowers to [``@llvm.is.constant.*`](https://llvm.org/docs/LangRef.html#llvm-is-constant-intrinsic).` It also applies the intrinsic in the int_pow methods to recognize and optimize the idiom `2isize.pow(x)`. See #114390 for more discussion.

While I have extended the scope of the power of two optimization from #114390, I haven't added any new uses for the intrinsic. That can be done in later pull requests.

Note: When testing or using the library, be sure to use `--stage 1` or higher. Otherwise, the intrinsic will be a noop and the doctests will be skipped. If you are trying out edits, you may be interested in [`--keep-stage 0`](https://rustc-dev-guide.rust-lang.org/building/suggested.html#faster-builds-with---keep-stage).

Fixes #47234
Resolves #114390
`@Centri3`
2024-01-25 05:16:53 +00:00
Nicholas Thompson
55e04d5236 Further Implement is_val_statically_known 2024-01-23 12:02:31 -05:00
Michael Goulet
0c83e434e1 Do not normalize closure signature when building FnOnce shim 2024-01-22 16:50:30 +00:00
bjorn3
24361a1b99 Fix portable-simd tests 2024-01-21 11:38:13 +00:00
bjorn3
60ef392a2a Rustup to rustc 1.77.0-nightly (4cb17b4e7 2024-01-20) 2024-01-21 11:16:00 +00:00
bjorn3
9ab85888b3 Sync from rust 4cb17b4e78 2024-01-21 10:51:49 +00:00
Matthias Krüger
d390c002ae Rollup merge of #119815 - nagisa:nagisa/polishes-libloading-use-somewhat, r=bjorn3
Format sources into the error message when loading codegen backends

cc https://github.com/rust-lang/rustc_codegen_cranelift/issues/1447
cc `@bjorn3`
2024-01-19 19:27:00 +01:00
Martin Nordholts
f40f996562 compiler: Lower fn call arg spans down to MIR
To enable improved accuracy of diagnostics in upcoming commits.
2024-01-15 19:07:11 +01:00
Simonas Kazlauskas
be1b86fef4 Format sources into the error message when loading codegen backends
cc https://github.com/rust-lang/rustc_codegen_cranelift/issues/1447
2024-01-10 18:00:38 +02:00
Simonas Kazlauskas
c8875309b8 deps: deduplicate the version of libloading used
The changelog can be found here:
https://docs.rs/libloading/latest/libloading/changelog/r0_8_0/index.html
2024-01-10 17:18:10 +02:00
bjorn3
0dc13d7acb Implement _mm_prefetch as nop 2024-01-09 23:38:55 +01:00
Guillaume Gomez
18e12dcf6b Rollup merge of #117556 - obeis:static-mut-ref-lint, r=davidtwco
Disallow reference to `static mut` and adding `static_mut_ref` lint

Closes #114447

r? `@scottmcm`
2024-01-09 13:23:15 +01:00
Matthias Krüger
a2a9032d1b Rollup merge of #118903 - azhogin:azhogin/skip_second_stmt_debuginfo.rs, r=petrochenkov
Improved support of collapse_debuginfo attribute for macros.

Added walk_chain_collapsed function to consider collapse_debuginfo attribute in parent macros in call chain.
Fixed collapse_debuginfo attribute processing for cranelift (there was if/else branches error swap).

cc https://github.com/rust-lang/rust/issues/100758
2024-01-09 00:19:32 +01:00
Andrew Zhogin
2b3cd46832 Improved support of collapse_debuginfo attribute for macros. 2024-01-08 17:47:18 +07:00
Nicholas Nethercote
e6570dcccc Use chaining for DiagnosticBuilder construction and emit.
To avoid the use of a mutable local variable, and because it reads more
nicely.
2024-01-08 15:45:29 +11:00
Obei Sideg
837c0305c6 Update test for E0796 and static_mut_ref lint 2024-01-07 17:29:25 +03:00
bjorn3
f69c2e768f
Merge pull request #1445 from matthiaskrgr/clippy_jan2024
fix a couple of clippy warnings
2024-01-06 15:50:43 +01:00
Matthias Krüger
74987d04fc fix a couple of clippy warnings 2024-01-05 22:40:25 +01:00
bjorn3
b0250fca19
Merge pull request #1444 from Nilstrieb/ra-rustc
Use `rust-analyzer.rustc.source` to get r-a working with rustc
2024-01-04 15:28:36 +01:00
Nilstrieb
6fea128f8c Use rust-analyzer.rustc.source to get r-a working with rustc 2024-01-04 15:24:51 +01:00
bjorn3
b3b36e91c6
Merge pull request #1443 from Nilstrieb/x86-signed-pack
Restructure x86 signed pack instructions
2024-01-03 20:43:24 +01:00
Nilstrieb
22019dbac8 Mention correctness test 2024-01-03 20:28:08 +01:00
Nilstrieb
c8f5d35508 Restructure x86 signed pack instructions
This reduces the amount of duplicated code and the chance for bugs.

I validated the new code for correctness against LLVM using the
following script. It found many bugs in the implementation until I was
finally able to get it correct and passing.

```rust
//! Test for x86 pack instructions. Prints deterministic results, use it to compare backends.
use std::arch::x86_64::{self, __m128i, __m256i};
use rand::{rngs::SmallRng, Rng, SeedableRng};
fn main() {
    let rng = &mut SmallRng::seed_from_u64(123);
    for _ in 0..100_000 {
        unsafe {
            sse_test(rng);
            avx_test(rng);
        }
    }
}
unsafe fn sse_test(rng: &mut SmallRng) {
    print_sse_8(x86_64::_mm_packus_epi16(sse16(rng), sse16(rng)));
    print_sse_8(x86_64::_mm_packs_epi16(sse16(rng), sse16(rng)));
    print_sse_16(x86_64::_mm_packus_epi32(sse32(rng), sse32(rng)));
    print_sse_16(x86_64::_mm_packs_epi32(sse32(rng), sse32(rng)));
}
unsafe fn avx_test(rng: &mut SmallRng) {
    print_avx_8(x86_64::_mm256_packs_epi16(avx16(rng), avx16(rng)));
    print_avx_8(x86_64::_mm256_packs_epi16(avx16(rng), avx16(rng)));
    print_avx_16(x86_64::_mm256_packus_epi32(avx32(rng), avx32(rng)));
    print_avx_16(x86_64::_mm256_packs_epi32(avx32(rng), avx32(rng)));
}
fn print_sse_8(t: __m128i) {
    let ints = unsafe { std::mem::transmute::<_, [i8; 16]>(t) };
    println!("{ints:?}");
}
fn print_sse_16(t: __m128i) {
    let ints = unsafe { std::mem::transmute::<_, [i16; 8]>(t) };
    println!("{ints:?}");
}
fn print_avx_8(t: __m256i) {
    let ints = unsafe { std::mem::transmute::<_, [i8; 32]>(t) };
    println!("{ints:?}");
}
fn print_avx_16(t: __m256i) {
    let ints = unsafe { std::mem::transmute::<_, [i16; 16]>(t) };
    println!("{ints:?}");
}
fn sse16(rand: &mut SmallRng) -> __m128i {
    unsafe { std::mem::transmute([(); 8].map(|()| i16(rand))) }
}
fn sse32(rand: &mut SmallRng) -> __m128i {
    unsafe { std::mem::transmute([(); 4].map(|()| i32(rand))) }
}
fn avx16(rand: &mut SmallRng) -> __m256i {
    unsafe { std::mem::transmute([(); 16].map(|()| i16(rand))) }
}
fn avx32(rand: &mut SmallRng) -> __m256i {
    unsafe { std::mem::transmute([(); 8].map(|()| i32(rand))) }
}
fn i16(rand: &mut SmallRng) -> i16 {
    if rand.gen() {
        rand.gen::<i16>()
    } else {
        rand.gen::<i8>() as i16
    }
}
fn i32(rand: &mut SmallRng) -> i32 {
    if rand.gen() {
        rand.gen::<i32>()
    } else {
        rand.gen::<i16>() as i32
    }
}
```
2024-01-03 20:25:44 +01:00
bjorn3
3b8794edf4 Fix xmm operands in inline assembly 2024-01-03 11:08:32 +00:00
bjorn3
45d8c121ba Return architecturally mandated target features to rustc
In the future the actual target features that Cranelift enables should
be returned here, but for now this works.

Fixes rust-lang/rustc_codegen_cranelift#1438
2024-01-02 21:17:00 +00:00
bjorn3
c427754b52 Add platform support matrix
Fixes rust-lang/rustc_codegen_cranelift#1441
2024-01-02 20:39:31 +00:00
bjorn3
0c72b43614 Merge branch 'sync_from_rust' 2023-12-31 13:31:46 +00:00
bjorn3
0cfbc47b9a Merge commit '6d355f6844323db03bfd608899613e363e701951' into sync_cg_clif-2023-12-31 2023-12-31 13:29:53 +00:00
bjorn3
6d355f6844
Merge pull request #1440 from rust-lang/ci_speedup_and_cleanup
Slightly reduce CI runtime and reduce log verbosity
2023-12-31 14:26:48 +01:00
bjorn3
c55aaa55a7 Remove no longer needed config option from setup_rust_fork.sh 2023-12-31 12:39:20 +00:00
bjorn3
02183f79e4 Suppress default config change warnings 2023-12-31 12:22:38 +00:00
bjorn3
d58de3ea81 Suppress progress notifications for all git commands 2023-12-31 11:53:42 +00:00
bjorn3
3fa4efffb0 Install ripgrep using the system package manager 2023-12-31 11:14:50 +00:00
bjorn3
e2502acd15 Update the GHA artifacts actions to v4 2023-12-31 11:04:53 +00:00
bjorn3
4b239facd7 Install hyperfine using the system package manager 2023-12-31 11:01:07 +00:00
bjorn3
75f1c2b5a7 Rustup to rustc 1.77.0-nightly (2a3e63551 2023-12-30) 2023-12-31 10:46:02 +00:00
bjorn3
5c95200e96 Rustup to rustc 1.77.0-nightly (3cdd004e5 2023-12-29) 2023-12-30 12:06:21 +00:00
bjorn3
fa9cce061e Sync from rust 3cdd004e55 2023-12-30 11:00:12 +00:00
Michael Goulet
6b1a3ad4a6 Remove movability from TyKind::Coroutine 2023-12-28 16:35:01 +00:00
bjorn3
1dbb249844 Rustup to rustc 1.77.0-nightly (89e2160c4 2023-12-27) 2023-12-28 16:26:57 +00:00
bjorn3
4c0ad606d0 Sync from rust 89e2160c4c 2023-12-28 15:55:42 +00:00
bjorn3
e101a1bbb7 Avoid warning about the jobserver fd not being open for recursive rustc calls for inline asm
Fixes rust-lang/rustc_codegen_cranelift#1437
2023-12-26 11:25:52 +00:00
bors
bcae781754 Auto merge of #119146 - nnethercote:rm-DiagCtxt-api-duplication, r=compiler-errors
Remove `DiagCtxt` API duplication

`DiagCtxt` defines the internal API for creating and emitting diagnostics: methods like `struct_err`, `struct_span_warn`, `note`, `create_fatal`, `emit_bug`. There are over 50 methods.

Some of these methods are then duplicated across several other types: `Session`, `ParseSess`, `Parser`, `ExtCtxt`, and `MirBorrowckCtxt`. `Session` duplicates the most, though half the ones it does are unused. Each duplicated method just calls forward to the corresponding method in `DiagCtxt`. So this duplication exists to (in the best case) shorten chains like `ecx.tcx.sess.parse_sess.dcx.emit_err()` to `ecx.emit_err()`.

This API duplication is ugly and has been bugging me for a while. And it's inconsistent: there's no real logic about which methods are duplicated, and the use of `#[rustc_lint_diagnostic]` and `#[track_caller]` attributes vary across the duplicates.

This PR removes the duplicated API methods and makes all diagnostic creation and emission go through `DiagCtxt`. It also adds `dcx` getter methods to several types to shorten chains. This approach scales *much* better than API duplication; indeed, the PR adds `dcx()` to numerous types that didn't have API duplication: `TyCtxt`, `LoweringCtxt`, `ConstCx`, `FnCtxt`, `TypeErrCtxt`, `InferCtxt`, `CrateLoader`, `CheckAttrVisitor`, and `Resolver`. These result in a lot of changes from `foo.tcx.sess.emit_err()` to `foo.dcx().emit_err()`. (You could do this with more types, but it gets into diminishing returns territory for types that don't emit many diagnostics.)

After all these changes, some call sites are more verbose, some are less verbose, and many are the same. The total number of lines is reduced, mostly because of the removed API duplication. And consistency is increased, because calls to `emit_err` and friends are always preceded with `.dcx()` or `.dcx`.

r? `@compiler-errors`
2023-12-26 02:24:39 +00:00
bjorn3
653121cd38 Fix borked subtree syncs 2023-12-24 14:38:37 +00:00