summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/intrinsics
AgeCommit message (Collapse)AuthorLines
2024-10-11intrinsics.fmuladdf{16,32,64,128}: expose llvm.fmuladd.* semanticsJed Brown-1/+4
Add intrinsics `fmuladd{f16,f32,f64,f128}`. This computes `(a * b) + c`, to be fused if the code generator determines that (i) the target instruction set has support for a fused operation, and (ii) that the fused operation is more efficient than the equivalent, separate pair of `mul` and `add` instructions. https://llvm.org/docs/LangRef.html#llvm-fmuladd-intrinsic MIRI support is included for f32 and f64. The codegen_cranelift uses the `fma` function from libc, which is a correct implementation, but without the desired performance semantic. I think this requires an update to cranelift to expose a suitable instruction in its IR. I have not tested with codegen_gcc, but it should behave the same way (using `fma` from libc).
2024-09-23Rustfmtbjorn3-6/+3
2024-09-23Merge commit '6d35b4c9a04580366fd800692a5b5db79d766530' into ↵bjorn3-27/+57
sync_cg_clif-2024-09-22
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-9/+6
2024-09-20Do not unnecessarily eval consts in codegenMichael Goulet-3/+2
2024-09-14simd_shuffle: require index argument to be a vectorRalf Jung-27/+13
2024-08-13simd_shuffle intrinsic: allow argument to be passed as vector (not just as ↵Ralf Jung-0/+10
array)
2024-08-12Rollup merge of #128149 - RalfJung:nontemporal_store, r=jieyouxu,Amanieu,JubileeGuillaume Gomez-1/+2
nontemporal_store: make sure that the intrinsic is truly just a hint The `!nontemporal` flag for stores in LLVM *sounds* like it is just a hint, but actually, it is not -- at least on x86, non-temporal stores need very special treatment by the programmer or else the Rust memory model breaks down. LLVM still treats these stores as-if they were normal stores for optimizations, which is [highly dubious](https://github.com/llvm/llvm-project/issues/64521). Let's avoid all that dubiousness by making our own non-temporal stores be truly just a hint, which is possible on some targets (e.g. ARM). On all other targets, non-temporal stores become regular stores. ~~Blocked on https://github.com/rust-lang/stdarch/pull/1541 propagating to the rustc repo, to make sure the `_mm_stream` intrinsics are unaffected by this change.~~ Fixes https://github.com/rust-lang/rust/issues/114582 Cc `@Amanieu` `@workingjubilee`
2024-08-09Merge commit '69b3f5a426a5c1c05236a45b36f6679d95fbe01b' into ↵bjorn3-144/+0
sync_cg_clif-2024-08-09
2024-08-05nontemporal_store: make sure that the intrinsic is truly just a hintRalf Jung-1/+2
2024-07-24Use Cow<'static, str> for InlineAsmTemplatePiece::StringGnomedDev-20/+22
2024-07-13Merge commit '659243d85c7489412bd0faa1c068d904a6042941' into ↵bjorn3-20/+2
sync_cg_clif-2024-07-13
2024-06-30Merge commit '49cd5dd454d0115cfbe9e39102a8b3ba4616aa40' into ↵bjorn3-1/+40
sync_cg_clif-2024-06-30
2024-06-16Rename InstanceDef -> InstanceKindMichael Goulet-1/+1
2024-06-10ScalarInt: size mismatches are a bug, do not delay the panicRalf Jung-13/+8
2024-06-05Misc fixes to cranelift/clippy/miriBoxy-0/+1
2024-05-19cg_clif: support simd_ctpopJubilee Young-0/+2
2024-05-13Merge commit '3270432f4b0583104c8b9b6f695bf97d6bbf3ac2' into ↵bjorn3-0/+52
sync_cg_clif-2024-05-13
2024-05-09Make builtin_deref just return a TyMichael Goulet-4/+4
2024-04-19Do intrinsic changes in `rustc_codegen_cranelift`Maybe Waffle-3/+7
2024-04-03Rollup merge of #123419 - petrochenkov:zeroindex, r=compiler-errorsMatthias Krüger-1/+1
rustc_index: Add a `ZERO` constant to index types It is commonly used.
2024-04-03rustc_index: Add a `ZERO` constant to index typesVadim Petrochenkov-1/+1
It is commonly used.
2024-04-03rename `expose_addr` to `expose_provenance`joboet-1/+1
2024-04-02Rollup merge of #122935 - RalfJung:with-exposed-provenance, r=AmanieuJacob Pratt-1/+1
rename ptr::from_exposed_addr -> ptr::with_exposed_provenance As discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/To.20expose.20or.20not.20to.20expose/near/427757066). The old name, `from_exposed_addr`, makes little sense as it's not the address that is exposed, it's the provenance. (`ptr.expose_addr()` stays unchanged as we haven't found a better option yet. The intended interpretation is "expose the provenance and return the address".) The new name nicely matches `ptr::without_provenance`.
2024-03-28Merge commit '09fae60a86b848a2fc0ad219ecc4e438dc1eef86' into ↵bjorn3-0/+5
sync_cg_clif-2024-03-28
2024-03-23also rename the SIMD intrinsicRalf Jung-1/+1
2024-03-19Make ptr_guaranteed_cmp a rustc_intrinsic and favor its body over backends ↵Oli Scherer-7/+0
implementing it
2024-03-18Avoid various uses of `Option<Span>` in favor of using `DUMMY_SP` in the few ↵Oli Scherer-3/+5
cases that used `None`
2024-03-08Merge commit '54cbb6e7531f95e086d5c3dd0d5e73bfbe3545ba' into ↵bjorn3-2/+186
sync_cg_clif-2024-03-08
2024-03-04Add a scheme for moving away from `extern "rust-intrinsic"` entirelyOli Scherer-1/+11
2024-02-26rename 'try' intrinsic to 'catch_unwind'Ralf Jung-2/+2
2024-02-21remove simd_reduce_{min,max}_nanlessRalf Jung-2/+2
2024-02-20Add "algebraic" versions of the fast-math intrinsicsBen Kimock-6/+15
2024-02-12Give const_deallocate a default bodyOli Scherer-5/+0
2024-02-12Teach llvm backend how to fall back to default bodiesOli Scherer-11/+5
2024-02-12Add intrinsic body fallback to cranelift and use itOli Scherer-32/+25
2024-01-26Merge commit '3e50cf65025f96854d6597e80449b0d64ad89589' into ↵bjorn3-199/+183
sync_cg_clif-2024-01-26
2024-01-25Auto merge of #119911 - NCGThompson:is-statically-known, r=oli-obkbors-0/+6
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-23Further Implement `is_val_statically_known`Nicholas Thompson-0/+6
2024-01-15compiler: Lower fn call arg spans down to MIRMartin Nordholts-66/+70
To enable improved accuracy of diagnostics in upcoming commits.
2023-12-26Auto merge of #119146 - nnethercote:rm-DiagCtxt-api-duplication, ↵bors-21/+25
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-24Fix borked subtree syncsbjorn3-1/+1
2023-12-24Merge commit '26c02eb2904da9a53d2220d4f3069b19a3c81d3d' into ↵bjorn3-0/+31
sync_cg_clif-2023-12-24
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-21/+25
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
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