Skip to content

Commit 8eb2b52

Browse files
folkertdevAmanieu
authored andcommitted
add vec_cmpeq_idx and variations
1 parent caef17d commit 8eb2b52

File tree

1 file changed

+206
-0
lines changed

1 file changed

+206
-0
lines changed

crates/core_arch/src/s390x/vector.rs

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,38 @@ unsafe extern "unadjusted" {
251251
#[link_name = "llvm.s390.vstrczbs"] fn vstrczbs(a: vector_unsigned_char, b: vector_unsigned_char, c: vector_unsigned_char, d: u32) -> PackedTuple<vector_bool_char, i32>;
252252
#[link_name = "llvm.s390.vstrczhs"] fn vstrczhs(a: vector_unsigned_short, b: vector_unsigned_short, c: vector_unsigned_short, d: u32) -> PackedTuple<vector_bool_short, i32>;
253253
#[link_name = "llvm.s390.vstrczfs"] fn vstrczfs(a: vector_unsigned_int, b: vector_unsigned_int, c: vector_unsigned_int, d: u32) -> PackedTuple<vector_bool_int, i32>;
254+
255+
#[link_name = "llvm.s390.vfeeb"] fn vfeeb(a: i8x16, b: i8x16) -> i8x16;
256+
#[link_name = "llvm.s390.vfeeh"] fn vfeeh(a: i16x8, b: i16x8) -> i16x8;
257+
#[link_name = "llvm.s390.vfeef"] fn vfeef(a: i32x4, b: i32x4) -> i32x4;
258+
259+
#[link_name = "llvm.s390.vfeezb"] fn vfeezb(a: i8x16, b: i8x16) -> i8x16;
260+
#[link_name = "llvm.s390.vfeezh"] fn vfeezh(a: i16x8, b: i16x8) -> i16x8;
261+
#[link_name = "llvm.s390.vfeezf"] fn vfeezf(a: i32x4, b: i32x4) -> i32x4;
262+
263+
#[link_name = "llvm.s390.vfeebs"] fn vfeebs(a: i8x16, b: i8x16) -> PackedTuple<i8x16, i32>;
264+
#[link_name = "llvm.s390.vfeehs"] fn vfeehs(a: i16x8, b: i16x8) -> PackedTuple<i16x8, i32>;
265+
#[link_name = "llvm.s390.vfeefs"] fn vfeefs(a: i32x4, b: i32x4) -> PackedTuple<i32x4, i32>;
266+
267+
#[link_name = "llvm.s390.vfeezbs"] fn vfeezbs(a: i8x16, b: i8x16) -> PackedTuple<i8x16, i32>;
268+
#[link_name = "llvm.s390.vfeezhs"] fn vfeezhs(a: i16x8, b: i16x8) -> PackedTuple<i16x8, i32>;
269+
#[link_name = "llvm.s390.vfeezfs"] fn vfeezfs(a: i32x4, b: i32x4) -> PackedTuple<i32x4, i32>;
270+
271+
#[link_name = "llvm.s390.vfeneb"] fn vfeneb(a: i8x16, b: i8x16) -> i8x16;
272+
#[link_name = "llvm.s390.vfeneh"] fn vfeneh(a: i16x8, b: i16x8) -> i16x8;
273+
#[link_name = "llvm.s390.vfenef"] fn vfenef(a: i32x4, b: i32x4) -> i32x4;
274+
275+
#[link_name = "llvm.s390.vfenezb"] fn vfenezb(a: i8x16, b: i8x16) -> i8x16;
276+
#[link_name = "llvm.s390.vfenezh"] fn vfenezh(a: i16x8, b: i16x8) -> i16x8;
277+
#[link_name = "llvm.s390.vfenezf"] fn vfenezf(a: i32x4, b: i32x4) -> i32x4;
278+
279+
#[link_name = "llvm.s390.vfenebs"] fn vfenebs(a: i8x16, b: i8x16) -> PackedTuple<i8x16, i32>;
280+
#[link_name = "llvm.s390.vfenehs"] fn vfenehs(a: i16x8, b: i16x8) -> PackedTuple<i16x8, i32>;
281+
#[link_name = "llvm.s390.vfenefs"] fn vfenefs(a: i32x4, b: i32x4) -> PackedTuple<i32x4, i32>;
282+
283+
#[link_name = "llvm.s390.vfenezbs"] fn vfenezbs(a: i8x16, b: i8x16) -> PackedTuple<i8x16, i32>;
284+
#[link_name = "llvm.s390.vfenezhs"] fn vfenezhs(a: i16x8, b: i16x8) -> PackedTuple<i16x8, i32>;
285+
#[link_name = "llvm.s390.vfenezfs"] fn vfenezfs(a: i32x4, b: i32x4) -> PackedTuple<i32x4, i32>;
254286
}
255287

256288
impl_from! { i8x16, u8x16, i16x8, u16x8, i32x4, u32x4, i64x2, u64x2, f32x4, f64x2 }
@@ -3437,6 +3469,107 @@ mod sealed {
34373469
vector_unsigned_long_long
34383470
vector_double
34393471
}
3472+
3473+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
3474+
pub trait VectorEqualityIdx: Sized {
3475+
type Result;
3476+
3477+
unsafe fn vec_cmpeq_idx(self, other: Self) -> Self::Result;
3478+
unsafe fn vec_cmpne_idx(self, other: Self) -> Self::Result;
3479+
3480+
unsafe fn vec_cmpeq_idx_cc(self, other: Self, cc: *mut i32) -> Self::Result;
3481+
unsafe fn vec_cmpne_idx_cc(self, other: Self, cc: *mut i32) -> Self::Result;
3482+
3483+
unsafe fn vec_cmpeq_or_0_idx(self, other: Self) -> Self::Result;
3484+
unsafe fn vec_cmpne_or_0_idx(self, other: Self) -> Self::Result;
3485+
3486+
unsafe fn vec_cmpeq_or_0_idx_cc(self, other: Self, cc: *mut i32) -> Self::Result;
3487+
unsafe fn vec_cmpne_or_0_idx_cc(self, other: Self, cc: *mut i32) -> Self::Result;
3488+
}
3489+
3490+
macro_rules! impl_compare_equality_idx {
3491+
($($ty:ident $ret:ident
3492+
$cmpeq:ident $cmpne:ident
3493+
$cmpeq_or_0:ident $cmpne_or_0:ident
3494+
$cmpeq_cc:ident $cmpne_cc:ident
3495+
$cmpeq_or_0_cc:ident $cmpne_or_0_cc:ident
3496+
)*) => {
3497+
$(
3498+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
3499+
impl VectorEqualityIdx for $ty {
3500+
type Result = $ret;
3501+
3502+
#[inline]
3503+
#[target_feature(enable = "vector")]
3504+
unsafe fn vec_cmpeq_idx(self, other: Self) -> Self::Result {
3505+
transmute($cmpeq(transmute(self), transmute(other)))
3506+
}
3507+
3508+
#[inline]
3509+
#[target_feature(enable = "vector")]
3510+
unsafe fn vec_cmpne_idx(self, other: Self) -> Self::Result {
3511+
transmute($cmpne(transmute(self), transmute(other)))
3512+
}
3513+
3514+
#[inline]
3515+
#[target_feature(enable = "vector")]
3516+
unsafe fn vec_cmpeq_or_0_idx(self, other: Self) -> Self::Result {
3517+
transmute($cmpeq_or_0(transmute(self), transmute(other)))
3518+
}
3519+
3520+
#[inline]
3521+
#[target_feature(enable = "vector")]
3522+
unsafe fn vec_cmpne_or_0_idx(self, other: Self) -> Self::Result {
3523+
transmute($cmpne_or_0(transmute(self), transmute(other)))
3524+
}
3525+
3526+
#[inline]
3527+
#[target_feature(enable = "vector")]
3528+
unsafe fn vec_cmpeq_idx_cc(self, other: Self, cc: *mut i32) -> Self::Result {
3529+
let PackedTuple { x, y } = $cmpeq_cc(transmute(self), transmute(other));
3530+
*cc = y;
3531+
transmute(x)
3532+
}
3533+
3534+
#[inline]
3535+
#[target_feature(enable = "vector")]
3536+
unsafe fn vec_cmpne_idx_cc(self, other: Self, cc: *mut i32) -> Self::Result {
3537+
let PackedTuple { x, y } = $cmpne_cc(transmute(self), transmute(other));
3538+
*cc = y;
3539+
transmute(x)
3540+
}
3541+
3542+
#[inline]
3543+
#[target_feature(enable = "vector")]
3544+
unsafe fn vec_cmpeq_or_0_idx_cc(self, other: Self, cc: *mut i32) -> Self::Result {
3545+
let PackedTuple { x, y } = $cmpeq_or_0_cc(transmute(self), transmute(other));
3546+
*cc = y;
3547+
transmute(x)
3548+
}
3549+
3550+
#[inline]
3551+
#[target_feature(enable = "vector")]
3552+
unsafe fn vec_cmpne_or_0_idx_cc(self, other: Self, cc: *mut i32) -> Self::Result {
3553+
let PackedTuple { x, y } = $cmpne_or_0_cc(transmute(self), transmute(other));
3554+
*cc = y;
3555+
transmute(x)
3556+
}
3557+
}
3558+
)*
3559+
}
3560+
}
3561+
3562+
impl_compare_equality_idx! {
3563+
vector_signed_char vector_signed_char vfeeb vfeneb vfeezb vfenezb vfeebs vfenebs vfeezbs vfenezbs
3564+
vector_bool_char vector_unsigned_char vfeeb vfeneb vfeezb vfenezb vfeebs vfenebs vfeezbs vfenezbs
3565+
vector_unsigned_char vector_unsigned_char vfeeb vfeneb vfeezb vfenezb vfeebs vfenebs vfeezbs vfenezbs
3566+
vector_signed_short vector_signed_short vfeeh vfeneh vfeezh vfenezh vfeehs vfenehs vfeezhs vfenezhs
3567+
vector_bool_short vector_unsigned_short vfeeh vfeneh vfeezh vfenezh vfeehs vfenehs vfeezhs vfenezhs
3568+
vector_unsigned_short vector_unsigned_short vfeeh vfeneh vfeezh vfenezh vfeehs vfenehs vfeezhs vfenezhs
3569+
vector_signed_int vector_signed_int vfeef vfenef vfeezf vfenezf vfeefs vfenefs vfeezfs vfenezfs
3570+
vector_bool_int vector_unsigned_int vfeef vfenef vfeezf vfenezf vfeefs vfenefs vfeezfs vfenezfs
3571+
vector_unsigned_int vector_unsigned_int vfeef vfenef vfeezf vfenezf vfeefs vfenefs vfeezfs vfenezfs
3572+
}
34403573
}
34413574

34423575
/// Load Count to Block Boundary
@@ -5030,6 +5163,79 @@ pub unsafe fn vec_cmple<T: sealed::VectorComparePredicate>(a: T, b: T) -> T::Res
50305163
a.vec_cmple(b)
50315164
}
50325165

5166+
/// Vector Compare Equal Index
5167+
#[inline]
5168+
#[target_feature(enable = "vector")]
5169+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
5170+
pub unsafe fn vec_cmpeq_idx<T: sealed::VectorEqualityIdx>(a: T, b: T) -> T::Result {
5171+
a.vec_cmpeq_idx(b)
5172+
}
5173+
/// Vector Compare Not Equal Index
5174+
#[inline]
5175+
#[target_feature(enable = "vector")]
5176+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
5177+
pub unsafe fn vec_cmpne_idx<T: sealed::VectorEqualityIdx>(a: T, b: T) -> T::Result {
5178+
a.vec_cmpne_idx(b)
5179+
}
5180+
/// Vector Compare Equal Index with Condition Code
5181+
#[inline]
5182+
#[target_feature(enable = "vector")]
5183+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
5184+
pub unsafe fn vec_cmpeq_idx_cc<T: sealed::VectorEqualityIdx>(
5185+
a: T,
5186+
b: T,
5187+
cc: *mut i32,
5188+
) -> T::Result {
5189+
a.vec_cmpeq_idx_cc(b, cc)
5190+
}
5191+
/// Vector Compare Not Equal Index with Condition Code
5192+
#[inline]
5193+
#[target_feature(enable = "vector")]
5194+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
5195+
pub unsafe fn vec_cmpne_idx_cc<T: sealed::VectorEqualityIdx>(
5196+
a: T,
5197+
b: T,
5198+
cc: *mut i32,
5199+
) -> T::Result {
5200+
a.vec_cmpne_idx_cc(b, cc)
5201+
}
5202+
/// Vector Compare Equal or Zero Index
5203+
#[inline]
5204+
#[target_feature(enable = "vector")]
5205+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
5206+
pub unsafe fn vec_cmpeq_or_0_idx<T: sealed::VectorEqualityIdx>(a: T, b: T) -> T::Result {
5207+
a.vec_cmpeq_or_0_idx(b)
5208+
}
5209+
/// Vector Compare Not Equal or Zero Index
5210+
#[inline]
5211+
#[target_feature(enable = "vector")]
5212+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
5213+
pub unsafe fn vec_cmpne_or_0_idx<T: sealed::VectorEqualityIdx>(a: T, b: T) -> T::Result {
5214+
a.vec_cmpne_or_0_idx(b)
5215+
}
5216+
/// Vector Compare Equal or Zero Index with Condition Code
5217+
#[inline]
5218+
#[target_feature(enable = "vector")]
5219+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
5220+
pub unsafe fn vec_cmpeq_or_0_idx_cc<T: sealed::VectorEqualityIdx>(
5221+
a: T,
5222+
b: T,
5223+
cc: *mut i32,
5224+
) -> T::Result {
5225+
a.vec_cmpeq_or_0_idx_cc(b, cc)
5226+
}
5227+
/// Vector Compare Not Equal or Zero Index with Condition Code
5228+
#[inline]
5229+
#[target_feature(enable = "vector")]
5230+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
5231+
pub unsafe fn vec_cmpne_or_0_idx_cc<T: sealed::VectorEqualityIdx>(
5232+
a: T,
5233+
b: T,
5234+
cc: *mut i32,
5235+
) -> T::Result {
5236+
a.vec_cmpne_or_0_idx_cc(b, cc)
5237+
}
5238+
50335239
#[cfg(test)]
50345240
mod tests {
50355241
use super::*;

0 commit comments

Comments
 (0)