@@ -1448,6 +1448,17 @@ mod sealed {
1448
1448
impl_vec_trait ! { [ VectorSubc vec_subc] vec_vscbih ( vector_unsigned_short, vector_unsigned_short) -> vector_unsigned_short }
1449
1449
impl_vec_trait ! { [ VectorSubc vec_subc] vec_vscbif ( vector_unsigned_int, vector_unsigned_int) -> vector_unsigned_int }
1450
1450
impl_vec_trait ! { [ VectorSubc vec_subc] vec_vscbig ( vector_unsigned_long_long, vector_unsigned_long_long) -> vector_unsigned_long_long }
1451
+
1452
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1453
+ pub trait VectorSqrt {
1454
+ unsafe fn vec_sqrt ( self ) -> Self ;
1455
+ }
1456
+
1457
+ test_impl ! { vec_sqrt_f32 ( v: vector_float) -> vector_float [ simd_fsqrt, "vector-enhancements-1" vfsqsb ] }
1458
+ test_impl ! { vec_sqrt_f64 ( v: vector_double) -> vector_double [ simd_fsqrt, vfsqdb ] }
1459
+
1460
+ impl_vec_trait ! { [ VectorSqrt vec_sqrt] vec_sqrt_f32 ( vector_float) }
1461
+ impl_vec_trait ! { [ VectorSqrt vec_sqrt] vec_sqrt_f64 ( vector_double) }
1451
1462
}
1452
1463
1453
1464
/// Vector element-wise addition.
@@ -1568,6 +1579,17 @@ where
1568
1579
a. vec_nabs ( )
1569
1580
}
1570
1581
1582
+ /// Vector square root.
1583
+ #[ inline]
1584
+ #[ target_feature( enable = "vector" ) ]
1585
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
1586
+ pub unsafe fn vec_sqrt < T > ( a : T ) -> T
1587
+ where
1588
+ T : sealed:: VectorSqrt ,
1589
+ {
1590
+ a. vec_sqrt ( )
1591
+ }
1592
+
1571
1593
/// Vector splats.
1572
1594
#[ inline]
1573
1595
#[ target_feature( enable = "vector" ) ]
@@ -2650,4 +2672,8 @@ mod tests {
2650
2672
[ 0x00 , 0x01 , 0x02 , 0x03 , 0x10 , 0x11 , 0x12 , 0x13 ,
2651
2673
0x04 , 0x05 , 0x06 , 0x07 , 0x14 , 0x15 , 0x16 , 0x17 ] ,
2652
2674
[ 0.0 , 1.0 , 1.0 , 1.1 ] }
2675
+
2676
+ test_vec_1 ! { test_vec_sqrt, vec_sqrt, f32x4,
2677
+ [ core:: f32 :: consts:: PI , 1.0 , 25.0 , 2.0 ] ,
2678
+ [ core:: f32 :: consts:: PI . sqrt( ) , 1.0 , 5.0 , core:: f32 :: consts:: SQRT_2 ] }
2653
2679
}
0 commit comments