@@ -6921,6 +6921,102 @@ pub unsafe fn vabal_s32(a: int64x2_t, b: int32x2_t, c: int32x2_t) -> int64x2_t {
69216921 simd_add ( a, simd_cast ( e) )
69226922}
69236923
6924+ /// Singned saturating Absolute value
6925+ #[ inline]
6926+ #[ target_feature( enable = "neon" ) ]
6927+ #[ cfg_attr( target_arch = "arm" , target_feature( enable = "v7" ) ) ]
6928+ #[ cfg_attr( all( test, target_arch = "arm" ) , assert_instr( "vqabs.s8" ) ) ]
6929+ #[ cfg_attr( all( test, target_arch = "aarch64" ) , assert_instr( sqabs) ) ]
6930+ pub unsafe fn vqabs_s8 ( a : int8x8_t ) -> int8x8_t {
6931+ #[ allow( improper_ctypes) ]
6932+ extern "C" {
6933+ #[ cfg_attr( target_arch = "arm" , link_name = "llvm.arm.neon.vqabs.v8i8" ) ]
6934+ #[ cfg_attr( target_arch = "aarch64" , link_name = "llvm.aarch64.neon.sqabs.v8i8" ) ]
6935+ fn vqabs_s8_ ( a : int8x8_t ) -> int8x8_t ;
6936+ }
6937+ vqabs_s8_ ( a)
6938+ }
6939+
6940+ /// Singned saturating Absolute value
6941+ #[ inline]
6942+ #[ target_feature( enable = "neon" ) ]
6943+ #[ cfg_attr( target_arch = "arm" , target_feature( enable = "v7" ) ) ]
6944+ #[ cfg_attr( all( test, target_arch = "arm" ) , assert_instr( "vqabs.s8" ) ) ]
6945+ #[ cfg_attr( all( test, target_arch = "aarch64" ) , assert_instr( sqabs) ) ]
6946+ pub unsafe fn vqabsq_s8 ( a : int8x16_t ) -> int8x16_t {
6947+ #[ allow( improper_ctypes) ]
6948+ extern "C" {
6949+ #[ cfg_attr( target_arch = "arm" , link_name = "llvm.arm.neon.vqabs.v16i8" ) ]
6950+ #[ cfg_attr( target_arch = "aarch64" , link_name = "llvm.aarch64.neon.sqabs.v16i8" ) ]
6951+ fn vqabsq_s8_ ( a : int8x16_t ) -> int8x16_t ;
6952+ }
6953+ vqabsq_s8_ ( a)
6954+ }
6955+
6956+ /// Singned saturating Absolute value
6957+ #[ inline]
6958+ #[ target_feature( enable = "neon" ) ]
6959+ #[ cfg_attr( target_arch = "arm" , target_feature( enable = "v7" ) ) ]
6960+ #[ cfg_attr( all( test, target_arch = "arm" ) , assert_instr( "vqabs.s16" ) ) ]
6961+ #[ cfg_attr( all( test, target_arch = "aarch64" ) , assert_instr( sqabs) ) ]
6962+ pub unsafe fn vqabs_s16 ( a : int16x4_t ) -> int16x4_t {
6963+ #[ allow( improper_ctypes) ]
6964+ extern "C" {
6965+ #[ cfg_attr( target_arch = "arm" , link_name = "llvm.arm.neon.vqabs.v4i16" ) ]
6966+ #[ cfg_attr( target_arch = "aarch64" , link_name = "llvm.aarch64.neon.sqabs.v4i16" ) ]
6967+ fn vqabs_s16_ ( a : int16x4_t ) -> int16x4_t ;
6968+ }
6969+ vqabs_s16_ ( a)
6970+ }
6971+
6972+ /// Singned saturating Absolute value
6973+ #[ inline]
6974+ #[ target_feature( enable = "neon" ) ]
6975+ #[ cfg_attr( target_arch = "arm" , target_feature( enable = "v7" ) ) ]
6976+ #[ cfg_attr( all( test, target_arch = "arm" ) , assert_instr( "vqabs.s16" ) ) ]
6977+ #[ cfg_attr( all( test, target_arch = "aarch64" ) , assert_instr( sqabs) ) ]
6978+ pub unsafe fn vqabsq_s16 ( a : int16x8_t ) -> int16x8_t {
6979+ #[ allow( improper_ctypes) ]
6980+ extern "C" {
6981+ #[ cfg_attr( target_arch = "arm" , link_name = "llvm.arm.neon.vqabs.v8i16" ) ]
6982+ #[ cfg_attr( target_arch = "aarch64" , link_name = "llvm.aarch64.neon.sqabs.v8i16" ) ]
6983+ fn vqabsq_s16_ ( a : int16x8_t ) -> int16x8_t ;
6984+ }
6985+ vqabsq_s16_ ( a)
6986+ }
6987+
6988+ /// Singned saturating Absolute value
6989+ #[ inline]
6990+ #[ target_feature( enable = "neon" ) ]
6991+ #[ cfg_attr( target_arch = "arm" , target_feature( enable = "v7" ) ) ]
6992+ #[ cfg_attr( all( test, target_arch = "arm" ) , assert_instr( "vqabs.s32" ) ) ]
6993+ #[ cfg_attr( all( test, target_arch = "aarch64" ) , assert_instr( sqabs) ) ]
6994+ pub unsafe fn vqabs_s32 ( a : int32x2_t ) -> int32x2_t {
6995+ #[ allow( improper_ctypes) ]
6996+ extern "C" {
6997+ #[ cfg_attr( target_arch = "arm" , link_name = "llvm.arm.neon.vqabs.v2i32" ) ]
6998+ #[ cfg_attr( target_arch = "aarch64" , link_name = "llvm.aarch64.neon.sqabs.v2i32" ) ]
6999+ fn vqabs_s32_ ( a : int32x2_t ) -> int32x2_t ;
7000+ }
7001+ vqabs_s32_ ( a)
7002+ }
7003+
7004+ /// Singned saturating Absolute value
7005+ #[ inline]
7006+ #[ target_feature( enable = "neon" ) ]
7007+ #[ cfg_attr( target_arch = "arm" , target_feature( enable = "v7" ) ) ]
7008+ #[ cfg_attr( all( test, target_arch = "arm" ) , assert_instr( "vqabs.s32" ) ) ]
7009+ #[ cfg_attr( all( test, target_arch = "aarch64" ) , assert_instr( sqabs) ) ]
7010+ pub unsafe fn vqabsq_s32 ( a : int32x4_t ) -> int32x4_t {
7011+ #[ allow( improper_ctypes) ]
7012+ extern "C" {
7013+ #[ cfg_attr( target_arch = "arm" , link_name = "llvm.arm.neon.vqabs.v4i32" ) ]
7014+ #[ cfg_attr( target_arch = "aarch64" , link_name = "llvm.aarch64.neon.sqabs.v4i32" ) ]
7015+ fn vqabsq_s32_ ( a : int32x4_t ) -> int32x4_t ;
7016+ }
7017+ vqabsq_s32_ ( a)
7018+ }
7019+
69247020#[ cfg( test) ]
69257021#[ allow( overflowing_literals) ]
69267022mod test {
@@ -12337,4 +12433,52 @@ mod test {
1233712433 let r: i64x2 = transmute ( vabal_s32 ( transmute ( a) , transmute ( b) , transmute ( c) ) ) ;
1233812434 assert_eq ! ( r, e) ;
1233912435 }
12436+
12437+ #[ simd_test( enable = "neon" ) ]
12438+ unsafe fn test_vqabs_s8 ( ) {
12439+ let a: i8x8 = i8x8:: new ( -128 , 0x7F , -6 , -5 , -4 , -3 , -2 , -1 ) ;
12440+ let e: i8x8 = i8x8:: new ( 0x7F , 0x7F , 6 , 5 , 4 , 3 , 2 , 1 ) ;
12441+ let r: i8x8 = transmute ( vqabs_s8 ( transmute ( a) ) ) ;
12442+ assert_eq ! ( r, e) ;
12443+ }
12444+
12445+ #[ simd_test( enable = "neon" ) ]
12446+ unsafe fn test_vqabsq_s8 ( ) {
12447+ let a: i8x16 = i8x16:: new ( -128 , 0x7F , -6 , -5 , -4 , -3 , -2 , -1 , 0 , -127 , 127 , 1 , 2 , 3 , 4 , 5 ) ;
12448+ let e: i8x16 = i8x16:: new ( 0x7F , 0x7F , 6 , 5 , 4 , 3 , 2 , 1 , 0 , 127 , 127 , 1 , 2 , 3 , 4 , 5 ) ;
12449+ let r: i8x16 = transmute ( vqabsq_s8 ( transmute ( a) ) ) ;
12450+ assert_eq ! ( r, e) ;
12451+ }
12452+
12453+ #[ simd_test( enable = "neon" ) ]
12454+ unsafe fn test_vqabs_s16 ( ) {
12455+ let a: i16x4 = i16x4:: new ( -32768 , 0x7F_FF , -6 , -5 ) ;
12456+ let e: i16x4 = i16x4:: new ( 0x7F_FF , 0x7F_FF , 6 , 5 ) ;
12457+ let r: i16x4 = transmute ( vqabs_s16 ( transmute ( a) ) ) ;
12458+ assert_eq ! ( r, e) ;
12459+ }
12460+
12461+ #[ simd_test( enable = "neon" ) ]
12462+ unsafe fn test_vqabsq_s16 ( ) {
12463+ let a: i16x8 = i16x8:: new ( -32768 , 0x7F_FF , -6 , -5 , -4 , -3 , -2 , -1 ) ;
12464+ let e: i16x8 = i16x8:: new ( 0x7F_FF , 0x7F_FF , 6 , 5 , 4 , 3 , 2 , 1 ) ;
12465+ let r: i16x8 = transmute ( vqabsq_s16 ( transmute ( a) ) ) ;
12466+ assert_eq ! ( r, e) ;
12467+ }
12468+
12469+ #[ simd_test( enable = "neon" ) ]
12470+ unsafe fn test_vqabs_s32 ( ) {
12471+ let a: i32x2 = i32x2:: new ( -2147483648 , 0x7F_FF_FF_FF ) ;
12472+ let e: i32x2 = i32x2:: new ( 0x7F_FF_FF_FF , 0x7F_FF_FF_FF ) ;
12473+ let r: i32x2 = transmute ( vqabs_s32 ( transmute ( a) ) ) ;
12474+ assert_eq ! ( r, e) ;
12475+ }
12476+
12477+ #[ simd_test( enable = "neon" ) ]
12478+ unsafe fn test_vqabsq_s32 ( ) {
12479+ let a: i32x4 = i32x4:: new ( -2147483648 , 0x7F_FF_FF_FF , -6 , -5 ) ;
12480+ let e: i32x4 = i32x4:: new ( 0x7F_FF_FF_FF , 0x7F_FF_FF_FF , 6 , 5 ) ;
12481+ let r: i32x4 = transmute ( vqabsq_s32 ( transmute ( a) ) ) ;
12482+ assert_eq ! ( r, e) ;
12483+ }
1234012484}
0 commit comments