@@ -943,6 +943,32 @@ impl I32x16 {
943943 unsafe { _mm512_cmpge_epi32_mask ( self . 0 , _mm512_setzero_si512 ( ) ) }
944944 }
945945
946+ /// Lane-wise **signed** greater-than as a packed 16-bit bitmask.
947+ ///
948+ /// Bit `i` of the result is set iff `self.lane(i) > other.lane(i)` under
949+ /// two's-complement signed ordering. Bit order is **LSB-first**: lane `0`
950+ /// occupies bit `0`. Sibling of [`Self::cmpge_zero_mask`], which uses the
951+ /// same convention.
952+ ///
953+ /// Edge cases (all exact, no saturation or clamping anywhere):
954+ /// * `i32::MIN > i32::MIN` → `false`; nothing is greater than `i32::MIN`
955+ /// except strictly larger values, so `x.gt_bitmask(splat(i32::MIN))` is
956+ /// set for every lane except those equal to `i32::MIN`.
957+ /// * `i32::MAX` as the threshold yields `0` — no `i32` exceeds it.
958+ /// * Negative operands compare as signed, *not* as bit patterns:
959+ /// `-1 > 0` is `false` even though `0xFFFF_FFFF > 0` unsigned.
960+ ///
961+ /// AVX-512 lowers this to a single `VPCMPGTD` into a `__mmask16`, which
962+ /// *is* a `u16` — the packed bitmask is the hardware's native result, so
963+ /// there is no extraction step to elide.
964+ #[ inline( always) ]
965+ pub fn gt_bitmask ( self , other : Self ) -> u16 {
966+ // SAFETY: `Self` wraps a native `__m512i` and this impl block is
967+ // compiled only under the `avx512f` dispatch arm, the same guarantee
968+ // every other method on this type relies on.
969+ unsafe { _mm512_cmpgt_epi32_mask ( self . 0 , other. 0 ) }
970+ }
971+
946972 #[ inline( always) ]
947973 pub fn simd_min ( self , other : Self ) -> Self {
948974 Self ( unsafe { _mm512_min_epi32 ( self . 0 , other. 0 ) } )
@@ -1592,6 +1618,27 @@ impl U32x16 {
15921618 unsafe { _mm512_reduce_add_epi32 ( self . 0 ) as u32 }
15931619 }
15941620
1621+ /// Lane-wise equality as a packed 16-bit bitmask.
1622+ ///
1623+ /// Bit `i` of the result is set iff `self.lane(i) == other.lane(i)`. Bit
1624+ /// order is **LSB-first**: lane `0` occupies bit `0`. Same convention as
1625+ /// [`I32x16::cmpge_zero_mask`] and [`I32x16::gt_bitmask`].
1626+ ///
1627+ /// Edge cases: equality is exact bitwise comparison over the full 32-bit
1628+ /// range, so `u32::MAX` and `0` behave like any other value and there is
1629+ /// no saturation, wrapping, or signedness question to resolve — an `i32`
1630+ /// lane pattern compares identically if reinterpreted.
1631+ ///
1632+ /// AVX-512 lowers this to a single `VPCMPEQD` into a `__mmask16`, which
1633+ /// *is* a `u16` — the packed bitmask is the hardware's native result.
1634+ #[ inline( always) ]
1635+ pub fn eq_bitmask ( self , other : Self ) -> u16 {
1636+ // SAFETY: `Self` wraps a native `__m512i` and this impl block is
1637+ // compiled only under the `avx512f` dispatch arm, the same guarantee
1638+ // every other method on this type relies on.
1639+ unsafe { _mm512_cmpeq_epu32_mask ( self . 0 , other. 0 ) }
1640+ }
1641+
15951642 /// Lane-wise left-rotate by `n` bits — the ARX rotate (matches
15961643 /// `u32::rotate_left`), the third ChaCha20/BLAKE-family primitive alongside
15971644 /// `Add` + `BitXor`. Single `VPROLVD` (AVX-512F variable rotate). The rotate
0 commit comments