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.
@@ -317,6 +335,14 @@ extern "platform-intrinsic" {
317335 /// Starting with the value `y`, add the elements of `x` and accumulate.
318336 pub fn simd_reduce_add_ordered < T , U > ( x : T , y : U ) -> U ;
319337
338+ /// Add elements within a vector in arbitrary order. May also be re-associated with
339+ /// unordered additions on the inputs/outputs.
340+ ///
341+ /// `T` must be a vector of integer or floating-point primitive types.
342+ ///
343+ /// `U` must be the element type of `T`.
344+ pub fn simd_reduce_add_unordered < T , U > ( x : T ) -> U ;
345+
320346 /// Multiply elements within a vector from left to right.
321347 ///
322348 /// `T` must be a vector of integer or floating-point primitive types.
@@ -326,6 +352,14 @@ extern "platform-intrinsic" {
326352 /// Starting with the value `y`, multiply the elements of `x` and accumulate.
327353 pub fn simd_reduce_mul_ordered < T , U > ( x : T , y : U ) -> U ;
328354
355+ /// Add elements within a vector in arbitrary order. May also be re-associated with
356+ /// unordered additions on the inputs/outputs.
357+ ///
358+ /// `T` must be a vector of integer or floating-point primitive types.
359+ ///
360+ /// `U` must be the element type of `T`.
361+ pub fn simd_reduce_mul_unordered < T , U > ( x : T ) -> U ;
362+
329363 /// Check if all mask values are true.
330364 ///
331365 /// `T` must be a vector of integer primitive types.
@@ -518,4 +552,39 @@ extern "platform-intrinsic" {
518552 ///
519553 /// `T` must be a vector of floats.
520554 pub fn simd_fma < T > ( x : T , y : T , z : T ) -> T ;
555+
556+ // Computes the sine of each element.
557+ ///
558+ /// `T` must be a vector of floats.
559+ pub fn simd_fsin < T > ( a : T ) -> T ;
560+
561+ // Computes the cosine of each element.
562+ ///
563+ /// `T` must be a vector of floats.
564+ pub fn simd_fcos < T > ( a : T ) -> T ;
565+
566+ // Computes the exponential function of each element.
567+ ///
568+ /// `T` must be a vector of floats.
569+ pub fn simd_fexp < T > ( a : T ) -> T ;
570+
571+ // Computes 2 raised to the power of each element.
572+ ///
573+ /// `T` must be a vector of floats.
574+ pub fn simd_fexp2 < T > ( a : T ) -> T ;
575+
576+ // Computes the base 10 logarithm of each element.
577+ ///
578+ /// `T` must be a vector of floats.
579+ pub fn simd_flog10 < T > ( a : T ) -> T ;
580+
581+ // Computes the base 2 logarithm of each element.
582+ ///
583+ /// `T` must be a vector of floats.
584+ pub fn simd_flog2 < T > ( a : T ) -> T ;
585+
586+ // Computes the natural logarithm of each element.
587+ ///
588+ /// `T` must be a vector of floats.
589+ pub fn simd_flog < T > ( a : T ) -> T ;
521590}
0 commit comments