@@ -87,13 +87,67 @@ pub unsafe fn _mm512_setr_epi32(
87
87
transmute ( r)
88
88
}
89
89
90
+ /// Sets packed 32-bit integers in `dst` with the supplied values.
91
+ #[ inline]
92
+ #[ target_feature( enable = "avx512f" ) ]
93
+ pub unsafe fn _mm512_set_epi32 (
94
+ e15 : i32 ,
95
+ e14 : i32 ,
96
+ e13 : i32 ,
97
+ e12 : i32 ,
98
+ e11 : i32 ,
99
+ e10 : i32 ,
100
+ e9 : i32 ,
101
+ e8 : i32 ,
102
+ e7 : i32 ,
103
+ e6 : i32 ,
104
+ e5 : i32 ,
105
+ e4 : i32 ,
106
+ e3 : i32 ,
107
+ e2 : i32 ,
108
+ e1 : i32 ,
109
+ e0 : i32 ,
110
+ ) -> __m512i {
111
+ _mm512_setr_epi32 (
112
+ e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15,
113
+ )
114
+ }
115
+
116
+ /// Broadcast 32-bit integer `a` to all elements of `dst`.
117
+ #[ inline]
118
+ #[ target_feature( enable = "avx512f" ) ]
119
+ pub unsafe fn _mm512_set1_epi32 ( a : i32 ) -> __m512i {
120
+ transmute ( i32x16:: splat ( a) )
121
+ }
122
+
90
123
/// Broadcast 64-bit integer `a` to all elements of `dst`.
91
124
#[ inline]
92
125
#[ target_feature( enable = "avx512f" ) ]
93
126
pub unsafe fn _mm512_set1_epi64 ( a : i64 ) -> __m512i {
94
127
transmute ( i64x8:: splat ( a) )
95
128
}
96
129
130
+ /// Compare packed unsigned 32-bit integers in a and b for less-than, and store the results in a mask vector.
131
+ ///
132
+ /// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=727,1063,4909,1062,1062&text=_mm512_cmplt_epu32)
133
+ #[ inline]
134
+ #[ target_feature( enable = "avx512f" ) ]
135
+ #[ cfg_attr( test, assert_instr( vpcmp) ) ]
136
+ pub unsafe fn _mm512_cmplt_epu32_mask ( a : __m512i , b : __m512i ) -> __mmask16 {
137
+ simd_bitmask :: < u32x16 , _ > ( simd_lt ( a. as_u32x16 ( ) , b. as_u32x16 ( ) ) )
138
+ }
139
+
140
+ /// Compare packed unsigned 32-bit integers in a and b for less-than, and store the results in a mask vector k
141
+ /// using zeromask m (elements are zeroed out when the corresponding mask bit is not set).
142
+ ///
143
+ /// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=727,1063,4909,1062,1062,1063&text=_mm512_mask_cmplt_epu32)
144
+ #[ inline]
145
+ #[ target_feature( enable = "avx512f" ) ]
146
+ #[ cfg_attr( test, assert_instr( vpcmp) ) ]
147
+ pub unsafe fn _mm512_mask_cmplt_epu32_mask ( m : __mmask16 , a : __m512i , b : __m512i ) -> __mmask16 {
148
+ _mm512_cmplt_epu32_mask ( a, b) & m
149
+ }
150
+
97
151
/// Compare packed unsigned 64-bit integers in a and b for less-than, and store the results in a mask vector.
98
152
///
99
153
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=727,1063,4909,1062,1062&text=_mm512_cmplt_epu64)
@@ -261,6 +315,27 @@ pub unsafe fn _mm512_mask_cmp_epu64_mask(
261
315
transmute ( r)
262
316
}
263
317
318
+ /// Compare packed unsigned 32-bit integers in a and b for less-than, and store the results in a mask vector.
319
+ ///
320
+ /// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=727,1063,4909,1062,1062&text=_mm512_cmplt_epi32)
321
+ #[ inline]
322
+ #[ target_feature( enable = "avx512f" ) ]
323
+ #[ cfg_attr( test, assert_instr( vpcmp) ) ]
324
+ pub unsafe fn _mm512_cmplt_epi32_mask ( a : __m512i , b : __m512i ) -> __mmask16 {
325
+ simd_bitmask :: < i32x16 , _ > ( simd_lt ( a. as_i32x16 ( ) , b. as_i32x16 ( ) ) )
326
+ }
327
+
328
+ /// Compare packed unsigned 32-bit integers in a and b for less-than, and store the results in a mask vector k
329
+ /// using zeromask m (elements are zeroed out when the corresponding mask bit is not set).
330
+ ///
331
+ /// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=727,1063,4909,1062,1062,1063&text=_mm512_mask_cmplt_epi32)
332
+ #[ inline]
333
+ #[ target_feature( enable = "avx512f" ) ]
334
+ #[ cfg_attr( test, assert_instr( vpcmp) ) ]
335
+ pub unsafe fn _mm512_mask_cmplt_epi32_mask ( m : __mmask16 , a : __m512i , b : __m512i ) -> __mmask16 {
336
+ _mm512_cmplt_epi32_mask ( a, b) & m
337
+ }
338
+
264
339
/// Compare packed signed 64-bit integers in a and b for less-than, and store the results in a mask vector.
265
340
///
266
341
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=727,1063,4909,1062,1062&text=_mm512_cmplt_epi64)
@@ -556,4 +631,75 @@ mod tests {
556
631
) ;
557
632
assert_eq_m512i ( r, e) ;
558
633
}
634
+
635
+ #[ simd_test( enable = "avx512f" ) ]
636
+ unsafe fn test_mm512_cmplt_epu32_mask ( ) {
637
+ #[ rustfmt:: skip]
638
+ let a = _mm512_set_epi32 ( 0 , 1 , -1 , u32:: MAX as i32 , i32:: MAX , i32:: MIN , 100 , -100 ,
639
+ 0 , 1 , -1 , u32:: MAX as i32 , i32:: MAX , i32:: MIN , 100 , -100 ) ;
640
+ let b = _mm512_set1_epi32 ( -1 ) ;
641
+ let m = _mm512_cmplt_epu32_mask ( a, b) ;
642
+ assert_eq ! ( m, 0b11001111_11001111 ) ;
643
+ }
644
+
645
+ #[ simd_test( enable = "avx512f" ) ]
646
+ unsafe fn test_mm512_mask_cmplt_epu32_mask ( ) {
647
+ #[ rustfmt:: skip]
648
+ let a = _mm512_set_epi32 ( 0 , 1 , -1 , u32:: MAX as i32 , i32:: MAX , i32:: MIN , 100 , -100 ,
649
+ 0 , 1 , -1 , u32:: MAX as i32 , i32:: MAX , i32:: MIN , 100 , -100 ) ;
650
+ let b = _mm512_set1_epi32 ( -1 ) ;
651
+ let mask = 0b01111010_01111010 ;
652
+ let r = _mm512_mask_cmplt_epu32_mask ( mask, a, b) ;
653
+ assert_eq ! ( r, 0b01001010_01001010 ) ;
654
+ }
655
+
656
+ #[ simd_test( enable = "avx512f" ) ]
657
+ unsafe fn test_mm512_cmplt_epi32_mask ( ) {
658
+ #[ rustfmt:: skip]
659
+ let a = _mm512_set_epi32 ( 0 , 1 , -1 , u32:: MAX as i32 , i32:: MAX , i32:: MIN , 100 , -100 ,
660
+ 0 , 1 , -1 , u32:: MAX as i32 , i32:: MAX , i32:: MIN , 100 , -100 ) ;
661
+ let b = _mm512_set1_epi32 ( -1 ) ;
662
+ let m = _mm512_cmplt_epi32_mask ( a, b) ;
663
+ assert_eq ! ( m, 0b00000101_00000101 ) ;
664
+ }
665
+
666
+ #[ simd_test( enable = "avx512f" ) ]
667
+ unsafe fn test_mm512_mask_cmplt_epi32_mask ( ) {
668
+ #[ rustfmt:: skip]
669
+ let a = _mm512_set_epi32 ( 0 , 1 , -1 , u32:: MAX as i32 , i32:: MAX , i32:: MIN , 100 , -100 ,
670
+ 0 , 1 , -1 , u32:: MAX as i32 , i32:: MAX , i32:: MIN , 100 , -100 ) ;
671
+ let b = _mm512_set1_epi32 ( -1 ) ;
672
+ let mask = 0b01100110_01100110 ;
673
+ let r = _mm512_mask_cmplt_epi32_mask ( mask, a, b) ;
674
+ assert_eq ! ( r, 0b00000100_00000100 ) ;
675
+ }
676
+
677
+ #[ simd_test( enable = "avx512f" ) ]
678
+ unsafe fn test_mm512_set_epi32 ( ) {
679
+ let r = _mm512_setr_epi32 ( 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 ) ;
680
+ assert_eq_m512i (
681
+ r,
682
+ _mm512_set_epi32 ( 15 , 14 , 13 , 12 , 11 , 10 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 , 0 ) ,
683
+ )
684
+ }
685
+
686
+ #[ simd_test( enable = "avx512f" ) ]
687
+ unsafe fn test_mm512_setr_epi32 ( ) {
688
+ let r = _mm512_set_epi32 ( 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 ) ;
689
+ assert_eq_m512i (
690
+ r,
691
+ _mm512_setr_epi32 ( 15 , 14 , 13 , 12 , 11 , 10 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 , 0 ) ,
692
+ )
693
+ }
694
+
695
+ #[ simd_test( enable = "avx512f" ) ]
696
+ unsafe fn test_mm512_set1_epi32 ( ) {
697
+ let r = _mm512_set_epi32 ( 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ) ;
698
+ assert_eq_m512i ( r, _mm512_set1_epi32 ( 2 ) ) ;
699
+ }
700
+
701
+ #[ simd_test( enable = "avx512f" ) ]
702
+ unsafe fn test_mm512_setzero_si512 ( ) {
703
+ assert_eq_m512i ( _mm512_set1_epi32 ( 0 ) , _mm512_setzero_si512 ( ) ) ;
704
+ }
559
705
}
0 commit comments