about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/intrinsic.rs
AgeCommit message (Collapse)AuthorLines
2023-10-31Merge simd size and type extraction into checking whether a type is simd, as ↵Oli Scherer-48/+26
these always go together.
2023-10-31Simplify all `require_simd` invocations by moving all of the shared ↵Oli Scherer-37/+19
invocation arguments into the macro
2023-10-31don't use the moral equivalent of `assert!(false, "foo")`Oli Scherer-33/+22
2023-09-18Prototype using const generic for simd_shuffle IDX arrayOli Scherer-2/+55
2023-09-15explain PassMode::CastRalf Jung-2/+2
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/+9
2023-08-03Forbid old-style `simd_shuffleN` intrinsicsOli Scherer-21/+13
2023-08-01Auto merge of #105545 - erikdesjardins:ptrclean, r=bjorn3bors-152/+75
cleanup: remove pointee types This can't be merged until the oldest LLVM version we support uses opaque pointers, which will be the case after #114148. (Also note `-Cllvm-args="-opaque-pointers=0"` can technically be used in LLVM 15, though I don't think we should support that configuration.) I initially hoped this would provide some minor perf win, but in https://github.com/rust-lang/rust/pull/105412#issuecomment-1341224450 it had very little impact, so this is only valuable as a cleanup. As a followup, this will enable #96242 to be resolved. r? `@ghost` `@rustbot` label S-blocked
2023-07-31Auto merge of #114266 - calebzulawski:simd-bswap, r=compiler-errorsbors-11/+10
Fix simd_bswap for i8/u8 #114156 missed this test case ☹️ cc `@workingjubilee`
2023-07-30Fix simd_bswap for i8/u8Caleb Zulawski-11/+10
2023-07-30inline format!() args up to and including rustc_codegen_llvmMatthias Krüger-9/+9
2023-07-29cg_llvm: simplify llvm.masked.gather/scatter naming with opaque pointersErik Desjardins-105/+47
With opaque pointers, there's no longer a need to generate a chain of pointer types in the intrinsic name when arguments are pointers to pointers.
2023-07-29cg_llvm: remove pointee types and pointercast/bitcast-of-ptrErik Desjardins-50/+31
2023-07-28Use i1 instead of boolCaleb Zulawski-2/+9
2023-07-27Add SIMD bitreverse, ctlz, cttz intrinsicsCaleb Zulawski-7/+25
2023-07-27Add simd_bswap intrinsicCaleb Zulawski-0/+22
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-3/+3
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-15/+21
2023-06-07fix comment (review change)Jan-Mirko Otter-1/+1
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2023-06-07wasm exception handlingJan-Mirko Otter-1/+77
2023-05-09CFI: Fix SIGILL reached via trait objectsRamon de C Valle-1/+1
Fix #106547 by transforming the concrete self into a reference to a trait object before emitting type metadata identifiers for trait methods.
2023-05-03Add cross-language LLVM CFI support to the Rust compilerRamon de C Valle-12/+16
This commit adds cross-language LLVM Control Flow Integrity (CFI) support to the Rust compiler by adding the `-Zsanitizer-cfi-normalize-integers` option to be used with Clang `-fsanitize-cfi-icall-normalize-integers` for normalizing integer types (see https://reviews.llvm.org/D139395). It provides forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space). For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, see design document in the tracking issue #89653. Cross-language LLVM CFI can be enabled with -Zsanitizer=cfi and -Zsanitizer-cfi-normalize-integers, and requires proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto).
2023-03-22Add `CastKind::Transmute` to MIRScott McMurray-1/+1
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-07Auto merge of #95317 - Jules-Bertholet:round_ties_to_even, ↵bors-0/+2
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-17Use `IntoIterator` for `mk_fn_sig`.Nicholas Nethercote-4/+3
This makes a lot of call sites nicer.
2023-02-14s/eval_usize/eval_target_usize/ for clarityOli Scherer-5/+5
2023-01-22abi: add `AddressSpace` field to `Primitive::Pointer`Erik Desjardins-1/+1
...and remove it from `PointeeInfo`, which isn't meant for this. There are still various places (marked with FIXMEs) that assume all pointers have the same size and alignment. Fixing this requires parsing non-default address spaces in the data layout string, which will be done in a followup.
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-2/+2
2022-12-27DELETE - fn span_invalid_monomorphization_error and localize intrinsics macrosJhonny Bill Mena-247/+282
2022-12-27UPDATE - migrate fn simd_simple_float_intrinsic error messagesJhonny Bill Mena-28/+13
2022-12-27[WIP] UPDATE - migrate intrinsic.rs to new diagnostic infrastructureJhonny Bill Mena-8/+5
WIP - replacing span_invalid_monomorphization_error function. Still in progress due to its use in codegen_llvm inside macros
2022-12-22Allow building std with craneliftJoshua Nelson-1/+1
- Don't pass llvm-specific args when using cranelift - Don't use `asm` in compiler_builtins when using cranelift
2022-12-11Add `round_ties_even` to `f32` and `f64`Jules Bertholet-0/+2
2022-12-03Directly return loaded value from type_checked_loadbjorn3-1/+3
2022-11-23Add `Mutability::{is_mut,is_not}`Maybe Waffle-1/+1
2022-11-08prevent uninitialized access in black_box for zero-sized-typesKrasimir Georgiev-3/+12
2022-10-01Merge apply_attrs_callsite into call and invokebjorn3-18/+34
Some codegen backends are not able to apply callsite attrs after the fact.
2022-09-17Rollup merge of #98441 - calebzulawski:simd_as, r=oli-obkDylan DPC-0/+91
Implement simd_as for pointers Expands `simd_as` (and `simd_cast`) to handle pointer-to-pointer, pointer-to-integer, and integer-to-pointer conversions. cc ``@programmerjake`` ``@thomcc``
2022-08-28Auto merge of #96946 - WaffleLapkin:ptr_mask, r=scottmcmbors-0/+1
Add pointer masking convenience functions This PR adds the following public API: ```rust impl<T: ?Sized> *const T { fn mask(self, mask: usize) -> *const T; } impl<T: ?Sized> *mut T { fn mask(self, mask: usize) -> *const T; } // mod intrinsics fn mask<T>(ptr: *const T, mask: usize) -> *const T ``` This is equivalent to `ptr.map_addr(|a| a & mask)` but also uses a cool llvm intrinsic. Proposed in https://github.com/rust-lang/rust/pull/95643#issuecomment-1121562352 cc `@Gankra` `@scottmcm` `@RalfJung` r? rust-lang/libs-api
2022-08-27Check pointer metadata rather than pointee sizeCaleb Zulawski-10/+14
2022-08-26Move `ArgAbi::pad_i32` into `PassMode::Cast`.Nicholas Nethercote-2/+2
Because it's only needed for that variant. This shrinks the types and clarifies the logic.
2022-08-26Box `CastTarget` within `PassMode`.Nicholas Nethercote-2/+2
Because `PassMode::Cast` is by far the largest variant, but is relatively rare. This requires making `PassMode` not impl `Copy`, and `Clone` is no longer necessary. This causes lots of sigil adjusting, but nothing very notable.
2022-08-21Add pointer masking convenience functionsMaybe Waffle-0/+1
This commit adds the following functions all of which have a signature `pointer, usize -> pointer`: - `<*mut T>::mask` - `<*const T>::mask` - `intrinsics::ptr_mask` These functions are equivalent to `.map_addr(|a| a & mask)` but they utilize `llvm.ptrmask` llvm intrinsic. *masks your pointers*
2022-08-04Require pointers to be sizedCaleb Zulawski-2/+10
2022-07-22Add simd_cast_ptr, simd_expose_addr, and simd_from_exposed_addr intrinsicsCaleb Zulawski-0/+79
2022-06-18rustc_target: Remove some redundant target propertiesVadim Petrochenkov-1/+1
2022-06-14Add llvm.type.checked.load intrinsicflip1995-0/+10
Add the intrinsic declare {i8*, i1} @llvm.type.checked.load(i8* %ptr, i32 %offset, metadata %type) This is used in the VFE optimization when lowering loading functions from vtables to LLVM IR. The `metadata` is used to map the function to all vtables this function could belong to. This ensures that functions from vtables that might be used somewhere won't get removed.
2022-05-27Finish bumping stage0Mark Rousskov-2/+2
It looks like the last time had left some remaining cfg's -- which made me think that the stage0 bump was actually successful. This brings us to a released 1.62 beta though.
2022-05-05Allow unused rules in some places in the compiler, library and toolsest31-0/+2