@@ -1031,6 +1031,38 @@ pub unsafe fn vmulq_f64(a: float64x2_t, b: float64x2_t) -> float64x2_t {
10311031 simd_mul ( a, b)
10321032}
10331033
1034+ /// Divide
1035+ #[ inline]
1036+ #[ target_feature( enable = "neon" ) ]
1037+ #[ cfg_attr( test, assert_instr( fdiv) ) ]
1038+ pub unsafe fn vdiv_f32 ( a : float32x2_t , b : float32x2_t ) -> float32x2_t {
1039+ simd_div ( a, b)
1040+ }
1041+
1042+ /// Divide
1043+ #[ inline]
1044+ #[ target_feature( enable = "neon" ) ]
1045+ #[ cfg_attr( test, assert_instr( fdiv) ) ]
1046+ pub unsafe fn vdivq_f32 ( a : float32x4_t , b : float32x4_t ) -> float32x4_t {
1047+ simd_div ( a, b)
1048+ }
1049+
1050+ /// Divide
1051+ #[ inline]
1052+ #[ target_feature( enable = "neon" ) ]
1053+ #[ cfg_attr( test, assert_instr( fdiv) ) ]
1054+ pub unsafe fn vdiv_f64 ( a : float64x1_t , b : float64x1_t ) -> float64x1_t {
1055+ simd_div ( a, b)
1056+ }
1057+
1058+ /// Divide
1059+ #[ inline]
1060+ #[ target_feature( enable = "neon" ) ]
1061+ #[ cfg_attr( test, assert_instr( fdiv) ) ]
1062+ pub unsafe fn vdivq_f64 ( a : float64x2_t , b : float64x2_t ) -> float64x2_t {
1063+ simd_div ( a, b)
1064+ }
1065+
10341066/// Subtract
10351067#[ inline]
10361068#[ target_feature( enable = "neon" ) ]
@@ -2112,6 +2144,42 @@ mod test {
21122144 assert_eq ! ( r, e) ;
21132145 }
21142146
2147+ #[ simd_test( enable = "neon" ) ]
2148+ unsafe fn test_vdiv_f32 ( ) {
2149+ let a: f32x2 = f32x2:: new ( 2.0 , 6.0 ) ;
2150+ let b: f32x2 = f32x2:: new ( 1.0 , 2.0 ) ;
2151+ let e: f32x2 = f32x2:: new ( 2.0 , 3.0 ) ;
2152+ let r: f32x2 = transmute ( vdiv_f32 ( transmute ( a) , transmute ( b) ) ) ;
2153+ assert_eq ! ( r, e) ;
2154+ }
2155+
2156+ #[ simd_test( enable = "neon" ) ]
2157+ unsafe fn test_vdivq_f32 ( ) {
2158+ let a: f32x4 = f32x4:: new ( 2.0 , 6.0 , 4.0 , 10.0 ) ;
2159+ let b: f32x4 = f32x4:: new ( 1.0 , 2.0 , 1.0 , 2.0 ) ;
2160+ let e: f32x4 = f32x4:: new ( 2.0 , 3.0 , 4.0 , 5.0 ) ;
2161+ let r: f32x4 = transmute ( vdivq_f32 ( transmute ( a) , transmute ( b) ) ) ;
2162+ assert_eq ! ( r, e) ;
2163+ }
2164+
2165+ #[ simd_test( enable = "neon" ) ]
2166+ unsafe fn test_vdiv_f64 ( ) {
2167+ let a: f64 = 2.0 ;
2168+ let b: f64 = 1.0 ;
2169+ let e: f64 = 2.0 ;
2170+ let r: f64 = transmute ( vdiv_f64 ( transmute ( a) , transmute ( b) ) ) ;
2171+ assert_eq ! ( r, e) ;
2172+ }
2173+
2174+ #[ simd_test( enable = "neon" ) ]
2175+ unsafe fn test_vdivq_f64 ( ) {
2176+ let a: f64x2 = f64x2:: new ( 2.0 , 6.0 ) ;
2177+ let b: f64x2 = f64x2:: new ( 1.0 , 2.0 ) ;
2178+ let e: f64x2 = f64x2:: new ( 2.0 , 3.0 ) ;
2179+ let r: f64x2 = transmute ( vdivq_f64 ( transmute ( a) , transmute ( b) ) ) ;
2180+ assert_eq ! ( r, e) ;
2181+ }
2182+
21152183 #[ simd_test( enable = "neon" ) ]
21162184 unsafe fn test_vsub_f64 ( ) {
21172185 let a: f64 = 1.0 ;
0 commit comments