about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/intrinsics
AgeCommit message (Collapse)AuthorLines
2023-12-19Merge commit '3a9bf729322fb5035518f99b9d76a742bf7c124e' into ↵bjorn3-11/+9
sync_cg_clif-2023-12-19
2023-12-10remove redundant importssurechen-7/+0
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-09Add simd_masked_{load,store} platform-intrinsicsJakub Okoński-1/+51
This maps to the LLVM intrinsics: llvm.masked.load and llvm.masked.store
2023-11-25Merge commit '710c67909d034e1c663174a016ca82b95c2d6c12' into ↵bjorn3-22/+350
sync_cg_clif-2023-11-25
2023-11-16Merge commit 'def04540a4e2541b995195c752c751295606a388' into ↵bjorn3-59/+307
sync_cg_clif-2023-11-16
2023-11-10Merge commit 'c84d1871dc4456539b7b578830268ab3539915d0' into ↵bjorn3-50/+567
sync_cg_clif-2023-11-10
2023-10-29Merge commit 'dde58803fd6cbb270c7a437f36a8a3a29fbef679' into ↵bjorn3-76/+0
sync_cg_clif-2023-10-29
2023-10-28Auto merge of #116609 - eduardosm:bump-stdarch, r=workingjubileebors-35/+0
Bump stdarch submodule and remove special handling for LLVM intrinsics that are no longer needed Bumps stdarch to pull https://github.com/rust-lang/stdarch/pull/1477, which reimplemented some functions with portable SIMD intrinsics instead of arch specific LLVM intrinsics. Handling of those LLVM intrinsics is removed from cranelift codegen and miri. cc `@RalfJung` `@bjorn3`
2023-10-24Merge commit '93a5433f17ab5ed48cc88f1e69b0713b16183373' into ↵bjorn3-0/+137
sync_cg_clif-2023-10-24
2023-10-12Remove from cranelift codegen LLVM intrinsics that are no longer neededEduardo Sánchez Muñoz-35/+0
2023-10-09Merge commit '81dc066758ec150b43822d4a0c84aae20fe10f40' into ↵bjorn3-26/+73
sync_cg_clif-2023-10-09
2023-09-18Prototype using const generic for simd_shuffle IDX arrayOli Scherer-1/+49
2023-09-14cleanup op_to_const a bit; rename ConstValue::ByRef → IndirectRalf Jung-1/+1
2023-09-14use AllocId instead of Allocation in ConstValue::ByRefRalf Jung-1/+2
2023-09-05Remove special handling in codegen for some AVX and SSE2 shift by immediate ↵Eduardo Sánchez Muñoz-240/+0
intrinsics Those were removed from stdarch in https://github.com/rust-lang/stdarch/pull/1463 (`simd_shl` and `simd_shr` are used instead)
2023-09-05Remove special handling in codegen for some SSE2 "storeu" intrinsicsEduardo Sánchez Muñoz-8/+0
Those were removed from stdarch in https://github.com/rust-lang/stdarch/pull/1463 (`<*mut _>::write_unaligned` is used instead)
2023-08-06Apply suggestions from code reviewscottmcm-0/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-08-06Add a new `compare_bytes` intrinsic instead of calling `memcmp` directlyScott McMurray-0/+13
2023-08-03Forbid old-style `simd_shuffleN` intrinsicsOli Scherer-32/+22
2023-07-22Merge commit '1eded3619d0e55d57521a259bf27a03906fdfad0' into ↵bjorn3-33/+244
sync_cg_clif-2023-07-22
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-24/+36
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-1/+1
2023-06-19Remove unchecked_add/sub/mul/shl/shr from CTFE/cg_ssa/cg_clifScott McMurray-17/+3
2023-06-15Merge commit '8830dccd1d4c74f1f69b0d3bd982a3f1fcde5807' into ↵bjorn3-13/+323
sync_cg_clif-2023-06-15
2023-06-01remove unchecked_div/_rem from cg_craneliftScott McMurray-4/+1
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-15/+14
Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile.
2023-04-29Merge commit 'ef07e8e60f994ec014d049a95591426fb92ebb79' into ↵bjorn3-9/+5
sync_cg_clif-2023-04-29
2023-04-25Lower `intrinsics::offset` to `mir::BinOp::Offset`Scott McMurray-1/+1
They're semantically the same, so this means the backends don't need to handle the intrinsic and means fewer MIR basic blocks in pointer arithmetic code.
2023-03-28Move `mir::Field` → `abi::FieldIdx`Scott McMurray-3/+3
The first PR for https://github.com/rust-lang/compiler-team/issues/606 This is just the move-and-rename, because it's plenty big-and-bitrotty already. Future PRs will start using `FieldIdx` more broadly, and concomitantly removing `FieldIdx::new`s.
2023-03-22Add `CastKind::Transmute` to MIRScott McMurray-10/+0
Updates `interpret`, `codegen_ssa`, and `codegen_cranelift` to consume the new cast instead of the intrinsic. Includes `CastTransmute` for custom MIR building, to be able to test the extra UB.
2023-03-15Merge commit 'dec0daa8f6d0a0e1c702f169abb6bf3eee198c67' into ↵bjorn3-83/+81
sync_cg_clif-2023-03-15
2023-03-07Auto merge of #95317 - Jules-Bertholet:round_ties_to_even, ↵bors-0/+4
r=pnkfelix,m-ou-se,scottmcm Add `round_ties_even` to `f32` and `f64` Tracking issue: #96710 Redux of #82273. See also #55107 Adds a new method, `round_ties_even`, to `f32` and `f64`, that rounds the float to the nearest integer , rounding halfway cases to the number with an even least significant bit. Uses the `roundeven` LLVM intrinsic to do this. Of the five IEEE 754 rounding modes, this is the only one that doesn't already have a round-to-integer function exposed by Rust (others are `round`, `floor`, `ceil`, and `trunc`). Ties-to-even is also the rounding mode used for int-to-float and float-to-float `as` casts, as well as float arithmentic operations. So not having an explicit rounding method for it seems like an oversight. Bikeshed: this PR currently uses `round_ties_even` for the name of the method. But maybe `round_ties_to_even` is better, or `round_even`, or `round_to_even`?
2023-02-27Unify all validity check intrinsicsNilstrieb-49/+31
Also merges the inhabitedness check into the query to further unify the code paths.
2023-02-27Rollup merge of #108364 - Nilstrieb:validity-checks-refactor, r=compiler-errorsMatthias Krüger-3/+7
Unify validity checks into a single query Previously, there were two queries to check whether a type allows the 0x01 or zeroed bitpattern. I am planning on adding a further initness to check in #100423, truly uninit for MaybeUninit, which would make this three queries. This seems overkill for such a small feature, so this PR unifies them into one. I am not entirely happy with the naming and key type and open for improvements. r? oli-obk
2023-02-24Rename many interner functions.Nicholas Nethercote-1/+1
(This is a large commit. The changes to `compiler/rustc_middle/src/ty/context.rs` are the most important ones.) The current naming scheme is a mess, with a mix of `_intern_`, `intern_` and `mk_` prefixes, with little consistency. In particular, in many cases it's easy to use an iterator interner when a (preferable) slice interner is available. The guiding principles of the new naming system: - No `_intern_` prefixes. - The `intern_` prefix is for internal operations. - The `mk_` prefix is for external operations. - For cases where there is a slice interner and an iterator interner, the former is `mk_foo` and the latter is `mk_foo_from_iter`. Also, `slice_interners!` and `direct_interners!` can now be `pub` or non-`pub`, which helps enforce the internal/external operations division. It's not perfect, but I think it's a clear improvement. The following lists show everything that was renamed. slice_interners - const_list - mk_const_list -> mk_const_list_from_iter - intern_const_list -> mk_const_list - substs - mk_substs -> mk_substs_from_iter - intern_substs -> mk_substs - check_substs -> check_and_mk_substs (this is a weird one) - canonical_var_infos - intern_canonical_var_infos -> mk_canonical_var_infos - poly_existential_predicates - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter - intern_poly_existential_predicates -> mk_poly_existential_predicates - _intern_poly_existential_predicates -> intern_poly_existential_predicates - predicates - mk_predicates -> mk_predicates_from_iter - intern_predicates -> mk_predicates - _intern_predicates -> intern_predicates - projs - intern_projs -> mk_projs - place_elems - mk_place_elems -> mk_place_elems_from_iter - intern_place_elems -> mk_place_elems - bound_variable_kinds - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter - intern_bound_variable_kinds -> mk_bound_variable_kinds direct_interners - region - intern_region (unchanged) - const - mk_const_internal -> intern_const - const_allocation - intern_const_alloc -> mk_const_alloc - layout - intern_layout -> mk_layout - adt_def - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid) - alloc_adt_def(!) -> mk_adt_def - external_constraints - intern_external_constraints -> mk_external_constraints Other - type_list - mk_type_list -> mk_type_list_from_iter - intern_type_list -> mk_type_list - tup - mk_tup -> mk_tup_from_iter - intern_tup -> mk_tup
2023-02-23Unify validity checks into a single queryNilstrieb-3/+7
Previously, there were two queries to check whether a type allows the 0x01 or zeroed bitpattern. I am planning on adding a further initness to check, truly uninit for MaybeUninit, which would make this three queries. This seems overkill for such a small feature, so this PR unifies them into one.
2023-02-18Stop implementing _with_overflow intrinsics in codegen backends.Camille GILLOT-14/+0
2023-02-17Replace `mk_foo` calls with `infer_foo` where possible.Nicholas Nethercote-1/+1
There are several `mk_foo`/`intern_foo` pairs, where the former takes an iterator and the latter takes a slice. (This naming convention is bad, but that's a fix for another PR.) This commit changes several `mk_foo` occurrences into `intern_foo`, avoiding the need for some `.iter()`/`.into_iter()` calls. Affected cases: - mk_type_list - mk_tup - mk_substs - mk_const_list
2023-02-15Auto merge of #108012 - compiler-errors:issue-107999, r=oli-obkbors-3/+10
Don't ICE in `might_permit_raw_init` if reference is polymorphic Emitting optimized MIR for a polymorphic function may require computing layout of a type that isn't (yet) known. This happens in the instcombine pass, for example. Let's fail gracefully in that condition. cc `@saethlin` fixes #107999
2023-02-14Make permit_uninit/zero_init fallibleMichael Goulet-3/+10
2023-02-14s/eval_usize/eval_target_usize/ for clarityOli Scherer-2/+2
2023-02-09Merge commit '7d53619064ab7045c383644cb445052d2a3d46db' into ↵bjorn3-19/+12
sync_cg_clif-2023-02-09
2023-01-27Auto merge of #107269 - bjorn3:sync_cg_clif-2023-01-24, r=bjorn3bors-15/+122
Sync rustc_codegen_cranelift For cg_clif itself there have been a couple of bug fixes since the last sync, a Cranelift update and implemented all remaining simd platform intrinsics used by `std::simd`. (`std::arch` still misses a lot though) Most of the diff is from reworking of the cg_clif build system though. r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler
2023-01-24Merge commit '598f0909568a51de8a2d1148f55a644fd8dffad0' into ↵bjorn3-15/+122
sync_cg_clif-2023-01-24
2023-01-23Thread a ParamEnv down to might_permit_raw_initBen Kimock-2/+5
2022-12-21Auto merge of #105613 - Nilstrieb:rename-assert_uninit_valid, r=RalfJungbors-2/+4
Rename `assert_uninit_valid` intrinsic It's not about "uninit" anymore but about "filling with 0x01 bytes" so the name should at least try to reflect that. This is actually not fully correct though, as it does still panic for all uninit with `-Zstrict-init-checks`. I'm not sure what the best way is to deal with that not causing confusion. I guess we could just remove the flag? I don't think having it makes a lot of sense anymore with the direction that we have chose to go. It could be relevant again if #100423 lands so removing it may be a bit over eager. r? `@RalfJung`
2022-12-14Merge commit '2bb3996244cf1b89878da9e39841e9f6bf061602' into ↵bjorn3-248/+450
sync_cg_clif-2022-12-14
2022-12-13Rename `assert_uninit_valid` intrinsicNilstrieb-2/+4
It's not about "uninit" anymore but about "filling with 0x01 bytes" so the name should at least try to reflect that.
2022-12-11Use rint instead of roundevenJules Bertholet-0/+2
Use rint intrinsic instead of roundeven to impement `round_ties_even`. They do the same thing when rounding mode is default, which Rust assumes. And `rint` has better platform support. Keeps `roundeven` around in `core::intrinsics`, it's doing no harm there.
2022-12-11Add `round_ties_even` to `f32` and `f64`Jules Bertholet-0/+2