@@ -217,6 +217,38 @@ unsafe extern "unadjusted" {
217
217
#[ link_name = "llvm.s390.vmlhh" ] fn vmlhh ( a : vector_unsigned_short , b : vector_unsigned_short ) -> vector_unsigned_short ;
218
218
#[ link_name = "llvm.s390.vmlhf" ] fn vmlhf ( a : vector_unsigned_int , b : vector_unsigned_int ) -> vector_unsigned_int ;
219
219
220
+ #[ link_name = "llvm.s390.vmaeb" ] fn vmaeb ( a : vector_signed_char , b : vector_signed_char , c : vector_signed_short ) -> vector_signed_short ;
221
+ #[ link_name = "llvm.s390.vmaeh" ] fn vmaeh ( a : vector_signed_short , b : vector_signed_short , c : vector_signed_int ) -> vector_signed_int ;
222
+ #[ link_name = "llvm.s390.vmaef" ] fn vmaef ( a : vector_signed_int , b : vector_signed_int , c : vector_signed_long_long ) -> vector_signed_long_long ;
223
+
224
+ #[ link_name = "llvm.s390.vmaleb" ] fn vmaleb ( a : vector_unsigned_char , b : vector_unsigned_char , c : vector_unsigned_short ) -> vector_unsigned_short ;
225
+ #[ link_name = "llvm.s390.vmaleh" ] fn vmaleh ( a : vector_unsigned_short , b : vector_unsigned_short , c : vector_unsigned_int ) -> vector_unsigned_int ;
226
+ #[ link_name = "llvm.s390.vmalef" ] fn vmalef ( a : vector_unsigned_int , b : vector_unsigned_int , c : vector_unsigned_long_long ) -> vector_unsigned_long_long ;
227
+
228
+ #[ link_name = "llvm.s390.vmaob" ] fn vmaob ( a : vector_signed_char , b : vector_signed_char , c : vector_signed_short ) -> vector_signed_short ;
229
+ #[ link_name = "llvm.s390.vmaoh" ] fn vmaoh ( a : vector_signed_short , b : vector_signed_short , c : vector_signed_int ) -> vector_signed_int ;
230
+ #[ link_name = "llvm.s390.vmaof" ] fn vmaof ( a : vector_signed_int , b : vector_signed_int , c : vector_signed_long_long ) -> vector_signed_long_long ;
231
+
232
+ #[ link_name = "llvm.s390.vmalob" ] fn vmalob ( a : vector_unsigned_char , b : vector_unsigned_char , c : vector_unsigned_short ) -> vector_unsigned_short ;
233
+ #[ link_name = "llvm.s390.vmaloh" ] fn vmaloh ( a : vector_unsigned_short , b : vector_unsigned_short , c : vector_unsigned_int ) -> vector_unsigned_int ;
234
+ #[ link_name = "llvm.s390.vmalof" ] fn vmalof ( a : vector_unsigned_int , b : vector_unsigned_int , c : vector_unsigned_long_long ) -> vector_unsigned_long_long ;
235
+
236
+ #[ link_name = "llvm.s390.vmahb" ] fn vmahb ( a : vector_signed_char , b : vector_signed_char , c : vector_signed_char ) -> vector_signed_char ;
237
+ #[ link_name = "llvm.s390.vmahh" ] fn vmahh ( a : vector_signed_short , b : vector_signed_short , c : vector_signed_short ) -> vector_signed_short ;
238
+ #[ link_name = "llvm.s390.vmahf" ] fn vmahf ( a : vector_signed_int , b : vector_signed_int , c : vector_signed_int ) -> vector_signed_int ;
239
+
240
+ #[ link_name = "llvm.s390.vmalhb" ] fn vmalhb ( a : vector_unsigned_char , b : vector_unsigned_char , c : vector_unsigned_char ) -> vector_unsigned_char ;
241
+ #[ link_name = "llvm.s390.vmalhh" ] fn vmalhh ( a : vector_unsigned_short , b : vector_unsigned_short , c : vector_unsigned_short ) -> vector_unsigned_short ;
242
+ #[ link_name = "llvm.s390.vmalhf" ] fn vmalhf ( a : vector_unsigned_int , b : vector_unsigned_int , c : vector_unsigned_int ) -> vector_unsigned_int ;
243
+
244
+ #[ link_name = "llvm.s390.vmalb" ] fn vmalb ( a : vector_signed_char , b : vector_signed_char , c : vector_signed_char ) -> vector_signed_char ;
245
+ #[ link_name = "llvm.s390.vmalh" ] fn vmalh ( a : vector_signed_short , b : vector_signed_short , c : vector_signed_short ) -> vector_signed_short ;
246
+ #[ link_name = "llvm.s390.vmalf" ] fn vmalf ( a : vector_signed_int , b : vector_signed_int , c : vector_signed_int ) -> vector_signed_int ;
247
+
248
+ #[ link_name = "llvm.s390.vmallb" ] fn vmallb ( a : vector_unsigned_char , b : vector_unsigned_char , c : vector_unsigned_char ) -> vector_unsigned_char ;
249
+ #[ link_name = "llvm.s390.vmallh" ] fn vmallh ( a : vector_unsigned_short , b : vector_unsigned_short , c : vector_unsigned_short ) -> vector_unsigned_short ;
250
+ #[ link_name = "llvm.s390.vmallf" ] fn vmallf ( a : vector_unsigned_int , b : vector_unsigned_int , c : vector_unsigned_int ) -> vector_unsigned_int ;
251
+
220
252
#[ link_name = "llvm.s390.vgfmb" ] fn vgfmb ( a : vector_unsigned_char , b : vector_unsigned_char ) -> vector_unsigned_short ;
221
253
#[ link_name = "llvm.s390.vgfmh" ] fn vgfmh ( a : vector_unsigned_short , b : vector_unsigned_short ) -> vector_unsigned_int ;
222
254
#[ link_name = "llvm.s390.vgfmf" ] fn vgfmf ( a : vector_unsigned_int , b : vector_unsigned_int ) -> vector_unsigned_long_long ;
@@ -2594,6 +2626,17 @@ mod sealed {
2594
2626
}
2595
2627
}
2596
2628
} ;
2629
+ ( [ $Trait: ident $m: ident] $fun: ident ( $a: ty, $b: ty, $c: ty) -> $r: ty) => {
2630
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2631
+ impl $Trait for $a {
2632
+ type Result = $r;
2633
+ #[ inline]
2634
+ #[ target_feature( enable = "vector" ) ]
2635
+ unsafe fn $m( self , b: $b, c: $c) -> $r {
2636
+ $fun( self , b, c)
2637
+ }
2638
+ }
2639
+ } ;
2597
2640
}
2598
2641
2599
2642
#[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
@@ -2678,6 +2721,100 @@ mod sealed {
2678
2721
impl_mul ! ( [ VectorMulh vec_mulh] vec_vmlhh ( vector_unsigned_short, vector_unsigned_short) -> vector_unsigned_short) ;
2679
2722
impl_mul ! ( [ VectorMulh vec_mulh] vec_vmlhf ( vector_unsigned_int, vector_unsigned_int) -> vector_unsigned_int) ;
2680
2723
2724
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2725
+ pub trait VectorMeadd {
2726
+ type Result ;
2727
+ unsafe fn vec_meadd ( self , b : Self , c : Self :: Result ) -> Self :: Result ;
2728
+ }
2729
+
2730
+ test_impl ! { vec_vmaeb( a: vector_signed_char, b: vector_signed_char, c: vector_signed_short) -> vector_signed_short [ vmaeb, vmaeb ] }
2731
+ test_impl ! { vec_vmaeh( a: vector_signed_short, b: vector_signed_short, c: vector_signed_int) -> vector_signed_int[ vmaeh, vmaeh ] }
2732
+ test_impl ! { vec_vmaef( a: vector_signed_int, b: vector_signed_int, c: vector_signed_long_long) -> vector_signed_long_long [ vmaef, vmaef ] }
2733
+
2734
+ test_impl ! { vec_vmaleb( a: vector_unsigned_char, b: vector_unsigned_char, c: vector_unsigned_short) -> vector_unsigned_short [ vmaleb, vmaleb ] }
2735
+ test_impl ! { vec_vmaleh( a: vector_unsigned_short, b: vector_unsigned_short, c: vector_unsigned_int) -> vector_unsigned_int[ vmaleh, vmaleh ] }
2736
+ test_impl ! { vec_vmalef( a: vector_unsigned_int, b: vector_unsigned_int, c: vector_unsigned_long_long) -> vector_unsigned_long_long [ vmalef, vmalef ] }
2737
+
2738
+ impl_mul ! ( [ VectorMeadd vec_meadd] vec_vmaeb ( vector_signed_char, vector_signed_char, vector_signed_short) -> vector_signed_short ) ;
2739
+ impl_mul ! ( [ VectorMeadd vec_meadd] vec_vmaeh ( vector_signed_short, vector_signed_short, vector_signed_int) -> vector_signed_int) ;
2740
+ impl_mul ! ( [ VectorMeadd vec_meadd] vec_vmaef ( vector_signed_int, vector_signed_int, vector_signed_long_long) -> vector_signed_long_long ) ;
2741
+
2742
+ impl_mul ! ( [ VectorMeadd vec_meadd] vec_vmaleb ( vector_unsigned_char, vector_unsigned_char, vector_unsigned_short) -> vector_unsigned_short ) ;
2743
+ impl_mul ! ( [ VectorMeadd vec_meadd] vec_vmaleh ( vector_unsigned_short, vector_unsigned_short, vector_unsigned_int) -> vector_unsigned_int) ;
2744
+ impl_mul ! ( [ VectorMeadd vec_meadd] vec_vmalef ( vector_unsigned_int, vector_unsigned_int, vector_unsigned_long_long) -> vector_unsigned_long_long ) ;
2745
+
2746
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2747
+ pub trait VectorMoadd {
2748
+ type Result ;
2749
+ unsafe fn vec_moadd ( self , b : Self , c : Self :: Result ) -> Self :: Result ;
2750
+ }
2751
+
2752
+ test_impl ! { vec_vmaob( a: vector_signed_char, b: vector_signed_char, c: vector_signed_short) -> vector_signed_short [ vmaob, vmaob ] }
2753
+ test_impl ! { vec_vmaoh( a: vector_signed_short, b: vector_signed_short, c: vector_signed_int) -> vector_signed_int[ vmaoh, vmaoh ] }
2754
+ test_impl ! { vec_vmaof( a: vector_signed_int, b: vector_signed_int, c: vector_signed_long_long) -> vector_signed_long_long [ vmaof, vmaof ] }
2755
+
2756
+ test_impl ! { vec_vmalob( a: vector_unsigned_char, b: vector_unsigned_char, c: vector_unsigned_short) -> vector_unsigned_short [ vmalob, vmalob ] }
2757
+ test_impl ! { vec_vmaloh( a: vector_unsigned_short, b: vector_unsigned_short, c: vector_unsigned_int) -> vector_unsigned_int[ vmaloh, vmaloh ] }
2758
+ test_impl ! { vec_vmalof( a: vector_unsigned_int, b: vector_unsigned_int, c: vector_unsigned_long_long) -> vector_unsigned_long_long [ vmalof, vmalof ] }
2759
+
2760
+ impl_mul ! ( [ VectorMoadd vec_moadd] vec_vmaob ( vector_signed_char, vector_signed_char, vector_signed_short) -> vector_signed_short ) ;
2761
+ impl_mul ! ( [ VectorMoadd vec_moadd] vec_vmaoh ( vector_signed_short, vector_signed_short, vector_signed_int) -> vector_signed_int) ;
2762
+ impl_mul ! ( [ VectorMoadd vec_moadd] vec_vmaof ( vector_signed_int, vector_signed_int, vector_signed_long_long) -> vector_signed_long_long ) ;
2763
+
2764
+ impl_mul ! ( [ VectorMoadd vec_moadd] vec_vmalob ( vector_unsigned_char, vector_unsigned_char, vector_unsigned_short) -> vector_unsigned_short ) ;
2765
+ impl_mul ! ( [ VectorMoadd vec_moadd] vec_vmaloh ( vector_unsigned_short, vector_unsigned_short, vector_unsigned_int) -> vector_unsigned_int) ;
2766
+ impl_mul ! ( [ VectorMoadd vec_moadd] vec_vmalof ( vector_unsigned_int, vector_unsigned_int, vector_unsigned_long_long) -> vector_unsigned_long_long ) ;
2767
+
2768
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2769
+ pub trait VectorMhadd {
2770
+ type Result ;
2771
+ unsafe fn vec_mhadd ( self , b : Self , c : Self :: Result ) -> Self :: Result ;
2772
+ }
2773
+
2774
+ test_impl ! { vec_vmahb( a: vector_signed_char, b: vector_signed_char, c: vector_signed_char) -> vector_signed_char [ vmahb, vmahb ] }
2775
+ test_impl ! { vec_vmahh( a: vector_signed_short, b: vector_signed_short, c: vector_signed_short) -> vector_signed_short[ vmahh, vmahh ] }
2776
+ test_impl ! { vec_vmahf( a: vector_signed_int, b: vector_signed_int, c: vector_signed_int) -> vector_signed_int [ vmahf, vmahf ] }
2777
+
2778
+ test_impl ! { vec_vmalhb( a: vector_unsigned_char, b: vector_unsigned_char, c: vector_unsigned_char) -> vector_unsigned_char [ vmalhb, vmalhb ] }
2779
+ test_impl ! { vec_vmalhh( a: vector_unsigned_short, b: vector_unsigned_short, c: vector_unsigned_short) -> vector_unsigned_short[ vmalhh, vmalhh ] }
2780
+ test_impl ! { vec_vmalhf( a: vector_unsigned_int, b: vector_unsigned_int, c: vector_unsigned_int) -> vector_unsigned_int [ vmalhf, vmalhf ] }
2781
+
2782
+ impl_mul ! ( [ VectorMhadd vec_mhadd] vec_vmahb ( vector_signed_char, vector_signed_char, vector_signed_char) -> vector_signed_char ) ;
2783
+ impl_mul ! ( [ VectorMhadd vec_mhadd] vec_vmahh ( vector_signed_short, vector_signed_short, vector_signed_short) -> vector_signed_short) ;
2784
+ impl_mul ! ( [ VectorMhadd vec_mhadd] vec_vmahf ( vector_signed_int, vector_signed_int, vector_signed_int) -> vector_signed_int ) ;
2785
+
2786
+ impl_mul ! ( [ VectorMhadd vec_mhadd] vec_vmalhb ( vector_unsigned_char, vector_unsigned_char, vector_unsigned_char) -> vector_unsigned_char ) ;
2787
+ impl_mul ! ( [ VectorMhadd vec_mhadd] vec_vmalhh ( vector_unsigned_short, vector_unsigned_short, vector_unsigned_short) -> vector_unsigned_short) ;
2788
+ impl_mul ! ( [ VectorMhadd vec_mhadd] vec_vmalhf ( vector_unsigned_int, vector_unsigned_int, vector_unsigned_int) -> vector_unsigned_int ) ;
2789
+
2790
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2791
+ pub trait VectorMladd {
2792
+ type Result ;
2793
+ unsafe fn vec_mladd ( self , b : Self , c : Self :: Result ) -> Self :: Result ;
2794
+ }
2795
+
2796
+ #[ inline]
2797
+ #[ target_feature( enable = "vector" ) ]
2798
+ unsafe fn simd_mladd < T > ( a : T , b : T , c : T ) -> T {
2799
+ simd_add ( simd_mul ( a, b) , c)
2800
+ }
2801
+
2802
+ test_impl ! { vec_vmal_ib( a: vector_signed_char, b: vector_signed_char, c: vector_signed_char) -> vector_signed_char [ simd_mladd, vmalb ] }
2803
+ test_impl ! { vec_vmal_ih( a: vector_signed_short, b: vector_signed_short, c: vector_signed_short) -> vector_signed_short[ simd_mladd, vmalh ] }
2804
+ test_impl ! { vec_vmal_if( a: vector_signed_int, b: vector_signed_int, c: vector_signed_int) -> vector_signed_int [ simd_mladd, vmalf ] }
2805
+
2806
+ test_impl ! { vec_vmal_ub( a: vector_unsigned_char, b: vector_unsigned_char, c: vector_unsigned_char) -> vector_unsigned_char [ simd_mladd, vmalb ] }
2807
+ test_impl ! { vec_vmal_uh( a: vector_unsigned_short, b: vector_unsigned_short, c: vector_unsigned_short) -> vector_unsigned_short[ simd_mladd, vmalh ] }
2808
+ test_impl ! { vec_vmal_uf( a: vector_unsigned_int, b: vector_unsigned_int, c: vector_unsigned_int) -> vector_unsigned_int [ simd_mladd, vmalf ] }
2809
+
2810
+ impl_mul ! ( [ VectorMladd vec_mladd] vec_vmal_ib ( vector_signed_char, vector_signed_char, vector_signed_char) -> vector_signed_char ) ;
2811
+ impl_mul ! ( [ VectorMladd vec_mladd] vec_vmal_ih ( vector_signed_short, vector_signed_short, vector_signed_short) -> vector_signed_short) ;
2812
+ impl_mul ! ( [ VectorMladd vec_mladd] vec_vmal_if ( vector_signed_int, vector_signed_int, vector_signed_int) -> vector_signed_int ) ;
2813
+
2814
+ impl_mul ! ( [ VectorMladd vec_mladd] vec_vmal_ub ( vector_unsigned_char, vector_unsigned_char, vector_unsigned_char) -> vector_unsigned_char ) ;
2815
+ impl_mul ! ( [ VectorMladd vec_mladd] vec_vmal_uh ( vector_unsigned_short, vector_unsigned_short, vector_unsigned_short) -> vector_unsigned_short) ;
2816
+ impl_mul ! ( [ VectorMladd vec_mladd] vec_vmal_uf ( vector_unsigned_int, vector_unsigned_int, vector_unsigned_int) -> vector_unsigned_int ) ;
2817
+
2681
2818
#[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
2682
2819
pub trait VectorGfmsum < Result > {
2683
2820
unsafe fn vec_gfmsum ( self , b : Self ) -> Result ;
@@ -4769,6 +4906,38 @@ pub unsafe fn vec_msub<T: sealed::VectorMadd>(a: T, b: T, c: T) -> T {
4769
4906
a. vec_msub ( b, c)
4770
4907
}
4771
4908
4909
+ /// Vector Multiply and Add Even
4910
+ #[ inline]
4911
+ #[ target_feature( enable = "vector-packed-decimal" ) ]
4912
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4913
+ pub unsafe fn vec_meadd < T : sealed:: VectorMeadd > ( a : T , b : T , c : T :: Result ) -> T :: Result {
4914
+ a. vec_meadd ( b, c)
4915
+ }
4916
+
4917
+ /// Vector Multiply and Add Odd
4918
+ #[ inline]
4919
+ #[ target_feature( enable = "vector-packed-decimal" ) ]
4920
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4921
+ pub unsafe fn vec_moadd < T : sealed:: VectorMoadd > ( a : T , b : T , c : T :: Result ) -> T :: Result {
4922
+ a. vec_moadd ( b, c)
4923
+ }
4924
+
4925
+ /// Vector Multiply and Add High
4926
+ #[ inline]
4927
+ #[ target_feature( enable = "vector-packed-decimal" ) ]
4928
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4929
+ pub unsafe fn vec_mhadd < T : sealed:: VectorMhadd > ( a : T , b : T , c : T :: Result ) -> T :: Result {
4930
+ a. vec_mhadd ( b, c)
4931
+ }
4932
+
4933
+ /// Vector Multiply and Add Low
4934
+ #[ inline]
4935
+ #[ target_feature( enable = "vector-packed-decimal" ) ]
4936
+ #[ unstable( feature = "stdarch_s390x" , issue = "135681" ) ]
4937
+ pub unsafe fn vec_mladd < T : sealed:: VectorMladd > ( a : T , b : T , c : T :: Result ) -> T :: Result {
4938
+ a. vec_mladd ( b, c)
4939
+ }
4940
+
4772
4941
/// Vector Checksum
4773
4942
#[ inline]
4774
4943
#[ target_feature( enable = "vector" ) ]
@@ -7032,4 +7201,72 @@ mod tests {
7032
7201
[ 1.0 , f32 :: NAN , 5.0 , 3.14 ] ,
7033
7202
[ 0 , !0 , !0 , !0 ]
7034
7203
}
7204
+
7205
+ #[ simd_test( enable = "vector" ) ]
7206
+ fn test_vec_meadd ( ) {
7207
+ let a = vector_unsigned_short ( [ 1 , 0 , 2 , 0 , 3 , 0 , 4 , 0 ] ) ;
7208
+ let b = vector_unsigned_short ( [ 5 , 0 , 6 , 0 , 7 , 0 , 8 , 0 ] ) ;
7209
+ let c = vector_unsigned_int ( [ 2 , 2 , 2 , 2 ] ) ;
7210
+
7211
+ let d = unsafe { vec_meadd ( a, b, c) } ;
7212
+ assert_eq ! ( d. as_array( ) , & [ 7 , 14 , 23 , 34 ] ) ;
7213
+
7214
+ let a = vector_signed_short ( [ 1 , 0 , 2 , 0 , 3 , 0 , 4 , 0 ] ) ;
7215
+ let b = vector_signed_short ( [ 5 , 0 , 6 , 0 , 7 , 0 , 8 , 0 ] ) ;
7216
+ let c = vector_signed_int ( [ 2 , -2 , 2 , -2 ] ) ;
7217
+
7218
+ let d = unsafe { vec_meadd ( a, b, c) } ;
7219
+ assert_eq ! ( d. as_array( ) , & [ 7 , 10 , 23 , 30 ] ) ;
7220
+ }
7221
+
7222
+ #[ simd_test( enable = "vector" ) ]
7223
+ fn test_vec_moadd ( ) {
7224
+ let a = vector_unsigned_short ( [ 0 , 1 , 0 , 2 , 0 , 3 , 0 , 4 ] ) ;
7225
+ let b = vector_unsigned_short ( [ 0 , 5 , 0 , 6 , 0 , 7 , 0 , 8 ] ) ;
7226
+ let c = vector_unsigned_int ( [ 2 , 2 , 2 , 2 ] ) ;
7227
+
7228
+ let d = unsafe { vec_moadd ( a, b, c) } ;
7229
+ assert_eq ! ( d. as_array( ) , & [ 7 , 14 , 23 , 34 ] ) ;
7230
+
7231
+ let a = vector_signed_short ( [ 0 , 1 , 0 , 2 , 0 , 3 , 0 , 4 ] ) ;
7232
+ let b = vector_signed_short ( [ 0 , 5 , 0 , 6 , 0 , 7 , 0 , 8 ] ) ;
7233
+ let c = vector_signed_int ( [ 2 , -2 , 2 , -2 ] ) ;
7234
+
7235
+ let d = unsafe { vec_moadd ( a, b, c) } ;
7236
+ assert_eq ! ( d. as_array( ) , & [ 7 , 10 , 23 , 30 ] ) ;
7237
+ }
7238
+
7239
+ #[ simd_test( enable = "vector" ) ]
7240
+ fn test_vec_mhadd ( ) {
7241
+ let a = vector_unsigned_int ( [ 1 , 2 , 3 , 4 ] ) ;
7242
+ let b = vector_unsigned_int ( [ 5 , 6 , 7 , 8 ] ) ;
7243
+ let c = vector_unsigned_int ( [ u32:: MAX ; 4 ] ) ;
7244
+
7245
+ let d = unsafe { vec_mhadd ( a, b, c) } ;
7246
+ assert_eq ! ( d. as_array( ) , & [ 1 , 1 , 1 , 1 ] ) ;
7247
+
7248
+ let a = vector_signed_int ( [ -1 , -2 , -3 , -4 ] ) ;
7249
+ let b = vector_signed_int ( [ 5 , 6 , 7 , 8 ] ) ;
7250
+ let c = vector_signed_int ( [ i32:: MIN ; 4 ] ) ;
7251
+
7252
+ let d = unsafe { vec_mhadd ( a, b, c) } ;
7253
+ assert_eq ! ( d. as_array( ) , & [ -1 , -1 , -1 , -1 ] ) ;
7254
+ }
7255
+
7256
+ #[ simd_test( enable = "vector" ) ]
7257
+ fn test_vec_mladd ( ) {
7258
+ let a = vector_unsigned_int ( [ 1 , 2 , 3 , 4 ] ) ;
7259
+ let b = vector_unsigned_int ( [ 5 , 6 , 7 , 8 ] ) ;
7260
+ let c = vector_unsigned_int ( [ 2 , 2 , 2 , 2 ] ) ;
7261
+
7262
+ let d = unsafe { vec_mladd ( a, b, c) } ;
7263
+ assert_eq ! ( d. as_array( ) , & [ 7 , 14 , 23 , 34 ] ) ;
7264
+
7265
+ let a = vector_signed_int ( [ -1 , -2 , -3 , -4 ] ) ;
7266
+ let b = vector_signed_int ( [ 5 , 6 , 7 , 8 ] ) ;
7267
+ let c = vector_signed_int ( [ 2 , 2 , 2 , 2 ] ) ;
7268
+
7269
+ let d = unsafe { vec_mladd ( a, b, c) } ;
7270
+ assert_eq ! ( d. as_array( ) , & [ -3 , -10 , -19 , -30 ] ) ;
7271
+ }
7035
7272
}
0 commit comments