1010
1111use crate :: core_arch:: powerpc:: * ;
1212use crate :: core_arch:: simd:: * ;
13- use crate :: intrinsics:: simd:: { simd_add, simd_sub} ;
13+ use crate :: intrinsics:: simd:: { simd_add, simd_mul , simd_sub} ;
1414
1515#[ cfg( test) ]
1616use stdarch_test:: assert_instr;
@@ -192,6 +192,16 @@ mod sealed {
192192 ) -> vector_double {
193193 simd_sub ( a, b)
194194 }
195+
196+ #[ inline]
197+ #[ target_feature( enable = "vsx" ) ]
198+ #[ cfg_attr( test, assert_instr( xvmuldp) ) ]
199+ pub ( crate ) unsafe fn vec_mul_double_double (
200+ a : vector_double ,
201+ b : vector_double ,
202+ ) -> vector_double {
203+ simd_mul ( a, b)
204+ }
195205}
196206
197207// Implement AltiVec's VectorAdd trait for vector_double to enable vec_add support
@@ -216,6 +226,16 @@ impl crate::core_arch::powerpc::altivec::sealed::VectorSub<vector_double> for ve
216226 }
217227}
218228
229+ // Implement AltiVec's VectorMul trait for vector_double to enable vec_mul support.
230+ #[ unstable( feature = "stdarch_powerpc" , issue = "111145" ) ]
231+ impl crate :: core_arch:: powerpc:: altivec:: sealed:: VectorMul for vector_double {
232+ #[ inline]
233+ #[ target_feature( enable = "vsx" ) ]
234+ unsafe fn vec_mul ( self , b : Self ) -> Self {
235+ sealed:: vec_mul_double_double ( self , b)
236+ }
237+ }
238+
219239/// Vector permute.
220240#[ inline]
221241#[ target_feature( enable = "vsx" ) ]
@@ -319,4 +339,15 @@ mod tests {
319339 assert_eq ! ( f64x2:: from( vec_sub( a, b) ) , f64x2:: from( expected) ) ;
320340 }
321341 }
342+
343+ #[ simd_test( enable = "vsx" ) ]
344+ fn test_vec_mul_f64x2_f64x2 ( ) {
345+ let a = vector_double:: from ( f64x2:: from_array ( [ 2.0 , 3.0 ] ) ) ;
346+ let b = vector_double:: from ( f64x2:: from_array ( [ 4.0 , 5.0 ] ) ) ;
347+ let expected = vector_double:: from ( f64x2:: from_array ( [ 8.0 , 15.0 ] ) ) ;
348+
349+ unsafe {
350+ assert_eq ! ( f64x2:: from( vec_mul( a, b) ) , f64x2:: from( expected) ) ;
351+ }
352+ }
322353}
0 commit comments