@@ -1368,6 +1368,21 @@ pub unsafe fn vgetq_lane_u32(v: uint32x4_t, imm5: i32) -> u32 {
1368
1368
simd_extract ( v, imm5)
1369
1369
}
1370
1370
1371
+ /// Move vector element to general-purpose register
1372
+ #[ inline]
1373
+ #[ target_feature( enable = "neon" ) ]
1374
+ #[ cfg_attr( target_arch = "arm" , target_feature( enable = "v7" ) ) ]
1375
+ #[ rustc_args_required_const( 1 ) ]
1376
+ #[ cfg_attr( all( test, target_arch = "arm" ) , assert_instr( "vmov.32" , imm5 = 2 ) ) ]
1377
+ #[ cfg_attr( all( test, target_arch = "aarch64" ) , assert_instr( mov, imm5 = 2 ) ) ]
1378
+ pub unsafe fn vgetq_lane_s32 ( v : int32x4_t , imm5 : i32 ) -> i32 {
1379
+ if ( imm5) < 0 || ( imm5) > 3 {
1380
+ unreachable_unchecked ( )
1381
+ }
1382
+ let imm5 = ( imm5 & 0b11 ) as u32 ;
1383
+ simd_extract ( v, imm5)
1384
+ }
1385
+
1371
1386
/// Move vector element to general-purpose register
1372
1387
#[ inline]
1373
1388
#[ target_feature( enable = "neon" ) ]
@@ -1930,6 +1945,13 @@ mod tests {
1930
1945
assert_eq ! ( r, 2 ) ;
1931
1946
}
1932
1947
1948
+ #[ simd_test( enable = "neon" ) ]
1949
+ unsafe fn test_vgetq_lane_s32 ( ) {
1950
+ let v = i32x4:: new ( 1 , 2 , 3 , 4 ) ;
1951
+ let r = vgetq_lane_s32 ( transmute ( v) , 1 ) ;
1952
+ assert_eq ! ( r, 2 ) ;
1953
+ }
1954
+
1933
1955
#[ simd_test( enable = "neon" ) ]
1934
1956
unsafe fn test_vget_lane_u64 ( ) {
1935
1957
let v: u64 = 1 ;
0 commit comments