File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,9 @@ extern "platform-intrinsic" {
4545
4646 /// fabs
4747 pub ( crate ) fn simd_fabs < T > ( x : T ) -> T ;
48+
49+ /// fsqrt
50+ pub ( crate ) fn simd_fsqrt < T > ( x : T ) -> T ;
4851
4952 pub ( crate ) fn simd_eq < T , U > ( x : T , y : T ) -> U ;
5053 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,14 @@ macro_rules! impl_float_vector {
3535 pub fn abs( self ) -> Self {
3636 unsafe { crate :: intrinsics:: simd_fabs( self ) }
3737 }
38+
39+ /// Produces a vector where every lane has the square root value
40+ /// of the equivalently-indexed lane in `self`
41+ #[ inline]
42+ #[ cfg( feature = "std" ) ]
43+ pub fn sqrt( self ) -> Self {
44+ unsafe { crate :: intrinsics:: simd_fsqrt( self ) }
45+ }
3846 }
3947
4048 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 {
426426 )
427427 }
428428
429+ fn sqrt<const LANES : usize >( ) {
430+ test_helpers:: test_unary_elementwise(
431+ & Vector :: <LANES >:: sqrt,
432+ & Scalar :: sqrt,
433+ & |_| true ,
434+ )
435+ }
429436 fn horizontal_sum<const LANES : usize >( ) {
430437 test_helpers:: test_1( & |x| {
431438 test_helpers:: prop_assert_biteq! (
You can’t perform that action at this time.
0 commit comments