about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/intrinsics
AgeCommit message (Collapse)AuthorLines
2022-07-25Merge commit 'c19edfd71a1d0ddef86c2c67fdb40718d40a72b4' into ↵bjorn3-2/+20
sync_cg_clif-2022-07-25
2022-07-20Implement vtable_size and vtable_align intrinsics for cg_clifbjorn3-0/+10
2022-07-14Use constant eval to do strict validity checks5225225-13/+2
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-2/+2
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-05-24Add flag for stricter checks on uninit/zeroed5225225-2/+13
2022-05-23Refactor call terminator to always hold a destination placeJakob Degen-28/+34
2022-05-15Merge commit '63734fcdd718cca089f84c42f3a42c0096cfd431' into ↵bjorn3-31/+31
sync_cg_clif-2022-05-15
2022-05-11Rename `unsigned_offset_from` to `sub_ptr`Scott McMurray-1/+1
2022-05-11Add `unsigned_offset_from` on pointersScott McMurray-3/+10
Like we have `add`/`sub` which are the `usize` version of `offset`, this adds the `usize` equivalent of `offset_from`. Like how `.add(d)` replaced a whole bunch of `.offset(d as isize)`, you can see from the changes here that it's fairly common that code actually knows the order between the pointers and *wants* a `usize`, not an `isize`. As a bonus, this can do `sub nuw`+`udiv exact`, rather than `sub`+`sdiv exact`, which can be optimized slightly better because it doesn't have to worry about negatives. That's why the slice iterators weren't using `offset_from`, though I haven't updated that code in this PR because slices are so perf-critical that I'll do it as its own change. This is an intrinsic, like `offset_from`, so that it can eventually be allowed in CTFE. It also allows checking the extra safety condition -- see the test confirming that CTFE catches it if you pass the pointers in the wrong order.
2022-04-22Merge commit 'f2cdd4a78d89c009342197cf5844a21f8aa813df' into ↵bjorn3-34/+19
sync_cg_clif-2022-04-22
2022-03-20Merge commit '370c397ec9169809e5ad270079712e0043514240' into ↵bjorn3-37/+56
sync_cg_clif-2022-03-20
2022-03-07Clarify `Layout` interning.Nicholas Nethercote-1/+1
`Layout` is another type that is sometimes interned, sometimes not, and we always use references to refer to it so we can't take any advantage of the uniqueness properties for hashing or equality checks. This commit renames `Layout` as `LayoutS`, and then introduces a new `Layout` that is a newtype around an `Interned<LayoutS>`. It also interns more layouts than before. Previously layouts within layouts (via the `variants` field) were never interned, but now they are. Hence the lifetime on the new `Layout` type. Unlike other interned types, these ones are in `rustc_target` instead of `rustc_middle`. This reflects the existing structure of the code, which does layout-specific stuff in `rustc_target` while `TyAndLayout` is generic over the `Ty`, allowing the type-specific stuff to occur in `rustc_middle`. The commit also adds a `HashStable` impl for `Interned`, which was needed. It hashes the contents, unlike the `Hash` impl which hashes the pointer.
2022-03-07Introduce `ConstAllocation`.Nicholas Nethercote-1/+1
Currently some `Allocation`s are interned, some are not, and it's very hard to tell at a use point which is which. This commit introduces `ConstAllocation` for the known-interned ones, which makes the division much clearer. `ConstAllocation::inner()` is used to get the underlying `Allocation`. In some places it's natural to use an `Allocation`, in some it's natural to use a `ConstAllocation`, and in some places there's no clear choice. I've tried to make things look as nice as possible, while generally favouring `ConstAllocation`, which is the type that embodies more information. This does require quite a few calls to `inner()`. The commit also tweaks how `PartialOrd` works for `Interned`. The previous code was too clever by half, building on `T: Ord` to make the code shorter. That caused problems with deriving `PartialOrd` and `Ord` for `ConstAllocation`, so I changed it to build on `T: PartialOrd`, which is slightly more verbose but much more standard and avoided the problems.
2022-02-23Merge commit '35d9c6bf256968e1b40e0d554607928bdf9cebea' into ↵bjorn3-525/+584
sync_cg_clif-2022-02-23
2022-02-16Move ty::print methods to Drop-based scope guardsMark Rousskov-15/+21
2022-01-19remove `is_noop`lcnr-1/+1
2021-12-20Merge commit '97e504549371d7640cf011d266e3c17394fdddac' into ↵bjorn3-19/+46
sync_cg_clif-2021-12-20
2021-10-12Add const_eval_select intrinsicDeadbeef-3/+1
2021-09-12Auto merge of #88839 - nbdd0121:alignof, r=nagisabors-1/+1
Introduce NullOp::AlignOf This PR introduces `Rvalue::NullaryOp(NullOp::AlignOf, ty)`, which will be lowered from `align_of`, similar to `size_of` lowering to `Rvalue::NullaryOp(NullOp::SizeOf, ty)`. The changes are originally part of #88700 but since it's not dependent on other changes and could have performance impact on its own, it's separated into its own PR.
2021-09-13Introduce NullOp::AlignOfGary Guo-1/+1
2021-09-09Make `abi::Abi` `Copy` and remove a *lot* of refsAndreas Liljeqvist-2/+2
fix fix Remove more refs and clones fix more fix
2021-08-30rustc_target: `TyAndLayout::field` should never error.Eduard-Mihai Burtescu-2/+2
2021-08-12Implement `black_box` using intrinsicGary Guo-0/+5
The new implementation allows some `memcpy`s to be optimized away, so the uninit value in ui/sanitize/memory.rs is constructed directly onto the return place. Therefore the sanitizer now says that the value is allocated by `main` rather than `random`.
2021-08-06Merge commit '05677b6bd6c938ed760835d9b1f6514992654ae3' into ↵bjorn3-82/+219
sync_cg_clif-2021-08-06
2021-07-08Use cranelift's `Type::int` instead of doing the match myselfScott McMurray-8/+1
<https://docs.rs/cranelift-codegen/0.74.0/cranelift_codegen/ir/types/struct.Type.html#method.int>
2021-07-08PR Feedback: Don't put SSA-only types in `CValue`sScott McMurray-3/+5
2021-07-08Implement the raw_eq intrinsic in codegen_craneliftScott McMurray-0/+39
2021-07-07Merge commit '3a31c6d8272c14388a34622193baf553636fe470' into ↵bjorn3-0/+58
sync_cg_clif-2021-07-07
2021-05-27Merge commit '40dd3e2b7089b5e96714e064b731f6dbf17c61a9' into ↵bjorn3-1/+8
sync_cg_clif-2021-05-27
2021-05-18CTFE core engine allocation & memory API improvemenetsRalf Jung-2/+1
- make Allocation API offset-based (no more Pointer) - make Memory API higher-level (combine checking for access and getting access into one operation)
2021-04-30Sync rustc_codegen_cranelift 'ddd4ce25535cf71203ba3700896131ce55fde795'Erin Power-78/+85
2021-04-14Add more SIMD math.h intrinsicsJubilee Young-0/+2
LLVM supports many functions from math.h in its IR. Many of these have single-instruction variants on various platforms. So, let's add them so std::arch can use them. Yes, exact comparison is intentional: rounding must always return a valid integer-equal value, except for inf/NAN.
2021-03-29Merge commit '0969bc6dde001e01e7e1f58c8ccd7750f8a49ae1' into ↵bjorn3-1/+1
sync_cg_clif-2021-03-29
2021-03-19Add simd_neg platform intrinsicSparrowLii-0/+1
2021-03-12Prepare mir::Constant for ty::Const only supporting valtreesOli Scherer-7/+7
2021-03-05Merge commit '9a0c32934ebe376128230aa8da3275697b2053e7' into ↵bjorn3-172/+152
sync_cg_clif-2021-03-05
2021-01-16codegen_cranelift: Fix redundant semicolon warnÖmer Sinan Ağacan-1/+1
2020-12-27Merge commit 'dbee13661efa269cb4cd57bb4c6b99a19732b484' into ↵bjorn3-69/+29
sync_cg_clif-2020-12-27
2020-12-09Auto merge of #77611 - oli-obk:atomic_miri_leakage, r=nagisabors-2/+2
Directly use raw pointers in `AtomicPtr` store/load I was unable to find any reason for this limitation in the latest source of LLVM or in the documentation [here](http://llvm.org/docs/Atomics.html#libcalls-atomic). fixes https://github.com/rust-lang/miri/issues/1574
2020-11-29Allow cranelift to handle atomic pointersoli-2/+2
2020-11-27Merge commit '5988bbd24aa87732bfa1d111ba00bcdaa22c481a' into ↵bjorn3-26/+119
sync_cg_clif-2020-11-27
2020-11-04Fix cranelift buildoli-1/+2
2020-11-03Merge commit '03f01bbe901d60b71cf2c5ec766aef5e532ab79d' into ↵bjorn3-22/+23
update_cg_clif-2020-11-01
2020-10-26Add 'compiler/rustc_codegen_cranelift/' from commit ↵bjorn3-0/+1553
'793d26047f994e23415f8f6bb5686ff25d3dda92' git-subtree-dir: compiler/rustc_codegen_cranelift git-subtree-mainline: cf798c1ec65a5ec3491846777f9003fabb881b4a git-subtree-split: 793d26047f994e23415f8f6bb5686ff25d3dda92