Skip to content

Commit e2a634b

Browse files
authored
Merge pull request #642 from heiher/loong-simd-types
loongarch64: Use unified data types for SIMD intrinsics
2 parents fe72a08 + 88794e7 commit e2a634b

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

.github/workflows/rust.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ jobs:
4848
x86_64-unknown-linux-gnu,
4949
i686-unknown-linux-gnu,
5050
i586-unknown-linux-gnu,
51-
loongarch64-unknown-linux-gnu,
5251
armv7-unknown-linux-gnueabihf,
5352
aarch64-unknown-linux-gnu,
5453
thumbv6m-none-eabi,
@@ -75,6 +74,9 @@ jobs:
7574
- os: ubuntu-latest
7675
target: x86_64-unknown-linux-gnu
7776
channel: stable
77+
- os: ubuntu-latest
78+
target: loongarch64-unknown-linux-gnu
79+
channel: nightly
7880

7981
msrv:
8082
runs-on: ubuntu-latest

src/control/group/lsx.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use core::mem;
33
use core::num::NonZeroU16;
44

55
use core::arch::loongarch64::*;
6-
use mem::transmute;
76

87
pub(crate) type BitMaskWord = u16;
98
pub(crate) type NonZeroBitMaskWord = NonZeroU16;
@@ -16,7 +15,7 @@ pub(crate) const BITMASK_ITER_MASK: BitMaskWord = !0;
1615
///
1716
/// This implementation uses a 128-bit LSX value.
1817
#[derive(Copy, Clone)]
19-
pub(crate) struct Group(v16i8);
18+
pub(crate) struct Group(m128i);
2019

2120
// FIXME: https://github.com/rust-lang/rust-clippy/issues/3859
2221
#[allow(clippy::use_self)]
@@ -72,42 +71,38 @@ impl Group {
7271
/// the given value.
7372
#[inline]
7473
pub(crate) fn match_tag(self, tag: Tag) -> BitMask {
75-
#[allow(clippy::missing_transmute_annotations)]
7674
unsafe {
7775
let cmp = lsx_vseq_b(self.0, lsx_vreplgr2vr_b(tag.0 as i32));
78-
BitMask(lsx_vpickve2gr_hu::<0>(transmute(lsx_vmskltz_b(cmp))) as u16)
76+
BitMask(lsx_vpickve2gr_hu::<0>(lsx_vmskltz_b(cmp)) as u16)
7977
}
8078
}
8179

8280
/// Returns a `BitMask` indicating all tags in the group which are
8381
/// `EMPTY`.
8482
#[inline]
8583
pub(crate) fn match_empty(self) -> BitMask {
86-
#[allow(clippy::missing_transmute_annotations)]
8784
unsafe {
8885
let cmp = lsx_vseqi_b::<{ Tag::EMPTY.0 as i8 as i32 }>(self.0);
89-
BitMask(lsx_vpickve2gr_hu::<0>(transmute(lsx_vmskltz_b(cmp))) as u16)
86+
BitMask(lsx_vpickve2gr_hu::<0>(lsx_vmskltz_b(cmp)) as u16)
9087
}
9188
}
9289

9390
/// Returns a `BitMask` indicating all tags in the group which are
9491
/// `EMPTY` or `DELETED`.
9592
#[inline]
9693
pub(crate) fn match_empty_or_deleted(self) -> BitMask {
97-
#[allow(clippy::missing_transmute_annotations)]
9894
unsafe {
9995
// A tag is EMPTY or DELETED iff the high bit is set
100-
BitMask(lsx_vpickve2gr_hu::<0>(transmute(lsx_vmskltz_b(self.0))) as u16)
96+
BitMask(lsx_vpickve2gr_hu::<0>(lsx_vmskltz_b(self.0)) as u16)
10197
}
10298
}
10399

104100
/// Returns a `BitMask` indicating all tags in the group which are full.
105101
#[inline]
106102
pub(crate) fn match_full(&self) -> BitMask {
107-
#[allow(clippy::missing_transmute_annotations)]
108103
unsafe {
109104
// A tag is EMPTY or DELETED iff the high bit is set
110-
BitMask(lsx_vpickve2gr_hu::<0>(transmute(lsx_vmskgez_b(self.0))) as u16)
105+
BitMask(lsx_vpickve2gr_hu::<0>(lsx_vmskgez_b(self.0)) as u16)
111106
}
112107
}
113108

@@ -124,14 +119,10 @@ impl Group {
124119
// let special = 0 > tag = 1111_1111 (true) or 0000_0000 (false)
125120
// 1111_1111 | 1000_0000 = 1111_1111
126121
// 0000_0000 | 1000_0000 = 1000_0000
127-
#[allow(clippy::missing_transmute_annotations)]
128122
unsafe {
129123
let zero = lsx_vreplgr2vr_b(0);
130124
let special = lsx_vslt_b(self.0, zero);
131-
Group(transmute(lsx_vor_v(
132-
transmute(special),
133-
transmute(lsx_vreplgr2vr_b(Tag::DELETED.0 as i32)),
134-
)))
125+
Group(lsx_vor_v(special, lsx_vreplgr2vr_b(Tag::DELETED.0 as i32)))
135126
}
136127
}
137128
}

0 commit comments

Comments
 (0)