@@ -18,6 +18,23 @@ pub fn _mm256_add_ps(a: f32x8, b: f32x8) -> f32x8 {
18
18
a + b
19
19
}
20
20
21
+ /// Add packed double-precision (64-bit) floating-point elements
22
+ /// in `a` and `b`.
23
+ #[ inline( always) ]
24
+ #[ target_feature = "+avx" ]
25
+ #[ cfg_attr( test, assert_instr( vmulpd) ) ]
26
+ pub fn _mm256_mul_pd ( a : f64x4 , b : f64x4 ) -> f64x4 {
27
+ a * b
28
+ }
29
+
30
+ /// Add packed single-precision (32-bit) floating-point elements in `a` and `b`.
31
+ #[ inline( always) ]
32
+ #[ target_feature = "+avx" ]
33
+ #[ cfg_attr( test, assert_instr( vmulps) ) ]
34
+ pub fn _mm256_mul_ps ( a : f32x8 , b : f32x8 ) -> f32x8 {
35
+ a * b
36
+ }
37
+
21
38
/// Alternatively add and subtract packed double-precision (64-bit)
22
39
/// floating-point elements in `a` to/from packed elements in `b`.
23
40
#[ inline( always) ]
@@ -122,6 +139,24 @@ mod tests {
122
139
assert_eq ! ( r, e) ;
123
140
}
124
141
142
+ #[ simd_test = "avx" ]
143
+ fn _mm256_mul_pd ( ) {
144
+ let a = f64x4:: new ( 1.0 , 2.0 , 3.0 , 4.0 ) ;
145
+ let b = f64x4:: new ( 5.0 , 6.0 , 7.0 , 8.0 ) ;
146
+ let r = avx:: _mm256_mul_pd ( a, b) ;
147
+ let e = f64x4:: new ( 5.0 , 12.0 , 21.0 , 32.0 ) ;
148
+ assert_eq ! ( r, e) ;
149
+ }
150
+
151
+ #[ simd_test = "avx" ]
152
+ fn _mm256_mul_ps ( ) {
153
+ let a = f32x8:: new ( 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ) ;
154
+ let b = f32x8:: new ( 9.0 , 10.0 , 11.0 , 12.0 , 13.0 , 14.0 , 15.0 , 16.0 ) ;
155
+ let r = avx:: _mm256_mul_ps ( a, b) ;
156
+ let e = f32x8:: new ( 9.0 , 20.0 , 33.0 , 48.0 , 65.0 , 84.0 , 105.0 , 128.0 ) ;
157
+ assert_eq ! ( r, e) ;
158
+ }
159
+
125
160
#[ simd_test = "avx" ]
126
161
fn _mm256_addsub_pd ( ) {
127
162
let a = f64x4:: new ( 1.0 , 2.0 , 3.0 , 4.0 ) ;
0 commit comments