Commit Graph

4087 Commits

Author SHA1 Message Date
Matthias Krüger
47abd3a486 Rollup merge of #122287 - RalfJung:simd-static-assert, r=pnkfelix
add test ensuring simd codegen checks don't run when a static assertion failed

stdarch relies on this to ensure that SIMD indices are in bounds.

I would love to know why this works, but I can't figure out where codegen decides to not codegen a function if a required-const does not evaluate. `@oli-obk` `@bjorn3` do you have any idea?
2024-03-14 15:44:33 +01:00
Jacob Pratt
221402e863 Rollup merge of #121840 - oli-obk:freeze, r=dtolnay
Expose the Freeze trait again (unstably) and forbid implementing it manually

non-emoji version of https://github.com/rust-lang/rust/pull/121501

cc #60715

This trait is useful for generic constants (associated consts of generic traits). See the test (`tests/ui/associated-consts/freeze.rs`) added in this PR for a usage example. The builtin `Freeze` trait is the only way to do it, users cannot work around this issue.

It's also a useful trait for building some very specific abstrations, as shown by the usage by the `zerocopy` crate: https://github.com/google/zerocopy/issues/941

cc ```@RalfJung```

T-lang signed off on reexposing this unstably: https://github.com/rust-lang/rust/pull/121501#issuecomment-1969827742
2024-03-11 03:47:19 -04:00
Ralf Jung
fe7be63dae add comments explaining where post-mono const eval errors abort compilation 2024-03-10 14:39:26 +01:00
Ralf Jung
01affeb53a use Instance::expect_resolve() instead of unwraping Instance::resolve() 2024-03-10 11:49:33 +01:00
bors
ef862a707b Auto merge of #121662 - saethlin:precondition-unification, r=RalfJung
Distinguish between library and lang UB in assert_unsafe_precondition

As described in https://github.com/rust-lang/rust/pull/121583#issuecomment-1963168186, `assert_unsafe_precondition` now explicitly distinguishes between language UB (conditions we explicitly optimize on) and library UB (things we document you shouldn't do, and maybe some library internals assume you don't do).

`debug_assert_nounwind` was originally added to avoid the "only at runtime" aspect of `assert_unsafe_precondition`. Since then the difference between the macros has gotten muddied. This totally revamps the situation.

Now _all_ preconditions shall be checked with `assert_unsafe_precondition`. If you have a precondition that's only checkable at runtime, do a `const_eval_select` hack, as done in this PR.

r? RalfJung
2024-03-10 01:23:54 +00:00
bjorn3
07633821ed Add bcryptprimitives.dll shim for wine 2024-03-09 19:51:11 +00:00
bjorn3
e18201deca Fix rustc test suite 2024-03-09 17:35:49 +00:00
bjorn3
f5a192b736 Rustup to rustc 1.78.0-nightly (46b180ec2 2024-03-08) 2024-03-09 16:20:13 +00:00
Ben Kimock
127c232050 Distinguish between library and lang UB in assert_unsafe_precondition 2024-03-08 18:53:58 -05:00
bjorn3
77dae8c881 Merge branch 'sync_from_rust' 2024-03-08 20:43:24 +00:00
bjorn3
5ec45d3d7a Merge commit '54cbb6e7531f95e086d5c3dd0d5e73bfbe3545ba' into sync_cg_clif-2024-03-08 2024-03-08 20:41:29 +00:00
bjorn3
54cbb6e753 Use sqrt clif instruction for sqrt rust intrinsics 2024-03-08 20:20:45 +00:00
bjorn3
b0809eadef Cleanup .gitignore 2024-03-08 19:52:57 +00:00
bjorn3
da083a8fc2 Remove configuration section from readme
None of these options are available in the rustup version, so it only
has the potential for confusion.
2024-03-08 19:52:51 +00:00
bjorn3
436fce0747 Remove y.rs
It has been deprecated for over a year now.
2024-03-08 19:37:23 +00:00
bjorn3
2b0f51b0b8 Disable Linux MinGW cross-compilation testing for now 2024-03-08 19:02:56 +00:00
bjorn3
6b220e5a2e Disable portable-simd sqrt test on MinGW 2024-03-08 19:02:56 +00:00
bjorn3
4976aa5216 Workaround a couple of bugs in rustc's test suite 2024-03-08 19:02:56 +00:00
bjorn3
5320a800e3 Rustup to rustc 1.78.0-nightly (9c3ad802d 2024-03-07) 2024-03-08 10:22:03 +00:00
bjorn3
dd7117b543 Sync from rust 9c3ad802d9 2024-03-08 10:05:56 +00:00
Matthias Krüger
5ffd498ca1 Rollup merge of #119365 - nbdd0121:asm-goto, r=Amanieu
Add asm goto support to `asm!`

Tracking issue: #119364

This PR implements asm-goto support, using the syntax described in "future possibilities" section of [RFC2873](https://rust-lang.github.io/rfcs/2873-inline-asm.html#asm-goto).

Currently I have only implemented the `label` part, not the `fallthrough` part (i.e. fallthrough is implicit). This doesn't reduce the expressive though, since you can use label-break to get arbitrary control flow or simply set a value and rely on jump threading optimisation to get the desired control flow. I can add that later if deemed necessary.

r? ``@Amanieu``
cc ``@ojeda``
2024-03-08 08:19:17 +01:00
bjorn3
1ace86eb0b Implement all x86 vendor intrinsics used by glam
Fixes rust-lang/rustc_codegen_cranelift#1463
2024-03-06 17:22:12 +01:00
Ralf Jung
804eeff180 only set noalias on Box with the global allocator 2024-03-05 15:03:33 +01:00
Oli Scherer
9277766840 Add a scheme for moving away from extern "rust-intrinsic" entirely 2024-03-04 16:13:50 +00:00
bjorn3
8c46d93ca0 Update to Cranelift 0.105.2
Fixes rust-lang/rustc_codegen_cranelift#1460
2024-02-29 14:55:16 +00:00
Oli Scherer
a11756ca75 Forbid implementing Freeze even if the trait is stabilized 2024-02-29 14:10:29 +00:00
Trevor Gross
e45b4d3209 Add f16 and f128 to rustc_type_ir::FloatTy and rustc_abi::Primitive
Make changes necessary to support these types in the compiler.
2024-02-28 12:58:32 -05:00
bors
c099ed3d1e Auto merge of #121635 - 823984418:remove_archive_builder_lifetime_a, r=nnethercote
Remove useless lifetime of ArchiveBuilder

`trait ArchiveBuilder<'a>` has a seemingly useless lifetime a, so I remove it. If this is intentional, please reject this PR.

```rust
pub trait ArchiveBuilder<'a> {
    fn add_file(&mut self, path: &Path);

    fn add_archive(
        &mut self,
        archive: &Path,
        skip: Box<dyn FnMut(&str) -> bool + 'static>,
    ) -> io::Result<()>;

    fn build(self: Box<Self>, output: &Path) -> bool;
}
```
2024-02-27 03:27:48 +00:00
bors
15d98cd3b5 Auto merge of #121655 - matthiaskrgr:rollup-qpx3kks, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #121598 (rename 'try' intrinsic to 'catch_unwind')
 - #121639 (Update books)
 - #121648 (Update Vec and String `{from,into}_raw_parts`-family docs)
 - #121651 (Properly emit `expected ;` on `#[attr] expr`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-27 00:55:14 +00:00
Matthias Krüger
acb6f1afdd Rollup merge of #121598 - RalfJung:catch_unwind, r=oli-obk
rename 'try' intrinsic to 'catch_unwind'

The intrinsic has nothing to do with `try` blocks, and corresponds to the stable `catch_unwind` function, so this makes a lot more sense IMO.

Also rename Miri's special function while we are at it, to reflect the level of abstraction it works on: it's an unwinding mechanism, on which Rust implements panics.
2024-02-27 00:40:00 +01:00
bors
df6d03155d Auto merge of #121516 - RalfJung:platform-intrinsics-begone, r=oli-obk
remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsics

`@Amanieu` `@workingjubilee` I don't think there is any reason these need to be "special"? The [original RFC](https://rust-lang.github.io/rfcs/1199-simd-infrastructure.html) indicated eventually making them stable, but I think that is no longer the plan, so seems to me like we can clean this up a bit.

Blocked on https://github.com/rust-lang/stdarch/pull/1538, https://github.com/rust-lang/rust/pull/121542.
2024-02-26 22:24:16 +00:00
823984418
c460cf1737 remove useless lifetime of ArchiveBuilder 2024-02-26 22:37:04 +08:00
Ralf Jung
65f7789761 rename 'try' intrinsic to 'catch_unwind' 2024-02-26 11:10:18 +01:00
Chris Denton
fcb86c871f Cranelift: Don't use raw-dylib in std 2024-02-25 10:22:34 -03:00
Ralf Jung
08e4eafa49 fix use of platform_intrinsics in tests 2024-02-25 08:15:44 +01:00
Ralf Jung
9bb1109478 remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsics 2024-02-25 08:14:52 +01:00
Gary Guo
8cec9989b2 Implement asm goto in MIR and MIR lowering 2024-02-24 18:50:09 +00:00
Gary Guo
98dcd85054 Change InlineAsm to allow multiple targets instead 2024-02-24 18:50:09 +00:00
bjorn3
e9e6b7cd0d
Merge pull request #1459 from uweigand/update-libc
Update libc dependency to 0.2.153
2024-02-23 18:12:41 +01:00
Ulrich Weigand
26ee4c93b5 Update libc dependency to 0.2.153 2024-02-23 17:33:46 +01:00
Ralf Jung
ac8c8b612d remove simd_reduce_{min,max}_nanless 2024-02-21 20:50:47 +01:00
bors
709c00a047 Auto merge of #120718 - saethlin:reasonable-fast-math, r=nnethercote
Add "algebraic" fast-math intrinsics, based on fast-math ops that cannot return poison

Setting all of LLVM's fast-math flags makes our fast-math intrinsics very dangerous, because some inputs are UB. This set of flags permits common algebraic transformations, but according to the [LangRef](https://llvm.org/docs/LangRef.html#fastmath), only the flags `nnan` (no nans) and `ninf` (no infs) can produce poison.

And this uses the algebraic float ops to fix https://github.com/rust-lang/rust/issues/120720

cc `@orlp`
2024-02-21 09:43:33 +00:00
bjorn3
8fb0fbef62 Fix rustc test suite 2024-02-20 21:57:28 +00:00
bjorn3
d23026ac1b Update to Cranelift 0.105 2024-02-20 20:52:27 +00:00
bjorn3
b03b41420b Fix stack alignment problem on s390x 2024-02-20 17:45:28 +00:00
bjorn3
c7a50c2636 Adapt filtering of rustc tests for upstream changes 2024-02-20 17:44:00 +00:00
Ben Kimock
968e79540d Add "algebraic" versions of the fast-math intrinsics 2024-02-20 12:39:03 -05:00
bjorn3
49db50eaa5 Rustup to rustc 1.78.0-nightly (3246e7951 2024-02-19) 2024-02-20 16:59:44 +00:00
bjorn3
e1841fbee0 Sync from rust 3246e79513 2024-02-20 15:52:04 +00:00
bjorn3
ba7404a293
Merge pull request #1457 from uweigand/simd-endian
Fix simd_select_bitmask on big-endian systems
2024-02-19 14:38:00 +01:00