File tree 3 files changed +17
-0
lines changed
3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,9 @@ extern "platform-intrinsic" {
45
45
46
46
/// fabs
47
47
pub ( crate ) fn simd_fabs < T > ( x : T ) -> T ;
48
+
49
+ /// fsqrt
50
+ pub ( crate ) fn simd_fsqrt < T > ( x : T ) -> T ;
48
51
49
52
pub ( crate ) fn simd_eq < T , U > ( x : T , y : T ) -> U ;
50
53
pub ( crate ) fn simd_ne < T , U > ( x : T , y : T ) -> U ;
Original file line number Diff line number Diff line change @@ -35,6 +35,13 @@ macro_rules! impl_float_vector {
35
35
pub fn abs( self ) -> Self {
36
36
unsafe { crate :: intrinsics:: simd_fabs( self ) }
37
37
}
38
+
39
+ /// Produces a vector where every lane has the square root value
40
+ /// of the equivalently-indexed lane in `self`
41
+ #[ inline]
42
+ pub fn sqrt( self ) -> Self {
43
+ unsafe { crate :: intrinsics:: simd_fsqrt( self ) }
44
+ }
38
45
}
39
46
40
47
impl <const LANES : usize > $name<LANES >
Original file line number Diff line number Diff line change @@ -426,6 +426,13 @@ macro_rules! impl_float_tests {
426
426
)
427
427
}
428
428
429
+ fn sqrt<const LANES : usize >( ) {
430
+ test_helpers:: test_unary_elementwise(
431
+ & Vector :: <LANES >:: sqrt,
432
+ & Scalar :: sqrt,
433
+ & |_| true ,
434
+ )
435
+ }
429
436
fn horizontal_sum<const LANES : usize >( ) {
430
437
test_helpers:: test_1( & |x| {
431
438
test_helpers:: prop_assert_biteq! (
You can’t perform that action at this time.
0 commit comments