@@ -1766,6 +1766,26 @@ pub unsafe fn vget_low_p64(a: poly64x2_t) -> poly64x1_t {
1766
1766
transmute ( u64x1:: new ( simd_extract ( a, 0 ) ) )
1767
1767
}
1768
1768
1769
+ /// Duplicate vector element to vector or scalar
1770
+ #[ inline]
1771
+ #[ target_feature( enable = "neon" ) ]
1772
+ #[ rustc_legacy_const_generics( 1 ) ]
1773
+ #[ cfg_attr( all( test, target_arch = "aarch64" ) , assert_instr( nop, IMM5 = 0 ) ) ]
1774
+ pub unsafe fn vget_lane_f64 < const IMM5 : i32 > ( v : float64x1_t ) -> f64 {
1775
+ static_assert ! ( IMM5 : i32 where IMM5 == 0 ) ;
1776
+ simd_extract ( v, IMM5 as u32 )
1777
+ }
1778
+
1779
+ /// Duplicate vector element to vector or scalar
1780
+ #[ inline]
1781
+ #[ target_feature( enable = "neon" ) ]
1782
+ #[ rustc_legacy_const_generics( 1 ) ]
1783
+ #[ cfg_attr( all( test, target_arch = "aarch64" ) , assert_instr( nop, IMM5 = 0 ) ) ]
1784
+ pub unsafe fn vgetq_lane_f64 < const IMM5 : i32 > ( v : float64x2_t ) -> f64 {
1785
+ static_assert_imm1 ! ( IMM5 ) ;
1786
+ simd_extract ( v, IMM5 as u32 )
1787
+ }
1788
+
1769
1789
/* FIXME: 16-bit float
1770
1790
/// Vector combine
1771
1791
#[inline]
@@ -3864,6 +3884,22 @@ mod tests {
3864
3884
assert_eq ! ( r, e) ;
3865
3885
}
3866
3886
3887
+ #[ simd_test( enable = "neon" ) ]
3888
+ unsafe fn test_vget_lane_f64 ( ) {
3889
+ let v = f64x1:: new ( 1.0 ) ;
3890
+ let r = vget_lane_f64 :: < 0 > ( transmute ( v) ) ;
3891
+ assert_eq ! ( r, 1.0 ) ;
3892
+ }
3893
+
3894
+ #[ simd_test( enable = "neon" ) ]
3895
+ unsafe fn test_vgetq_lane_f64 ( ) {
3896
+ let v = f64x2:: new ( 0.0 , 1.0 ) ;
3897
+ let r = vgetq_lane_f64 :: < 1 > ( transmute ( v) ) ;
3898
+ assert_eq ! ( r, 1.0 ) ;
3899
+ let r = vgetq_lane_f64 :: < 0 > ( transmute ( v) ) ;
3900
+ assert_eq ! ( r, 0.0 ) ;
3901
+ }
3902
+
3867
3903
#[ simd_test( enable = "neon" ) ]
3868
3904
unsafe fn test_vcopy_lane_s64 ( ) {
3869
3905
let a: i64x1 = i64x1:: new ( 1 ) ;
0 commit comments