core/intrinsics/
simd.rs

1//! SIMD compiler intrinsics.
2//!
3//! In this module, a "vector" is any `repr(simd)` type.
4
5/// Inserts an element into a vector, returning the updated vector.
6///
7/// `T` must be a vector with element type `U`.
8///
9/// # Safety
10///
11/// `idx` must be in-bounds of the vector.
12#[rustc_intrinsic]
13#[rustc_intrinsic_must_be_overridden]
14#[rustc_nounwind]
15pub unsafe fn simd_insert<T, U>(_x: T, _idx: u32, _val: U) -> T {
16    unreachable!()
17}
18
19/// Extracts an element from a vector.
20///
21/// `T` must be a vector with element type `U`.
22///
23/// # Safety
24///
25/// `idx` must be in-bounds of the vector.
26#[rustc_intrinsic]
27#[rustc_intrinsic_must_be_overridden]
28#[rustc_nounwind]
29pub unsafe fn simd_extract<T, U>(_x: T, _idx: u32) -> U {
30    unreachable!()
31}
32
33/// Adds two simd vectors elementwise.
34///
35/// `T` must be a vector of integer or floating point primitive types.
36#[rustc_intrinsic]
37#[rustc_intrinsic_must_be_overridden]
38#[rustc_nounwind]
39pub unsafe fn simd_add<T>(_x: T, _y: T) -> T {
40    unreachable!()
41}
42
43/// Subtracts `rhs` from `lhs` elementwise.
44///
45/// `T` must be a vector of integer or floating point primitive types.
46#[rustc_intrinsic]
47#[rustc_intrinsic_must_be_overridden]
48#[rustc_nounwind]
49pub unsafe fn simd_sub<T>(_lhs: T, _rhs: T) -> T {
50    unreachable!()
51}
52
53/// Multiplies two simd vectors elementwise.
54///
55/// `T` must be a vector of integer or floating point primitive types.
56#[rustc_intrinsic]
57#[rustc_intrinsic_must_be_overridden]
58#[rustc_nounwind]
59pub unsafe fn simd_mul<T>(_x: T, _y: T) -> T {
60    unreachable!()
61}
62
63/// Divides `lhs` by `rhs` elementwise.
64///
65/// `T` must be a vector of integer or floating point primitive types.
66///
67/// # Safety
68/// For integers, `rhs` must not contain any zero elements.
69/// Additionally for signed integers, `<int>::MIN / -1` is undefined behavior.
70#[rustc_intrinsic]
71#[rustc_intrinsic_must_be_overridden]
72#[rustc_nounwind]
73pub unsafe fn simd_div<T>(_lhs: T, _rhs: T) -> T {
74    unreachable!()
75}
76
77/// Returns remainder of two vectors elementwise.
78///
79/// `T` must be a vector of integer or floating point primitive types.
80///
81/// # Safety
82/// For integers, `rhs` must not contain any zero elements.
83/// Additionally for signed integers, `<int>::MIN / -1` is undefined behavior.
84#[rustc_intrinsic]
85#[rustc_intrinsic_must_be_overridden]
86#[rustc_nounwind]
87pub unsafe fn simd_rem<T>(_lhs: T, _rhs: T) -> T {
88    unreachable!()
89}
90
91/// Shifts vector left elementwise, with UB on overflow.
92///
93/// Shifts `lhs` left by `rhs`, shifting in sign bits for signed types.
94///
95/// `T` must be a vector of integer primitive types.
96///
97/// # Safety
98///
99/// Each element of `rhs` must be less than `<int>::BITS`.
100#[rustc_intrinsic]
101#[rustc_intrinsic_must_be_overridden]
102#[rustc_nounwind]
103pub unsafe fn simd_shl<T>(_lhs: T, _rhs: T) -> T {
104    unreachable!()
105}
106
107/// Shifts vector right elementwise, with UB on overflow.
108///
109/// `T` must be a vector of integer primitive types.
110///
111/// Shifts `lhs` right by `rhs`, shifting in sign bits for signed types.
112///
113/// # Safety
114///
115/// Each element of `rhs` must be less than `<int>::BITS`.
116#[rustc_intrinsic]
117#[rustc_intrinsic_must_be_overridden]
118#[rustc_nounwind]
119pub unsafe fn simd_shr<T>(_lhs: T, _rhs: T) -> T {
120    unreachable!()
121}
122
123/// "Ands" vectors elementwise.
124///
125/// `T` must be a vector of integer primitive types.
126#[rustc_intrinsic]
127#[rustc_intrinsic_must_be_overridden]
128#[rustc_nounwind]
129pub unsafe fn simd_and<T>(_x: T, _y: T) -> T {
130    unreachable!()
131}
132
133/// "Ors" vectors elementwise.
134///
135/// `T` must be a vector of integer primitive types.
136#[rustc_intrinsic]
137#[rustc_intrinsic_must_be_overridden]
138#[rustc_nounwind]
139pub unsafe fn simd_or<T>(_x: T, _y: T) -> T {
140    unreachable!()
141}
142
143/// "Exclusive ors" vectors elementwise.
144///
145/// `T` must be a vector of integer primitive types.
146#[rustc_intrinsic]
147#[rustc_intrinsic_must_be_overridden]
148#[rustc_nounwind]
149pub unsafe fn simd_xor<T>(_x: T, _y: T) -> T {
150    unreachable!()
151}
152
153/// Numerically casts a vector, elementwise.
154///
155/// `T` and `U` must be vectors of integer or floating point primitive types, and must have the
156/// same length.
157///
158/// When casting floats to integers, the result is truncated. Out-of-bounds result lead to UB.
159/// When casting integers to floats, the result is rounded.
160/// Otherwise, truncates or extends the value, maintaining the sign for signed integers.
161///
162/// # Safety
163/// Casting from integer types is always safe.
164/// Casting between two float types is also always safe.
165///
166/// Casting floats to integers truncates, following the same rules as `to_int_unchecked`.
167/// Specifically, each element must:
168/// * Not be `NaN`
169/// * Not be infinite
170/// * Be representable in the return type, after truncating off its fractional part
171#[rustc_intrinsic]
172#[rustc_intrinsic_must_be_overridden]
173#[rustc_nounwind]
174pub unsafe fn simd_cast<T, U>(_x: T) -> U {
175    unreachable!()
176}
177
178/// Numerically casts a vector, elementwise.
179///
180/// `T` and `U` be a vectors of integer or floating point primitive types, and must have the
181/// same length.
182///
183/// Like `simd_cast`, but saturates float-to-integer conversions (NaN becomes 0).
184/// This matches regular `as` and is always safe.
185///
186/// When casting floats to integers, the result is truncated.
187/// When casting integers to floats, the result is rounded.
188/// Otherwise, truncates or extends the value, maintaining the sign for signed integers.
189#[rustc_intrinsic]
190#[rustc_intrinsic_must_be_overridden]
191#[rustc_nounwind]
192pub unsafe fn simd_as<T, U>(_x: T) -> U {
193    unreachable!()
194}
195
196/// Negates a vector elementwise.
197///
198/// `T` must be a vector of integer or floating-point primitive types.
199///
200/// Rust panics for `-<int>::Min` due to overflow, but it is not UB with this intrinsic.
201#[rustc_intrinsic]
202#[rustc_intrinsic_must_be_overridden]
203#[rustc_nounwind]
204pub unsafe fn simd_neg<T>(_x: T) -> T {
205    unreachable!()
206}
207
208/// Returns absolute value of a vector, elementwise.
209///
210/// `T` must be a vector of floating-point primitive types.
211#[rustc_intrinsic]
212#[rustc_intrinsic_must_be_overridden]
213#[rustc_nounwind]
214pub unsafe fn simd_fabs<T>(_x: T) -> T {
215    unreachable!()
216}
217
218/// Returns the minimum of two vectors, elementwise.
219///
220/// `T` must be a vector of floating-point primitive types.
221///
222/// Follows IEEE-754 `minNum` semantics.
223#[rustc_intrinsic]
224#[rustc_intrinsic_must_be_overridden]
225#[rustc_nounwind]
226pub unsafe fn simd_fmin<T>(_x: T, _y: T) -> T {
227    unreachable!()
228}
229
230/// Returns the maximum of two vectors, elementwise.
231///
232/// `T` must be a vector of floating-point primitive types.
233///
234/// Follows IEEE-754 `maxNum` semantics.
235#[rustc_intrinsic]
236#[rustc_intrinsic_must_be_overridden]
237#[rustc_nounwind]
238pub unsafe fn simd_fmax<T>(_x: T, _y: T) -> T {
239    unreachable!()
240}
241
242/// Tests elementwise equality of two vectors.
243///
244/// `T` must be a vector of floating-point primitive types.
245///
246/// `U` must be a vector of integers with the same number of elements and element size as `T`.
247///
248/// Returns `0` for false and `!0` for true.
249#[rustc_intrinsic]
250#[rustc_intrinsic_must_be_overridden]
251#[rustc_nounwind]
252pub unsafe fn simd_eq<T, U>(_x: T, _y: T) -> U {
253    unreachable!()
254}
255
256/// Tests elementwise inequality equality of two vectors.
257///
258/// `T` must be a vector of floating-point primitive types.
259///
260/// `U` must be a vector of integers with the same number of elements and element size as `T`.
261///
262/// Returns `0` for false and `!0` for true.
263#[rustc_intrinsic]
264#[rustc_intrinsic_must_be_overridden]
265#[rustc_nounwind]
266pub unsafe fn simd_ne<T, U>(_x: T, _y: T) -> U {
267    unreachable!()
268}
269
270/// Tests if `x` is less than `y`, elementwise.
271///
272/// `T` must be a vector of floating-point primitive types.
273///
274/// `U` must be a vector of integers with the same number of elements and element size as `T`.
275///
276/// Returns `0` for false and `!0` for true.
277#[rustc_intrinsic]
278#[rustc_intrinsic_must_be_overridden]
279#[rustc_nounwind]
280pub unsafe fn simd_lt<T, U>(_x: T, _y: T) -> U {
281    unreachable!()
282}
283
284/// Tests if `x` is less than or equal to `y`, elementwise.
285///
286/// `T` must be a vector of floating-point primitive types.
287///
288/// `U` must be a vector of integers with the same number of elements and element size as `T`.
289///
290/// Returns `0` for false and `!0` for true.
291#[rustc_intrinsic]
292#[rustc_intrinsic_must_be_overridden]
293#[rustc_nounwind]
294pub unsafe fn simd_le<T, U>(_x: T, _y: T) -> U {
295    unreachable!()
296}
297
298/// Tests if `x` is greater than `y`, elementwise.
299///
300/// `T` must be a vector of floating-point primitive types.
301///
302/// `U` must be a vector of integers with the same number of elements and element size as `T`.
303///
304/// Returns `0` for false and `!0` for true.
305#[rustc_intrinsic]
306#[rustc_intrinsic_must_be_overridden]
307#[rustc_nounwind]
308pub unsafe fn simd_gt<T, U>(_x: T, _y: T) -> U {
309    unreachable!()
310}
311
312/// Tests if `x` is greater than or equal to `y`, elementwise.
313///
314/// `T` must be a vector of floating-point primitive types.
315///
316/// `U` must be a vector of integers with the same number of elements and element size as `T`.
317///
318/// Returns `0` for false and `!0` for true.
319#[rustc_intrinsic]
320#[rustc_intrinsic_must_be_overridden]
321#[rustc_nounwind]
322pub unsafe fn simd_ge<T, U>(_x: T, _y: T) -> U {
323    unreachable!()
324}
325
326/// Shuffles two vectors by const indices.
327///
328/// `T` must be a vector.
329///
330/// `U` must be a **const** vector of `u32`s. This means it must either refer to a named
331/// const or be given as an inline const expression (`const { ... }`).
332///
333/// `V` must be a vector with the same element type as `T` and the same length as `U`.
334///
335/// Returns a new vector such that element `i` is selected from `xy[idx[i]]`, where `xy`
336/// is the concatenation of `x` and `y`. It is a compile-time error if `idx[i]` is out-of-bounds
337/// of `xy`.
338#[rustc_intrinsic]
339#[rustc_intrinsic_must_be_overridden]
340#[rustc_nounwind]
341pub unsafe fn simd_shuffle<T, U, V>(_x: T, _y: T, _idx: U) -> V {
342    unreachable!()
343}
344
345/// Reads a vector of pointers.
346///
347/// `T` must be a vector.
348///
349/// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`.
350///
351/// `V` must be a vector of integers with the same length as `T` (but any element size).
352///
353/// For each pointer in `ptr`, if the corresponding value in `mask` is `!0`, read the pointer.
354/// Otherwise if the corresponding value in `mask` is `0`, return the corresponding value from
355/// `val`.
356///
357/// # Safety
358/// Unmasked values in `T` must be readable as if by `<ptr>::read` (e.g. aligned to the element
359/// type).
360///
361/// `mask` must only contain `0` or `!0` values.
362#[rustc_intrinsic]
363#[rustc_intrinsic_must_be_overridden]
364#[rustc_nounwind]
365pub unsafe fn simd_gather<T, U, V>(_val: T, _ptr: U, _mask: V) -> T {
366    unreachable!()
367}
368
369/// Writes to a vector of pointers.
370///
371/// `T` must be a vector.
372///
373/// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`.
374///
375/// `V` must be a vector of integers with the same length as `T` (but any element size).
376///
377/// For each pointer in `ptr`, if the corresponding value in `mask` is `!0`, write the
378/// corresponding value in `val` to the pointer.
379/// Otherwise if the corresponding value in `mask` is `0`, do nothing.
380///
381/// The stores happen in left-to-right order.
382/// (This is relevant in case two of the stores overlap.)
383///
384/// # Safety
385/// Unmasked values in `T` must be writeable as if by `<ptr>::write` (e.g. aligned to the element
386/// type).
387///
388/// `mask` must only contain `0` or `!0` values.
389#[rustc_intrinsic]
390#[rustc_intrinsic_must_be_overridden]
391#[rustc_nounwind]
392pub unsafe fn simd_scatter<T, U, V>(_val: T, _ptr: U, _mask: V) {
393    unreachable!()
394}
395
396/// Reads a vector of pointers.
397///
398/// `T` must be a vector.
399///
400/// `U` must be a pointer to the element type of `T`
401///
402/// `V` must be a vector of integers with the same length as `T` (but any element size).
403///
404/// For each element, if the corresponding value in `mask` is `!0`, read the corresponding
405/// pointer offset from `ptr`.
406/// The first element is loaded from `ptr`, the second from `ptr.wrapping_offset(1)` and so on.
407/// Otherwise if the corresponding value in `mask` is `0`, return the corresponding value from
408/// `val`.
409///
410/// # Safety
411/// Unmasked values in `T` must be readable as if by `<ptr>::read` (e.g. aligned to the element
412/// type).
413///
414/// `mask` must only contain `0` or `!0` values.
415#[rustc_intrinsic]
416#[rustc_intrinsic_must_be_overridden]
417#[rustc_nounwind]
418pub unsafe fn simd_masked_load<V, U, T>(_mask: V, _ptr: U, _val: T) -> T {
419    unreachable!()
420}
421
422/// Writes to a vector of pointers.
423///
424/// `T` must be a vector.
425///
426/// `U` must be a pointer to the element type of `T`
427///
428/// `V` must be a vector of integers with the same length as `T` (but any element size).
429///
430/// For each element, if the corresponding value in `mask` is `!0`, write the corresponding
431/// value in `val` to the pointer offset from `ptr`.
432/// The first element is written to `ptr`, the second to `ptr.wrapping_offset(1)` and so on.
433/// Otherwise if the corresponding value in `mask` is `0`, do nothing.
434///
435/// # Safety
436/// Unmasked values in `T` must be writeable as if by `<ptr>::write` (e.g. aligned to the element
437/// type).
438///
439/// `mask` must only contain `0` or `!0` values.
440#[rustc_intrinsic]
441#[rustc_intrinsic_must_be_overridden]
442#[rustc_nounwind]
443pub unsafe fn simd_masked_store<V, U, T>(_mask: V, _ptr: U, _val: T) {
444    unreachable!()
445}
446
447/// Adds two simd vectors elementwise, with saturation.
448///
449/// `T` must be a vector of integer primitive types.
450#[rustc_intrinsic]
451#[rustc_intrinsic_must_be_overridden]
452#[rustc_nounwind]
453pub unsafe fn simd_saturating_add<T>(_x: T, _y: T) -> T {
454    unreachable!()
455}
456
457/// Subtracts two simd vectors elementwise, with saturation.
458///
459/// `T` must be a vector of integer primitive types.
460///
461/// Subtract `rhs` from `lhs`.
462#[rustc_intrinsic]
463#[rustc_intrinsic_must_be_overridden]
464#[rustc_nounwind]
465pub unsafe fn simd_saturating_sub<T>(_lhs: T, _rhs: T) -> T {
466    unreachable!()
467}
468
469/// Adds elements within a vector from left to right.
470///
471/// `T` must be a vector of integer or floating-point primitive types.
472///
473/// `U` must be the element type of `T`.
474///
475/// Starting with the value `y`, add the elements of `x` and accumulate.
476#[rustc_intrinsic]
477#[rustc_intrinsic_must_be_overridden]
478#[rustc_nounwind]
479pub unsafe fn simd_reduce_add_ordered<T, U>(_x: T, _y: U) -> U {
480    unreachable!()
481}
482
483/// Adds elements within a vector in arbitrary order. May also be re-associated with
484/// unordered additions on the inputs/outputs.
485///
486/// `T` must be a vector of integer or floating-point primitive types.
487///
488/// `U` must be the element type of `T`.
489#[rustc_intrinsic]
490#[rustc_intrinsic_must_be_overridden]
491#[rustc_nounwind]
492pub unsafe fn simd_reduce_add_unordered<T, U>(_x: T) -> U {
493    unreachable!()
494}
495
496/// Multiplies elements within a vector from left to right.
497///
498/// `T` must be a vector of integer or floating-point primitive types.
499///
500/// `U` must be the element type of `T`.
501///
502/// Starting with the value `y`, multiply the elements of `x` and accumulate.
503#[rustc_intrinsic]
504#[rustc_intrinsic_must_be_overridden]
505#[rustc_nounwind]
506pub unsafe fn simd_reduce_mul_ordered<T, U>(_x: T, _y: U) -> U {
507    unreachable!()
508}
509
510/// Multiplies elements within a vector in arbitrary order. May also be re-associated with
511/// unordered additions on the inputs/outputs.
512///
513/// `T` must be a vector of integer or floating-point primitive types.
514///
515/// `U` must be the element type of `T`.
516#[rustc_intrinsic]
517#[rustc_intrinsic_must_be_overridden]
518#[rustc_nounwind]
519pub unsafe fn simd_reduce_mul_unordered<T, U>(_x: T) -> U {
520    unreachable!()
521}
522
523/// Checks if all mask values are true.
524///
525/// `T` must be a vector of integer primitive types.
526///
527/// # Safety
528/// `x` must contain only `0` or `!0`.
529#[rustc_intrinsic]
530#[rustc_intrinsic_must_be_overridden]
531#[rustc_nounwind]
532pub unsafe fn simd_reduce_all<T>(_x: T) -> bool {
533    unreachable!()
534}
535
536/// Checks if any mask value is true.
537///
538/// `T` must be a vector of integer primitive types.
539///
540/// # Safety
541/// `x` must contain only `0` or `!0`.
542#[rustc_intrinsic]
543#[rustc_intrinsic_must_be_overridden]
544#[rustc_nounwind]
545pub unsafe fn simd_reduce_any<T>(_x: T) -> bool {
546    unreachable!()
547}
548
549/// Returns the maximum element of a vector.
550///
551/// `T` must be a vector of integer or floating-point primitive types.
552///
553/// `U` must be the element type of `T`.
554///
555/// For floating-point values, uses IEEE-754 `maxNum`.
556#[rustc_intrinsic]
557#[rustc_intrinsic_must_be_overridden]
558#[rustc_nounwind]
559pub unsafe fn simd_reduce_max<T, U>(_x: T) -> U {
560    unreachable!()
561}
562
563/// Returns the minimum element of a vector.
564///
565/// `T` must be a vector of integer or floating-point primitive types.
566///
567/// `U` must be the element type of `T`.
568///
569/// For floating-point values, uses IEEE-754 `minNum`.
570#[rustc_intrinsic]
571#[rustc_intrinsic_must_be_overridden]
572#[rustc_nounwind]
573pub unsafe fn simd_reduce_min<T, U>(_x: T) -> U {
574    unreachable!()
575}
576
577/// Logical "ands" all elements together.
578///
579/// `T` must be a vector of integer or floating-point primitive types.
580///
581/// `U` must be the element type of `T`.
582#[rustc_intrinsic]
583#[rustc_intrinsic_must_be_overridden]
584#[rustc_nounwind]
585pub unsafe fn simd_reduce_and<T, U>(_x: T) -> U {
586    unreachable!()
587}
588
589/// Logical "ors" all elements together.
590///
591/// `T` must be a vector of integer or floating-point primitive types.
592///
593/// `U` must be the element type of `T`.
594#[rustc_intrinsic]
595#[rustc_intrinsic_must_be_overridden]
596#[rustc_nounwind]
597pub unsafe fn simd_reduce_or<T, U>(_x: T) -> U {
598    unreachable!()
599}
600
601/// Logical "exclusive ors" all elements together.
602///
603/// `T` must be a vector of integer or floating-point primitive types.
604///
605/// `U` must be the element type of `T`.
606#[rustc_intrinsic]
607#[rustc_intrinsic_must_be_overridden]
608#[rustc_nounwind]
609pub unsafe fn simd_reduce_xor<T, U>(_x: T) -> U {
610    unreachable!()
611}
612
613/// Truncates an integer vector to a bitmask.
614///
615/// `T` must be an integer vector.
616///
617/// `U` must be either the smallest unsigned integer with at least as many bits as the length
618/// of `T`, or the smallest array of `u8` with at least as many bits as the length of `T`.
619///
620/// Each element is truncated to a single bit and packed into the result.
621///
622/// No matter whether the output is an array or an unsigned integer, it is treated as a single
623/// contiguous list of bits. The bitmask is always packed on the least-significant side of the
624/// output, and padded with 0s in the most-significant bits. The order of the bits depends on
625/// endianness:
626///
627/// * On little endian, the least significant bit corresponds to the first vector element.
628/// * On big endian, the least significant bit corresponds to the last vector element.
629///
630/// For example, `[!0, 0, !0, !0]` packs to
631/// - `0b1101u8` or `[0b1101]` on little endian, and
632/// - `0b1011u8` or `[0b1011]` on big endian.
633///
634/// To consider a larger example,
635/// `[!0, 0, 0, 0, 0, 0, 0, 0, !0, !0, 0, 0, 0, 0, !0, 0]` packs to
636/// - `0b0100001100000001u16` or `[0b00000001, 0b01000011]` on little endian, and
637/// - `0b1000000011000010u16` or `[0b10000000, 0b11000010]` on big endian.
638///
639/// And finally, a non-power-of-2 example with multiple bytes:
640/// `[!0, !0, 0, !0, 0, 0, !0, 0, !0, 0]` packs to
641/// - `0b0101001011u16` or `[0b01001011, 0b01]` on little endian, and
642/// - `0b1101001010u16` or `[0b11, 0b01001010]` on big endian.
643///
644/// # Safety
645/// `x` must contain only `0` and `!0`.
646#[rustc_intrinsic]
647#[rustc_intrinsic_must_be_overridden]
648#[rustc_nounwind]
649pub unsafe fn simd_bitmask<T, U>(_x: T) -> U {
650    unreachable!()
651}
652
653/// Selects elements from a mask.
654///
655/// `M` must be an integer vector.
656///
657/// `T` must be a vector with the same number of elements as `M`.
658///
659/// For each element, if the corresponding value in `mask` is `!0`, select the element from
660/// `if_true`.  If the corresponding value in `mask` is `0`, select the element from
661/// `if_false`.
662///
663/// # Safety
664/// `mask` must only contain `0` and `!0`.
665#[rustc_intrinsic]
666#[rustc_intrinsic_must_be_overridden]
667#[rustc_nounwind]
668pub unsafe fn simd_select<M, T>(_mask: M, _if_true: T, _if_false: T) -> T {
669    unreachable!()
670}
671
672/// Selects elements from a bitmask.
673///
674/// `M` must be an unsigned integer or array of `u8`, matching `simd_bitmask`.
675///
676/// `T` must be a vector.
677///
678/// For each element, if the bit in `mask` is `1`, select the element from
679/// `if_true`.  If the corresponding bit in `mask` is `0`, select the element from
680/// `if_false`.
681///
682/// The bitmask bit order matches `simd_bitmask`.
683///
684/// # Safety
685/// Padding bits must be all zero.
686#[rustc_intrinsic]
687#[rustc_intrinsic_must_be_overridden]
688#[rustc_nounwind]
689pub unsafe fn simd_select_bitmask<M, T>(_m: M, _yes: T, _no: T) -> T {
690    unreachable!()
691}
692
693/// Calculates the offset from a pointer vector elementwise, potentially
694/// wrapping.
695///
696/// `T` must be a vector of pointers.
697///
698/// `U` must be a vector of `isize` or `usize` with the same number of elements as `T`.
699///
700/// Operates as if by `<ptr>::wrapping_offset`.
701#[rustc_intrinsic]
702#[rustc_intrinsic_must_be_overridden]
703#[rustc_nounwind]
704pub unsafe fn simd_arith_offset<T, U>(_ptr: T, _offset: U) -> T {
705    unreachable!()
706}
707
708/// Casts a vector of pointers.
709///
710/// `T` and `U` must be vectors of pointers with the same number of elements.
711#[rustc_intrinsic]
712#[rustc_intrinsic_must_be_overridden]
713#[rustc_nounwind]
714pub unsafe fn simd_cast_ptr<T, U>(_ptr: T) -> U {
715    unreachable!()
716}
717
718/// Exposes a vector of pointers as a vector of addresses.
719///
720/// `T` must be a vector of pointers.
721///
722/// `U` must be a vector of `usize` with the same length as `T`.
723#[rustc_intrinsic]
724#[rustc_intrinsic_must_be_overridden]
725#[rustc_nounwind]
726pub unsafe fn simd_expose_provenance<T, U>(_ptr: T) -> U {
727    unreachable!()
728}
729
730/// Creates a vector of pointers from a vector of addresses.
731///
732/// `T` must be a vector of `usize`.
733///
734/// `U` must be a vector of pointers, with the same length as `T`.
735#[rustc_intrinsic]
736#[rustc_intrinsic_must_be_overridden]
737#[rustc_nounwind]
738pub unsafe fn simd_with_exposed_provenance<T, U>(_addr: T) -> U {
739    unreachable!()
740}
741
742/// Swaps bytes of each element.
743///
744/// `T` must be a vector of integers.
745#[rustc_intrinsic]
746#[rustc_intrinsic_must_be_overridden]
747#[rustc_nounwind]
748pub unsafe fn simd_bswap<T>(_x: T) -> T {
749    unreachable!()
750}
751
752/// Reverses bits of each element.
753///
754/// `T` must be a vector of integers.
755#[rustc_intrinsic]
756#[rustc_intrinsic_must_be_overridden]
757#[rustc_nounwind]
758pub unsafe fn simd_bitreverse<T>(_x: T) -> T {
759    unreachable!()
760}
761
762/// Counts the leading zeros of each element.
763///
764/// `T` must be a vector of integers.
765#[rustc_intrinsic]
766#[rustc_intrinsic_must_be_overridden]
767#[rustc_nounwind]
768pub unsafe fn simd_ctlz<T>(_x: T) -> T {
769    unreachable!()
770}
771
772/// Counts the number of ones in each element.
773///
774/// `T` must be a vector of integers.
775#[rustc_intrinsic]
776#[rustc_intrinsic_must_be_overridden]
777#[rustc_nounwind]
778pub unsafe fn simd_ctpop<T>(_x: T) -> T {
779    unreachable!()
780}
781
782/// Counts the trailing zeros of each element.
783///
784/// `T` must be a vector of integers.
785#[rustc_intrinsic]
786#[rustc_intrinsic_must_be_overridden]
787#[rustc_nounwind]
788pub unsafe fn simd_cttz<T>(_x: T) -> T {
789    unreachable!()
790}
791
792/// Rounds up each element to the next highest integer-valued float.
793///
794/// `T` must be a vector of floats.
795#[rustc_intrinsic]
796#[rustc_intrinsic_must_be_overridden]
797#[rustc_nounwind]
798pub unsafe fn simd_ceil<T>(_x: T) -> T {
799    unreachable!()
800}
801
802/// Rounds down each element to the next lowest integer-valued float.
803///
804/// `T` must be a vector of floats.
805#[rustc_intrinsic]
806#[rustc_intrinsic_must_be_overridden]
807#[rustc_nounwind]
808pub unsafe fn simd_floor<T>(_x: T) -> T {
809    unreachable!()
810}
811
812/// Rounds each element to the closest integer-valued float.
813/// Ties are resolved by rounding away from 0.
814///
815/// `T` must be a vector of floats.
816#[rustc_intrinsic]
817#[rustc_intrinsic_must_be_overridden]
818#[rustc_nounwind]
819pub unsafe fn simd_round<T>(_x: T) -> T {
820    unreachable!()
821}
822
823/// Returns the integer part of each element as an integer-valued float.
824/// In other words, non-integer values are truncated towards zero.
825///
826/// `T` must be a vector of floats.
827#[rustc_intrinsic]
828#[rustc_intrinsic_must_be_overridden]
829#[rustc_nounwind]
830pub unsafe fn simd_trunc<T>(_x: T) -> T {
831    unreachable!()
832}
833
834/// Takes the square root of each element.
835///
836/// `T` must be a vector of floats.
837#[rustc_intrinsic]
838#[rustc_intrinsic_must_be_overridden]
839#[rustc_nounwind]
840pub unsafe fn simd_fsqrt<T>(_x: T) -> T {
841    unreachable!()
842}
843
844/// Computes `(x*y) + z` for each element, but without any intermediate rounding.
845///
846/// `T` must be a vector of floats.
847#[rustc_intrinsic]
848#[rustc_intrinsic_must_be_overridden]
849#[rustc_nounwind]
850pub unsafe fn simd_fma<T>(_x: T, _y: T, _z: T) -> T {
851    unreachable!()
852}
853
854/// Computes `(x*y) + z` for each element, non-deterministically executing either
855/// a fused multiply-add or two operations with rounding of the intermediate result.
856///
857/// The operation is fused if the code generator determines that target instruction
858/// set has support for a fused operation, and that the fused operation is more efficient
859/// than the equivalent, separate pair of mul and add instructions. It is unspecified
860/// whether or not a fused operation is selected, and that may depend on optimization
861/// level and context, for example. It may even be the case that some SIMD lanes get fused
862/// and others do not.
863///
864/// `T` must be a vector of floats.
865#[rustc_intrinsic]
866#[rustc_intrinsic_must_be_overridden]
867#[rustc_nounwind]
868pub unsafe fn simd_relaxed_fma<T>(_x: T, _y: T, _z: T) -> T {
869    unreachable!()
870}
871
872// Computes the sine of each element.
873///
874/// `T` must be a vector of floats.
875#[rustc_intrinsic]
876#[rustc_intrinsic_must_be_overridden]
877#[rustc_nounwind]
878pub unsafe fn simd_fsin<T>(_a: T) -> T {
879    unreachable!()
880}
881
882// Computes the cosine of each element.
883///
884/// `T` must be a vector of floats.
885#[rustc_intrinsic]
886#[rustc_intrinsic_must_be_overridden]
887#[rustc_nounwind]
888pub unsafe fn simd_fcos<T>(_a: T) -> T {
889    unreachable!()
890}
891
892// Computes the exponential function of each element.
893///
894/// `T` must be a vector of floats.
895#[rustc_intrinsic]
896#[rustc_intrinsic_must_be_overridden]
897#[rustc_nounwind]
898pub unsafe fn simd_fexp<T>(_a: T) -> T {
899    unreachable!()
900}
901
902// Computes 2 raised to the power of each element.
903///
904/// `T` must be a vector of floats.
905#[rustc_intrinsic]
906#[rustc_intrinsic_must_be_overridden]
907#[rustc_nounwind]
908pub unsafe fn simd_fexp2<T>(_a: T) -> T {
909    unreachable!()
910}
911
912// Computes the base 10 logarithm of each element.
913///
914/// `T` must be a vector of floats.
915#[rustc_intrinsic]
916#[rustc_intrinsic_must_be_overridden]
917#[rustc_nounwind]
918pub unsafe fn simd_flog10<T>(_a: T) -> T {
919    unreachable!()
920}
921
922// Computes the base 2 logarithm of each element.
923///
924/// `T` must be a vector of floats.
925#[rustc_intrinsic]
926#[rustc_intrinsic_must_be_overridden]
927#[rustc_nounwind]
928pub unsafe fn simd_flog2<T>(_a: T) -> T {
929    unreachable!()
930}
931
932// Computes the natural logarithm of each element.
933///
934/// `T` must be a vector of floats.
935#[rustc_intrinsic]
936#[rustc_intrinsic_must_be_overridden]
937#[rustc_nounwind]
938pub unsafe fn simd_flog<T>(_a: T) -> T {
939    unreachable!()
940}