Skip to content

Commit d655dd6

Browse files
committed
Add new intrinsics
1 parent 4767aaf commit d655dd6

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Diff for: library/core/src/intrinsics/simd.rs

+39
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,45 @@ extern "platform-intrinsic" {
239239
/// `mask` must only contain `0` or `!0` values.
240240
pub fn simd_scatter<T, U, V>(val: T, ptr: U, mask: V);
241241

242+
/// Read a vector of pointers.
243+
///
244+
/// `T` must be a vector.
245+
///
246+
/// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`.
247+
///
248+
/// `V` must be a vector of integers with the same length as `T` (but any element size).
249+
///
250+
/// For each element, if the corresponding value in `mask` is `!0`, read the corresponding
251+
/// pointer from `ptr`.
252+
/// Otherwise if the corresponding value in `mask` is `0`, return the corresponding value from
253+
/// `val`.
254+
///
255+
/// # Safety
256+
/// Unmasked values in `T` must be readable as if by `<ptr>::read` (e.g. aligned to the element
257+
/// type).
258+
///
259+
/// `mask` must only contain `0` or `!0` values.
260+
pub fn simd_masked_load<V, U, T>(mask: V, ptr: U, val: T) -> T;
261+
262+
/// Write to a vector of pointers.
263+
///
264+
/// `T` must be a vector.
265+
///
266+
/// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`.
267+
///
268+
/// `V` must be a vector of integers with the same length as `T` (but any element size).
269+
///
270+
/// For each element, if the corresponding value in `mask` is `!0`, write the corresponding
271+
/// value in `val` to the pointer.
272+
/// Otherwise if the corresponding value in `mask` is `0`, do nothing.
273+
///
274+
/// # Safety
275+
/// Unmasked values in `T` must be writeable as if by `<ptr>::write` (e.g. aligned to the element
276+
/// type).
277+
///
278+
/// `mask` must only contain `0` or `!0` values.
279+
pub fn simd_masked_store<V, U, T>(mask: V, ptr: U, val: T);
280+
242281
/// Add two simd vectors elementwise, with saturation.
243282
///
244283
/// `T` must be a vector of integer primitive types.

0 commit comments

Comments
 (0)