Skip to content

Commit e4c6a32

Browse files
folkertdevAmanieu
authored andcommitted
add vec_mulo
1 parent 1843302 commit e4c6a32

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

crates/core_arch/src/s390x/vector.rs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,14 @@ unsafe extern "unadjusted" {
201201
#[link_name = "llvm.s390.vmleh"] fn vmleh(a: vector_unsigned_short, b: vector_unsigned_short) -> vector_unsigned_int;
202202
#[link_name = "llvm.s390.vmlef"] fn vmlef(a: vector_unsigned_int, b: vector_unsigned_int) -> vector_unsigned_long_long;
203203

204+
#[link_name = "llvm.s390.vmob"] fn vmob(a: vector_signed_char, b: vector_signed_char) -> vector_signed_short;
205+
#[link_name = "llvm.s390.vmoh"] fn vmoh(a: vector_signed_short, b: vector_signed_short) -> vector_signed_int;
206+
#[link_name = "llvm.s390.vmof"] fn vmof(a: vector_signed_int, b: vector_signed_int) -> vector_signed_long_long;
207+
208+
#[link_name = "llvm.s390.vmlob"] fn vmlob(a: vector_unsigned_char, b: vector_unsigned_char) -> vector_unsigned_short;
209+
#[link_name = "llvm.s390.vmloh"] fn vmloh(a: vector_unsigned_short, b: vector_unsigned_short) -> vector_unsigned_int;
210+
#[link_name = "llvm.s390.vmlof"] fn vmlof(a: vector_unsigned_int, b: vector_unsigned_int) -> vector_unsigned_long_long;
211+
204212
#[link_name = "llvm.s390.vgfmb"] fn vgfmb(a: vector_unsigned_char, b: vector_unsigned_char) -> vector_unsigned_short;
205213
#[link_name = "llvm.s390.vgfmh"] fn vgfmh(a: vector_unsigned_short, b: vector_unsigned_short) -> vector_unsigned_int;
206214
#[link_name = "llvm.s390.vgfmf"] fn vgfmf(a: vector_unsigned_int, b: vector_unsigned_int) -> vector_unsigned_long_long;
@@ -2620,6 +2628,27 @@ mod sealed {
26202628
impl_mul!([VectorMule vec_mule] vec_vmleh (vector_unsigned_short, vector_unsigned_short) -> vector_unsigned_int);
26212629
impl_mul!([VectorMule vec_mule] vec_vmlef (vector_unsigned_int, vector_unsigned_int) -> vector_unsigned_long_long );
26222630

2631+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
2632+
pub trait VectorMulo<Result> {
2633+
unsafe fn vec_mulo(self, b: Self) -> Result;
2634+
}
2635+
2636+
test_impl! { vec_vmob(a: vector_signed_char, b: vector_signed_char) -> vector_signed_short [ vmob, vmob ] }
2637+
test_impl! { vec_vmoh(a: vector_signed_short, b: vector_signed_short) -> vector_signed_int[ vmoh, vmoh ] }
2638+
test_impl! { vec_vmof(a: vector_signed_int, b: vector_signed_int) -> vector_signed_long_long [ vmof, vmof ] }
2639+
2640+
test_impl! { vec_vmlob(a: vector_unsigned_char, b: vector_unsigned_char) -> vector_unsigned_short [ vmlob, vmlob ] }
2641+
test_impl! { vec_vmloh(a: vector_unsigned_short, b: vector_unsigned_short) -> vector_unsigned_int[ vmloh, vmloh ] }
2642+
test_impl! { vec_vmlof(a: vector_unsigned_int, b: vector_unsigned_int) -> vector_unsigned_long_long [ vmlof, vmlof ] }
2643+
2644+
impl_mul!([VectorMulo vec_mulo] vec_vmob (vector_signed_char, vector_signed_char) -> vector_signed_short );
2645+
impl_mul!([VectorMulo vec_mulo] vec_vmoh (vector_signed_short, vector_signed_short) -> vector_signed_int);
2646+
impl_mul!([VectorMulo vec_mulo] vec_vmof (vector_signed_int, vector_signed_int) -> vector_signed_long_long );
2647+
2648+
impl_mul!([VectorMulo vec_mulo] vec_vmlob (vector_unsigned_char, vector_unsigned_char) -> vector_unsigned_short );
2649+
impl_mul!([VectorMulo vec_mulo] vec_vmloh (vector_unsigned_short, vector_unsigned_short) -> vector_unsigned_int);
2650+
impl_mul!([VectorMulo vec_mulo] vec_vmlof (vector_unsigned_int, vector_unsigned_int) -> vector_unsigned_long_long );
2651+
26232652
#[unstable(feature = "stdarch_s390x", issue = "135681")]
26242653
pub trait VectorGfmsum<Result> {
26252654
unsafe fn vec_gfmsum(self, b: Self) -> Result;
@@ -4728,6 +4757,14 @@ pub unsafe fn vec_mule<T: sealed::VectorMule<U>, U>(a: T, b: T) -> U {
47284757
a.vec_mule(b)
47294758
}
47304759

4760+
/// Vector Multiply Odd
4761+
#[inline]
4762+
#[target_feature(enable = "vector")]
4763+
#[unstable(feature = "stdarch_s390x", issue = "135681")]
4764+
pub unsafe fn vec_mulo<T: sealed::VectorMulo<U>, U>(a: T, b: T) -> U {
4765+
a.vec_mulo(b)
4766+
}
4767+
47314768
/// Vector Galois Field Multiply Sum
47324769
#[inline]
47334770
#[target_feature(enable = "vector")]
@@ -6394,6 +6431,18 @@ mod tests {
63946431
[0x4000_0000, -8, 0xFFFE, 2]
63956432
}
63966433

6434+
test_vec_2! { test_vec_mulo_u, vec_mulo, u16x8, u16x8 -> u32x4,
6435+
[0, 0xFFFF, 0, 2, 0, 2, 0, 1],
6436+
[0, 0xFFFF, 0, 4, 0, 0xFFFF, 0, 2],
6437+
[0xFFFE_0001, 8, 0x0001_FFFE, 2]
6438+
}
6439+
6440+
test_vec_2! { test_vec_mulo_i, vec_mulo, i16x8, i16x8 -> i32x4,
6441+
[0, i16::MIN, 0, -2, 0, 2, 0, 1],
6442+
[0, i16::MIN, 0, 4, 0, i16::MAX, 0, 2],
6443+
[0x4000_0000, -8, 0xFFFE, 2]
6444+
}
6445+
63976446
test_vec_2! { test_vec_gfmsum_1, vec_gfmsum, u16x8, u16x8 -> u32x4,
63986447
[0x1234, 0x5678, 0x9ABC, 0xDEF0, 0x1357, 0x2468, 0xACE0, 0xBDF0],
63996448
[0xFFFF, 0x0001, 0x8000, 0x7FFF, 0xAAAA, 0x5555, 0x1234, 0x5678],

0 commit comments

Comments
 (0)