3
3
//! In this module, a "vector" is any `repr(simd)` type.
4
4
5
5
extern "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
+
6
24
/// Add two simd vectors elementwise.
7
25
///
8
26
/// `T` must be a vector of integer or floating point primitive types.
@@ -317,6 +335,18 @@ extern "platform-intrinsic" {
317
335
/// Starting with the value `y`, add the elements of `x` and accumulate.
318
336
pub fn simd_reduce_add_ordered < T , U > ( x : T , y : U ) -> U ;
319
337
338
+ /// Add elements within a vector in arbitrary order, and without regard
339
+ /// for signed zeros.
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
+ ///
345
+ /// # Safety
346
+ ///
347
+ /// All input elements must be finite (i.e., not NAN and not +/- INF).
348
+ pub fn simd_reduce_add_unordered < T , U > ( x : T ) -> U ;
349
+
320
350
/// Multiply elements within a vector from left to right.
321
351
///
322
352
/// `T` must be a vector of integer or floating-point primitive types.
@@ -326,6 +356,18 @@ extern "platform-intrinsic" {
326
356
/// Starting with the value `y`, multiply the elements of `x` and accumulate.
327
357
pub fn simd_reduce_mul_ordered < T , U > ( x : T , y : U ) -> U ;
328
358
359
+ /// Multiply elements within a vector in arbitrary order, and without regard
360
+ /// for signed zeros.
361
+ ///
362
+ /// `T` must be a vector of integer or floating-point primitive types.
363
+ ///
364
+ /// `U` must be the element type of `T`.
365
+ ///
366
+ /// # Safety
367
+ ///
368
+ /// All input elements must be finite (i.e., not NAN and not +/- INF).
369
+ pub fn simd_reduce_mul_unordered < T , U > ( x : T ) -> U ;
370
+
329
371
/// Check if all mask values are true.
330
372
///
331
373
/// `T` must be a vector of integer primitive types.
@@ -351,6 +393,19 @@ extern "platform-intrinsic" {
351
393
/// For floating-point values, uses IEEE-754 `maxNum`.
352
394
pub fn simd_reduce_max < T , U > ( x : T ) -> U ;
353
395
396
+ /// Return the maximum element of a vector.
397
+ ///
398
+ /// `T` must be a vector of integer or floating-point primitive types.
399
+ ///
400
+ /// `U` must be the element type of `T`.
401
+ ///
402
+ /// For floating-point values, uses IEEE-754 `maxNum`.
403
+ ///
404
+ /// # Safety
405
+ ///
406
+ /// All input elements must be finite (i.e., not NAN and not +/- INF).
407
+ pub fn simd_reduce_max_nanless < T , U > ( x : T ) -> U ;
408
+
354
409
/// Return the minimum element of a vector.
355
410
///
356
411
/// `T` must be a vector of integer or floating-point primitive types.
@@ -360,6 +415,19 @@ extern "platform-intrinsic" {
360
415
/// For floating-point values, uses IEEE-754 `minNum`.
361
416
pub fn simd_reduce_min < T , U > ( x : T ) -> U ;
362
417
418
+ /// Return the minimum element of a vector.
419
+ ///
420
+ /// `T` must be a vector of integer or floating-point primitive types.
421
+ ///
422
+ /// `U` must be the element type of `T`.
423
+ ///
424
+ /// For floating-point values, uses IEEE-754 `minNum`.
425
+ ///
426
+ /// # Safety
427
+ ///
428
+ /// All input elements must be finite (i.e., not NAN and not +/- INF).
429
+ pub fn simd_reduce_min_nanless < T , U > ( x : T ) -> U ;
430
+
363
431
/// Logical "and" all elements together.
364
432
///
365
433
/// `T` must be a vector of integer or floating-point primitive types.
@@ -518,4 +586,39 @@ extern "platform-intrinsic" {
518
586
///
519
587
/// `T` must be a vector of floats.
520
588
pub fn simd_fma < T > ( x : T , y : T , z : T ) -> T ;
589
+
590
+ // Computes the sine of each element.
591
+ ///
592
+ /// `T` must be a vector of floats.
593
+ pub fn simd_fsin < T > ( a : T ) -> T ;
594
+
595
+ // Computes the cosine of each element.
596
+ ///
597
+ /// `T` must be a vector of floats.
598
+ pub fn simd_fcos < T > ( a : T ) -> T ;
599
+
600
+ // Computes the exponential function of each element.
601
+ ///
602
+ /// `T` must be a vector of floats.
603
+ pub fn simd_fexp < T > ( a : T ) -> T ;
604
+
605
+ // Computes 2 raised to the power of each element.
606
+ ///
607
+ /// `T` must be a vector of floats.
608
+ pub fn simd_fexp2 < T > ( a : T ) -> T ;
609
+
610
+ // Computes the base 10 logarithm of each element.
611
+ ///
612
+ /// `T` must be a vector of floats.
613
+ pub fn simd_flog10 < T > ( a : T ) -> T ;
614
+
615
+ // Computes the base 2 logarithm of each element.
616
+ ///
617
+ /// `T` must be a vector of floats.
618
+ pub fn simd_flog2 < T > ( a : T ) -> T ;
619
+
620
+ // Computes the natural logarithm of each element.
621
+ ///
622
+ /// `T` must be a vector of floats.
623
+ pub fn simd_flog < T > ( a : T ) -> T ;
521
624
}
0 commit comments