Skip to content

Commit

Permalink
Remove Into/From between x86 and portable types (rust-lang#292)
Browse files Browse the repository at this point in the history
This is primarily doing to avoid falling into a portability trap by accident,
and in general makes the vendor types (on x86) going towards as minimal as they
can be. Along the way some tests were cleaned up which were still using the
portable types.
  • Loading branch information
alexcrichton authored Jan 20, 2018
1 parent d0c24da commit f67eb4e
Show file tree
Hide file tree
Showing 8 changed files with 316 additions and 445 deletions.
33 changes: 7 additions & 26 deletions coresimd/src/v128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ define_from!(
u16x8,
i16x8,
u8x16,
i8x16,
__m128i
i8x16
);
define_from!(
i64x2,
Expand All @@ -66,8 +65,7 @@ define_from!(
u16x8,
i16x8,
u8x16,
i8x16,
__m128i
i8x16
);
define_from!(
u32x4,
Expand All @@ -77,8 +75,7 @@ define_from!(
u16x8,
i16x8,
u8x16,
i8x16,
__m128i
i8x16
);
define_from!(
i32x4,
Expand All @@ -88,8 +85,7 @@ define_from!(
u16x8,
i16x8,
u8x16,
i8x16,
__m128i
i8x16
);
define_from!(
u16x8,
Expand All @@ -99,8 +95,7 @@ define_from!(
i32x4,
i16x8,
u8x16,
i8x16,
__m128i
i8x16
);
define_from!(
i16x8,
Expand All @@ -110,8 +105,7 @@ define_from!(
i32x4,
u16x8,
u8x16,
i8x16,
__m128i
i8x16
);
define_from!(
u8x16,
Expand All @@ -121,22 +115,9 @@ define_from!(
i32x4,
u16x8,
i16x8,
i8x16,
__m128i
);
define_from!(
i8x16,
u64x2,
i64x2,
u32x4,
i32x4,
u16x8,
i16x8,
u8x16,
__m128i
i8x16
);
define_from!(
__m128i,
i8x16,
u64x2,
i64x2,
Expand Down
33 changes: 7 additions & 26 deletions coresimd/src/v256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ define_from!(
u16x16,
i16x16,
u8x32,
i8x32,
__m256i
i8x32
);
define_from!(
i64x4,
Expand All @@ -91,8 +90,7 @@ define_from!(
u16x16,
i16x16,
u8x32,
i8x32,
__m256i
i8x32
);
define_from!(
u32x8,
Expand All @@ -102,8 +100,7 @@ define_from!(
u16x16,
i16x16,
u8x32,
i8x32,
__m256i
i8x32
);
define_from!(
i32x8,
Expand All @@ -113,8 +110,7 @@ define_from!(
u16x16,
i16x16,
u8x32,
i8x32,
__m256i
i8x32
);
define_from!(
u16x16,
Expand All @@ -124,8 +120,7 @@ define_from!(
i32x8,
i16x16,
u8x32,
i8x32,
__m256i
i8x32
);
define_from!(
i16x16,
Expand All @@ -135,8 +130,7 @@ define_from!(
i32x8,
u16x16,
u8x32,
i8x32,
__m256i
i8x32
);
define_from!(
u8x32,
Expand All @@ -146,22 +140,9 @@ define_from!(
i32x8,
u16x16,
i16x16,
i8x32,
__m256i
);
define_from!(
i8x32,
u64x4,
i64x4,
u32x8,
i32x8,
u16x16,
i16x16,
u8x32,
__m256i
i8x32
);
define_from!(
__m256i,
i8x32,
u64x4,
i64x4,
Expand Down
13 changes: 6 additions & 7 deletions coresimd/src/v64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ define_ty_doc! {
/// 64-bit wide integer vector type.
}

define_from!(u32x2, i32x2, u16x4, i16x4, u8x8, i8x8, __m64);
define_from!(i32x2, u32x2, u16x4, i16x4, u8x8, i8x8, __m64);
define_from!(u16x4, u32x2, i32x2, i16x4, u8x8, i8x8, __m64);
define_from!(i16x4, u32x2, i32x2, u16x4, u8x8, i8x8, __m64);
define_from!(u8x8, u32x2, i32x2, u16x4, i16x4, i8x8, __m64);
define_from!(i8x8, u32x2, i32x2, u16x4, i16x4, u8x8, __m64);
define_from!(__m64, i8x8, u32x2, i32x2, u16x4, i16x4, u8x8);
define_from!(u32x2, i32x2, u16x4, i16x4, u8x8, i8x8);
define_from!(i32x2, u32x2, u16x4, i16x4, u8x8, i8x8);
define_from!(u16x4, u32x2, i32x2, i16x4, u8x8, i8x8);
define_from!(i16x4, u32x2, i32x2, u16x4, u8x8, i8x8);
define_from!(u8x8, u32x2, i32x2, u16x4, i16x4, i8x8);
define_from!(i8x8, u32x2, i32x2, u16x4, i16x4, u8x8);

define_common_ops!(f32x2, u32x2, i32x2, u16x4, i16x4, u8x8, i8x8);
define_float_ops!(f32x2);
Expand Down
2 changes: 1 addition & 1 deletion coresimd/src/x86/i586/sse3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub unsafe fn _mm_hsub_ps(a: __m128, b: __m128) -> __m128 {
#[target_feature(enable = "sse3")]
#[cfg_attr(test, assert_instr(lddqu))]
pub unsafe fn _mm_lddqu_si128(mem_addr: *const __m128i) -> __m128i {
__m128i::from(lddqu(mem_addr as *const _))
mem::transmute(lddqu(mem_addr as *const _))
}

/// Duplicate the low double-precision (64-bit) floating-point element
Expand Down
Loading

0 comments on commit f67eb4e

Please sign in to comment.