33//! In this module, a "vector" is any `repr(simd)` type.
44
55extern "platform-intrinsic" {
6+ /// Insert an element into a vector, returning the updated vector.
7+ ///
8+ /// `T` must be a vector with element type `U`.
9+ ///
10+ /// # Safety
11+ ///
12+ /// `idx` must be in-bounds of the vector.
13+ pub fn simd_insert < T , U > ( x : T , idx : u32 , val : U ) -> T ;
14+
15+ /// Extract an element from a vector.
16+ ///
17+ /// `T` must be a vector with element type `U`.
18+ ///
19+ /// # Safety
20+ ///
21+ /// `idx` must be in-bounds of the vector.
22+ pub fn simd_extract < T , U > ( x : T , idx : u32 ) -> U ;
23+
624 /// Add two simd vectors elementwise.
725 ///
826 /// `T` must be a vector of integer or floating point primitive types.
@@ -315,6 +333,14 @@ extern "platform-intrinsic" {
315333 /// Starting with the value `y`, add the elements of `x` and accumulate.
316334 pub fn simd_reduce_add_ordered < T , U > ( x : T , y : U ) -> U ;
317335
336+ /// Add elements within a vector in arbitrary order. May also be re-associated with
337+ /// unordered additions on the inputs/outputs.
338+ ///
339+ /// `T` must be a vector of integer or floating-point primitive types.
340+ ///
341+ /// `U` must be the element type of `T`.
342+ pub fn simd_reduce_add_unordered < T , U > ( x : T ) -> U ;
343+
318344 /// Multiply elements within a vector from left to right.
319345 ///
320346 /// `T` must be a vector of integer or floating-point primitive types.
@@ -324,6 +350,14 @@ extern "platform-intrinsic" {
324350 /// Starting with the value `y`, multiply the elements of `x` and accumulate.
325351 pub fn simd_reduce_mul_ordered < T , U > ( x : T , y : U ) -> U ;
326352
353+ /// Add elements within a vector in arbitrary order. May also be re-associated with
354+ /// unordered additions on the inputs/outputs.
355+ ///
356+ /// `T` must be a vector of integer or floating-point primitive types.
357+ ///
358+ /// `U` must be the element type of `T`.
359+ pub fn simd_reduce_mul_unordered < T , U > ( x : T ) -> U ;
360+
327361 /// Check if all mask values are true.
328362 ///
329363 /// `T` must be a vector of integer primitive types.
@@ -349,6 +383,19 @@ extern "platform-intrinsic" {
349383 /// For floating-point values, uses IEEE-754 `maxNum`.
350384 pub fn simd_reduce_max < T , U > ( x : T ) -> U ;
351385
386+ /// Return the maximum element of a vector.
387+ ///
388+ /// `T` must be a vector of integer or floating-point primitive types.
389+ ///
390+ /// `U` must be the element type of `T`.
391+ ///
392+ /// For floating-point values, uses IEEE-754 `maxNum`.
393+ ///
394+ /// # Safety
395+ ///
396+ /// All input elements must be finite (i.e., not NAN and not +/- INF).
397+ pub fn simd_reduce_max_nanless < T , U > ( x : T ) -> U ;
398+
352399 /// Return the minimum element of a vector.
353400 ///
354401 /// `T` must be a vector of integer or floating-point primitive types.
@@ -358,6 +405,19 @@ extern "platform-intrinsic" {
358405 /// For floating-point values, uses IEEE-754 `minNum`.
359406 pub fn simd_reduce_min < T , U > ( x : T ) -> U ;
360407
408+ /// Return the minimum element of a vector.
409+ ///
410+ /// `T` must be a vector of integer or floating-point primitive types.
411+ ///
412+ /// `U` must be the element type of `T`.
413+ ///
414+ /// For floating-point values, uses IEEE-754 `minNum`.
415+ ///
416+ /// # Safety
417+ ///
418+ /// All input elements must be finite (i.e., not NAN and not +/- INF).
419+ pub fn simd_reduce_min_nanless < T , U > ( x : T ) -> U ;
420+
361421 /// Logical "and" all elements together.
362422 ///
363423 /// `T` must be a vector of integer or floating-point primitive types.
@@ -516,4 +576,39 @@ extern "platform-intrinsic" {
516576 ///
517577 /// `T` must be a vector of floats.
518578 pub fn simd_fma < T > ( x : T , y : T , z : T ) -> T ;
579+
580+ // Computes the sine of each element.
581+ ///
582+ /// `T` must be a vector of floats.
583+ pub fn simd_fsin < T > ( a : T ) -> T ;
584+
585+ // Computes the cosine of each element.
586+ ///
587+ /// `T` must be a vector of floats.
588+ pub fn simd_fcos < T > ( a : T ) -> T ;
589+
590+ // Computes the exponential function of each element.
591+ ///
592+ /// `T` must be a vector of floats.
593+ pub fn simd_fexp < T > ( a : T ) -> T ;
594+
595+ // Computes 2 raised to the power of each element.
596+ ///
597+ /// `T` must be a vector of floats.
598+ pub fn simd_fexp2 < T > ( a : T ) -> T ;
599+
600+ // Computes the base 10 logarithm of each element.
601+ ///
602+ /// `T` must be a vector of floats.
603+ pub fn simd_flog10 < T > ( a : T ) -> T ;
604+
605+ // Computes the base 2 logarithm of each element.
606+ ///
607+ /// `T` must be a vector of floats.
608+ pub fn simd_flog2 < T > ( a : T ) -> T ;
609+
610+ // Computes the natural logarithm of each element.
611+ ///
612+ /// `T` must be a vector of floats.
613+ pub fn simd_flog < T > ( a : T ) -> T ;
519614}
0 commit comments