Skip to content

Commit 0035d22

Browse files
sayantnAmanieu
authored andcommitted
Fix s390x intrinsics
- use correct intrinsic for unpackl - fix invalid use of `simd_{or,and,xor}` on floating point vectors - `vec_search_string` should require `vector-enhancements-2`
1 parent e7887aa commit 0035d22

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

crates/core_arch/src/s390x/vector.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ unsafe extern "unadjusted" {
174174
#[link_name = "llvm.s390.vpklsfs"] fn vpklsfs(a: vector_unsigned_int, b: vector_unsigned_int) -> PackedTuple<vector_unsigned_short, i32>;
175175
#[link_name = "llvm.s390.vpklsgs"] fn vpklsgs(a: vector_unsigned_long_long, b: vector_unsigned_long_long) -> PackedTuple<vector_unsigned_int, i32>;
176176

177-
#[link_name = "llvm.s390.vuplbw"] fn vuplbw (a: vector_signed_char) -> vector_signed_short;
177+
#[link_name = "llvm.s390.vuplb"] fn vuplb (a: vector_signed_char) -> vector_signed_short;
178178
#[link_name = "llvm.s390.vuplhw"] fn vuplhw (a: vector_signed_short) -> vector_signed_int;
179-
#[link_name = "llvm.s390.vuplfw"] fn vuplfw (a: vector_signed_int) -> vector_signed_long_long;
179+
#[link_name = "llvm.s390.vuplf"] fn vuplf (a: vector_signed_int) -> vector_signed_long_long;
180180
#[link_name = "llvm.s390.vupllb"] fn vupllb (a: vector_unsigned_char) -> vector_unsigned_short;
181181
#[link_name = "llvm.s390.vupllh"] fn vupllh (a: vector_unsigned_short) -> vector_unsigned_int;
182182
#[link_name = "llvm.s390.vupllf"] fn vupllf (a: vector_unsigned_int) -> vector_unsigned_long_long;
@@ -2581,9 +2581,9 @@ mod sealed {
25812581
// FIXME(llvm): a shuffle + simd_as does not currently optimize into a single instruction like
25822582
// unpachk above. Tracked in https://github.com/llvm/llvm-project/issues/129576.
25832583

2584-
impl_vec_trait! {[VectorUnpackl vec_unpackl] vuplbw (vector_signed_char) -> vector_signed_short}
2584+
impl_vec_trait! {[VectorUnpackl vec_unpackl] vuplb (vector_signed_char) -> vector_signed_short}
25852585
impl_vec_trait! {[VectorUnpackl vec_unpackl] vuplhw (vector_signed_short) -> vector_signed_int}
2586-
impl_vec_trait! {[VectorUnpackl vec_unpackl] vuplfw (vector_signed_int) -> vector_signed_long_long}
2586+
impl_vec_trait! {[VectorUnpackl vec_unpackl] vuplf (vector_signed_int) -> vector_signed_long_long}
25872587

25882588
impl_vec_trait! {[VectorUnpackl vec_unpackl] vupllb (vector_unsigned_char) -> vector_unsigned_short}
25892589
impl_vec_trait! {[VectorUnpackl vec_unpackl] vupllh (vector_unsigned_short) -> vector_unsigned_int}
@@ -3011,9 +3011,9 @@ mod sealed {
30113011
#[inline]
30123012
#[target_feature(enable = "vector")]
30133013
unsafe fn vec_sel(self, b: Self, c: t_u!($ty)) -> Self {
3014-
let b = simd_and(b, transmute(c));
3015-
let a = simd_and(self, simd_xor(transmute(c), transmute(vector_signed_char([!0; 16]))));
3016-
simd_or(a, b)
3014+
let b = simd_and(transmute(b), c);
3015+
let a = simd_and(transmute(self), simd_xor(c, transmute(vector_signed_char([!0; 16]))));
3016+
transmute(simd_or(a, b))
30173017
}
30183018
}
30193019

@@ -3198,14 +3198,14 @@ mod sealed {
31983198
#[unstable(feature = "stdarch_s390x", issue = "135681")]
31993199
impl VectorSearchString for $ty {
32003200
#[inline]
3201-
#[target_feature(enable = "vector")]
3201+
#[target_feature(enable = "vector-enhancements-2")]
32023202
unsafe fn vec_search_string_cc(self, b: Self, c: vector_unsigned_char) -> (vector_unsigned_char, i32) {
32033203
let PackedTuple { x,y } = $intr_s(transmute(self), transmute(b), c);
32043204
(x, y)
32053205
}
32063206

32073207
#[inline]
3208-
#[target_feature(enable = "vector")]
3208+
#[target_feature(enable = "vector-enhancements-2")]
32093209
unsafe fn vec_search_string_until_zero_cc(self, b: Self, c: vector_unsigned_char) -> (vector_unsigned_char, i32) {
32103210
let PackedTuple { x,y } = $intr_sz(transmute(self), transmute(b), c);
32113211
(x, y)

0 commit comments

Comments
 (0)