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