Skip to content

Commit 35f71a8

Browse files
authored
Merge pull request #1 from gnzlbg/p32blo_sse41
P32blo sse41
2 parents 46aceed + e6cb465 commit 35f71a8

File tree

5 files changed

+537
-47
lines changed

5 files changed

+537
-47
lines changed

src/lib.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,20 @@ mod v32 {
169169

170170
define_ty! { i16x2, i16, i16 }
171171
define_impl! { i16x2, i16, 2, i16x2, x0, x1 }
172+
define_ty! { u16x2, u16, u16 }
173+
define_impl! { u16x2, u16, 2, i16x2, x0, x1 }
172174

173175
define_ty! { i8x4, i8, i8, i8, i8 }
174176
define_impl! { i8x4, i8, 4, i8x4, x0, x1, x2, x3 }
175-
176177
define_ty! { u8x4, u8, u8, u8, u8 }
177178
define_impl! { u8x4, u8, 4, i8x4, x0, x1, x2, x3 }
178179

179-
define_casts!((i8x4, i32x4, as_i32x4), (i16x2, i64x2, as_i64x2));
180+
define_casts!(
181+
(i16x2, i64x2, as_i64x2),
182+
(u16x2, i64x2, as_i64x2),
183+
(i8x4, i32x4, as_i32x4),
184+
(u8x4, i32x4, as_i32x4)
185+
);
180186
}
181187

182188
/// 16-bit wide vector tpyes
@@ -185,8 +191,10 @@ mod v16 {
185191

186192
define_ty! { i8x2, i8, i8 }
187193
define_impl! { i8x2, i8, 2, i8x2, x0, x1 }
194+
define_ty! { u8x2, u8, u8 }
195+
define_impl! { u8x2, u8, 2, i8x2, x0, x1 }
188196

189-
define_casts!((i8x2, i64x2, as_i64x2));
197+
define_casts!((i8x2, i64x2, as_i64x2), (u8x2, i64x2, as_i64x2));
190198
}
191199

192200
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]

src/macros.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ macro_rules! test_arithmetic_ {
485485

486486
#[cfg(test)]
487487
#[macro_export]
488-
macro_rules! test_neg_ {
488+
macro_rules! test_neg_ {
489489
($tn:ident, $zero:expr, $one:expr, $two:expr, $four:expr) => {
490490
{
491491
let z = $tn::splat($zero);
@@ -573,7 +573,7 @@ macro_rules! test_bit_arithmetic_ {
573573

574574
#[cfg(test)]
575575
#[macro_export]
576-
macro_rules! test_ops_si {
576+
macro_rules! test_ops_si {
577577
($($tn:ident),+) => {
578578
$(
579579
test_arithmetic_!($tn, 0, 1, 2, 4);
@@ -585,7 +585,7 @@ macro_rules! test_bit_arithmetic_ {
585585

586586
#[cfg(test)]
587587
#[macro_export]
588-
macro_rules! test_ops_ui {
588+
macro_rules! test_ops_ui {
589589
($($tn:ident),+) => {
590590
$(
591591
test_arithmetic_!($tn, 0, 1, 2, 4);
@@ -596,7 +596,7 @@ macro_rules! test_bit_arithmetic_ {
596596

597597
#[cfg(test)]
598598
#[macro_export]
599-
macro_rules! test_ops_f {
599+
macro_rules! test_ops_f {
600600
($($tn:ident),+) => {
601601
$(
602602
test_arithmetic_!($tn, 0., 1., 2., 4.);

src/v64.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,14 @@ define_casts!(
6060
(u8x8, i8x8, as_i8x8),
6161
(i8x8, u8x8, as_u8x8),
6262
(i8x8, i16x8, as_i16x8),
63+
(u8x8, i16x8, as_i16x8),
6364
(i16x4, i32x4, as_i32x4),
6465
(i32x2, i64x2, as_i64x2),
6566
(u8x8, u16x8, as_u16x8),
6667
(u16x4, u32x4, as_u32x4),
67-
(u32x2, u64x2, as_u64x2)
68+
(u16x4, i32x4, as_i32x4),
69+
(u32x2, u64x2, as_u64x2),
70+
(u32x2, i64x2, as_i64x2)
6871
);
6972

7073
#[cfg(test)]

src/x86/macros.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,22 @@ macro_rules! constify_imm4 {
328328
}
329329
}
330330

331+
macro_rules! constify_imm3 {
332+
($imm8:expr, $expand:ident) => {
333+
#[allow(overflowing_literals)]
334+
match $imm8 & 0b111 {
335+
0 => $expand!(0),
336+
1 => $expand!(1),
337+
2 => $expand!(2),
338+
3 => $expand!(3),
339+
4 => $expand!(4),
340+
5 => $expand!(5),
341+
6 => $expand!(6),
342+
_ => $expand!(7),
343+
}
344+
}
345+
}
346+
331347
macro_rules! constify_imm2 {
332348
($imm8:expr, $expand:ident) => {
333349
#[allow(overflowing_literals)]

0 commit comments

Comments
 (0)