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