mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
Add initial type implementations
This commit is contained in:
parent
8ee9cbaf60
commit
011aafea16
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/target
|
||||
Cargo.lock
|
5
Cargo.toml
Normal file
5
Cargo.toml
Normal file
@ -0,0 +1,5 @@
|
||||
[workspace]
|
||||
|
||||
members = [
|
||||
"crates/core_simd",
|
||||
]
|
5
crates/core_simd/Cargo.toml
Normal file
5
crates/core_simd/Cargo.toml
Normal file
@ -0,0 +1,5 @@
|
||||
[package]
|
||||
name = "core_simd"
|
||||
version = "0.1.0"
|
||||
authors = ["Caleb Zulawski <caleb.zulawski@gmail.com>"]
|
||||
edition = "2018"
|
36
crates/core_simd/src/lib.rs
Normal file
36
crates/core_simd/src/lib.rs
Normal file
@ -0,0 +1,36 @@
|
||||
#![feature(repr_simd)]
|
||||
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
|
||||
macro_rules! import_types {
|
||||
{ $($mod:ident,)* } => {
|
||||
$(
|
||||
mod $mod;
|
||||
pub use $mod::*;
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
import_types! {
|
||||
type_u8x2, type_u8x4, type_u8x8, type_u8x16, type_u8x32, type_u8x64,
|
||||
type_i8x2, type_i8x4, type_i8x8, type_i8x16, type_i8x32, type_i8x64,
|
||||
type_u16x2, type_u16x4, type_u16x8, type_u16x16, type_u16x32,
|
||||
type_i16x2, type_i16x4, type_i16x8, type_i16x16, type_i16x32,
|
||||
type_u32x2, type_u32x4, type_u32x8, type_u32x16,
|
||||
type_i32x2, type_i32x4, type_i32x8, type_i32x16,
|
||||
type_u64x2, type_u64x4, type_u64x8,
|
||||
type_i64x2, type_i64x4, type_i64x8,
|
||||
type_u128x2, type_u128x4,
|
||||
type_i128x2, type_i128x4,
|
||||
}
|
||||
|
||||
import_types! {
|
||||
type_usizex2, type_usizex4, type_usizex8,
|
||||
type_isizex2, type_isizex4, type_isizex8,
|
||||
}
|
||||
|
||||
import_types! {
|
||||
type_f32x2, type_f32x4, type_f32x8, type_f32x16,
|
||||
type_f64x2, type_f64x4, type_f64x8,
|
||||
}
|
140
crates/core_simd/src/macros.rs
Normal file
140
crates/core_simd/src/macros.rs
Normal file
@ -0,0 +1,140 @@
|
||||
macro_rules! from_aligned {
|
||||
{ unsafe $from:ty => $to:ty } => {
|
||||
impl core::convert::From<$from> for $to {
|
||||
#[inline]
|
||||
fn from(value: $from) -> $to {
|
||||
assert_eq!(core::mem::size_of::<$from>(), core::mem::size_of::<$to>());
|
||||
assert!(core::mem::align_of::<$from>() >= core::mem::align_of::<$to>());
|
||||
unsafe { core::mem::transmute(value) }
|
||||
}
|
||||
}
|
||||
};
|
||||
{ unsafe $a:ty |bidirectional| $b:ty } => {
|
||||
from_aligned!{ unsafe $a => $b }
|
||||
from_aligned!{ unsafe $b => $a }
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! from_unaligned {
|
||||
{ unsafe $from:ty => $to:ty } => {
|
||||
impl core::convert::From<$from> for $to {
|
||||
#[inline]
|
||||
fn from(value: $from) -> $to {
|
||||
assert_eq!(core::mem::size_of::<$from>(), core::mem::size_of::<$to>());
|
||||
unsafe { (&value as *const $from as *const $to).read_unaligned() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! define_type {
|
||||
{ struct $name:ident([$type:ty; $lanes:tt]); } => {
|
||||
define_type! { @impl $name [$type; $lanes] }
|
||||
|
||||
// array references
|
||||
impl AsRef<[$type; $lanes]> for $name {
|
||||
#[inline]
|
||||
fn as_ref(&self) -> &[$type; $lanes] {
|
||||
unsafe { &*(self as *const _ as *const _) }
|
||||
}
|
||||
}
|
||||
|
||||
impl AsMut<[$type; $lanes]> for $name {
|
||||
#[inline]
|
||||
fn as_mut(&mut self) -> &mut [$type; $lanes] {
|
||||
unsafe { &mut *(self as *mut _ as *mut _) }
|
||||
}
|
||||
}
|
||||
|
||||
// slice references
|
||||
impl AsRef<[$type]> for $name {
|
||||
#[inline]
|
||||
fn as_ref(&self) -> &[$type] {
|
||||
AsRef::<[$type; $lanes]>::as_ref(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl AsMut<[$type]> for $name {
|
||||
#[inline]
|
||||
fn as_mut(&mut self) -> &mut [$type] {
|
||||
AsMut::<[$type; $lanes]>::as_mut(self)
|
||||
}
|
||||
}
|
||||
|
||||
// vector to array
|
||||
from_aligned! { unsafe $name => [$type; $lanes] }
|
||||
|
||||
// array to vector
|
||||
from_unaligned! { unsafe [$type; $lanes] => $name }
|
||||
|
||||
// splat
|
||||
impl From<$type> for $name {
|
||||
fn from(value: $type) -> Self {
|
||||
Self::splat(value)
|
||||
}
|
||||
}
|
||||
};
|
||||
{ @impl $name:ident [$type:ty; 1] } => {
|
||||
define_type! { @impl $name | $type | $type, | v0, }
|
||||
};
|
||||
{ @impl $name:ident [$type:ty; 2] } => {
|
||||
define_type! { @impl $name | $type | $type, $type, | v0, v1, }
|
||||
};
|
||||
{ @impl $name:ident [$type:ty; 4] } => {
|
||||
define_type! { @impl $name | $type |
|
||||
$type, $type, $type, $type, |
|
||||
v0, v1, v2, v3,
|
||||
}
|
||||
};
|
||||
{ @impl $name:ident [$type:ty; 8] } => {
|
||||
define_type! { @impl $name | $type |
|
||||
$type, $type, $type, $type, $type, $type, $type, $type, |
|
||||
v0, v1, v2, v3, v4, v5, v6, v7,
|
||||
}
|
||||
};
|
||||
{ @impl $name:ident [$type:ty; 16] } => {
|
||||
define_type! { @impl $name | $type |
|
||||
$type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, |
|
||||
v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
|
||||
}
|
||||
};
|
||||
{ @impl $name:ident [$type:ty; 32] } => {
|
||||
define_type! { @impl $name | $type |
|
||||
$type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type,
|
||||
$type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, |
|
||||
v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
|
||||
v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,
|
||||
}
|
||||
};
|
||||
{ @impl $name:ident [$type:ty; 64] } => {
|
||||
define_type! { @impl $name | $type |
|
||||
$type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type,
|
||||
$type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type,
|
||||
$type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type,
|
||||
$type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, $type, |
|
||||
v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
|
||||
v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,
|
||||
v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47,
|
||||
v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63,
|
||||
}
|
||||
};
|
||||
{ @impl $name:ident | $type:ty | $($itype:ty,)* | $($ivar:ident,)* } => {
|
||||
#[allow(non_camel_case_types)]
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, PartialOrd)]
|
||||
#[repr(simd)]
|
||||
pub struct $name($($itype),*);
|
||||
|
||||
impl $name {
|
||||
#[inline]
|
||||
pub fn splat(value: $type) -> Self {
|
||||
Self($(value as $itype),*)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[inline]
|
||||
pub fn new($($ivar: $itype),*) -> Self {
|
||||
Self($($ivar),*)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
9
crates/core_simd/src/type_f32x16.rs
Normal file
9
crates/core_simd/src/type_f32x16.rs
Normal file
@ -0,0 +1,9 @@
|
||||
define_type! { struct f32x16([f32; 16]); }
|
||||
|
||||
/*
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe f32x16 |bidirectional| core::arch::x86::__m512 }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe f32x16 |bidirectional| core::arch::x86_64::__m512 }
|
||||
*/
|
1
crates/core_simd/src/type_f32x2.rs
Normal file
1
crates/core_simd/src/type_f32x2.rs
Normal file
@ -0,0 +1 @@
|
||||
define_type! { struct f32x2([f32; 2]); }
|
7
crates/core_simd/src/type_f32x4.rs
Normal file
7
crates/core_simd/src/type_f32x4.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct f32x4([f32; 4]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe f32x4 |bidirectional| core::arch::x86::__m128 }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe f32x4 |bidirectional| core::arch::x86_64::__m128 }
|
7
crates/core_simd/src/type_f32x8.rs
Normal file
7
crates/core_simd/src/type_f32x8.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct f32x8([f32; 8]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe f32x8 |bidirectional| core::arch::x86::__m256 }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe f32x8 |bidirectional| core::arch::x86_64::__m256 }
|
7
crates/core_simd/src/type_f64x2.rs
Normal file
7
crates/core_simd/src/type_f64x2.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct f64x2([f64; 2]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe f64x2 |bidirectional| core::arch::x86::__m128d }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe f64x2 |bidirectional| core::arch::x86_64::__m128d }
|
7
crates/core_simd/src/type_f64x4.rs
Normal file
7
crates/core_simd/src/type_f64x4.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct f64x4([f64; 4]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe f64x4 |bidirectional| core::arch::x86::__m256d }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe f64x4 |bidirectional| core::arch::x86_64::__m256d }
|
9
crates/core_simd/src/type_f64x8.rs
Normal file
9
crates/core_simd/src/type_f64x8.rs
Normal file
@ -0,0 +1,9 @@
|
||||
define_type! { struct f64x8([f64; 8]); }
|
||||
|
||||
/*
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe f64x8 |bidirectional| core::arch::x86::__m512d }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe f64x8 |bidirectional| core::arch::x86_64::__m512d }
|
||||
*/
|
7
crates/core_simd/src/type_i128x2.rs
Normal file
7
crates/core_simd/src/type_i128x2.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct i128x2([i128; 2]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe i128x2 |bidirectional| core::arch::x86::__m256i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe i128x2 |bidirectional| core::arch::x86_64::__m256i }
|
9
crates/core_simd/src/type_i128x4.rs
Normal file
9
crates/core_simd/src/type_i128x4.rs
Normal file
@ -0,0 +1,9 @@
|
||||
define_type! { struct i128x4([i128; 4]); }
|
||||
|
||||
/*
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe i128x4 |bidirectional| core::arch::x86::__m512i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe i128x4 |bidirectional| core::arch::x86_64::__m512i }
|
||||
*/
|
7
crates/core_simd/src/type_i16x16.rs
Normal file
7
crates/core_simd/src/type_i16x16.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct i16x16([i16; 16]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe i16x16 |bidirectional| core::arch::x86::__m256i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe i16x16 |bidirectional| core::arch::x86_64::__m256i }
|
1
crates/core_simd/src/type_i16x2.rs
Normal file
1
crates/core_simd/src/type_i16x2.rs
Normal file
@ -0,0 +1 @@
|
||||
define_type! { struct i16x2([i16; 2]); }
|
9
crates/core_simd/src/type_i16x32.rs
Normal file
9
crates/core_simd/src/type_i16x32.rs
Normal file
@ -0,0 +1,9 @@
|
||||
define_type! { struct i16x32([i16; 32]); }
|
||||
|
||||
/*
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u8x32 |bidirectional| core::arch::x86::__m512i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u8x32 |bidirectional| core::arch::x86_64::__m512i }
|
||||
*/
|
1
crates/core_simd/src/type_i16x4.rs
Normal file
1
crates/core_simd/src/type_i16x4.rs
Normal file
@ -0,0 +1 @@
|
||||
define_type! { struct i16x4([i16; 4]); }
|
7
crates/core_simd/src/type_i16x8.rs
Normal file
7
crates/core_simd/src/type_i16x8.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct i16x8([i16; 8]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe i16x8 |bidirectional| core::arch::x86::__m128i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe i16x8 |bidirectional| core::arch::x86_64::__m128i }
|
9
crates/core_simd/src/type_i32x16.rs
Normal file
9
crates/core_simd/src/type_i32x16.rs
Normal file
@ -0,0 +1,9 @@
|
||||
define_type! { struct i32x16([i32; 16]); }
|
||||
|
||||
/*
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u32x16 |bidirectional| core::arch::x86::__m512i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u32x16 |bidirectional| core::arch::x86_64::__m512i }
|
||||
*/
|
1
crates/core_simd/src/type_i32x2.rs
Normal file
1
crates/core_simd/src/type_i32x2.rs
Normal file
@ -0,0 +1 @@
|
||||
define_type! { struct i32x2([i32; 2]); }
|
7
crates/core_simd/src/type_i32x4.rs
Normal file
7
crates/core_simd/src/type_i32x4.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct i32x4([i32; 4]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe i32x4 |bidirectional| core::arch::x86::__m128i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe i32x4 |bidirectional| core::arch::x86_64::__m128i }
|
7
crates/core_simd/src/type_i32x8.rs
Normal file
7
crates/core_simd/src/type_i32x8.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct i32x8([i32; 8]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe i32x8 |bidirectional| core::arch::x86::__m256i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe i32x8 |bidirectional| core::arch::x86_64::__m256i }
|
7
crates/core_simd/src/type_i64x2.rs
Normal file
7
crates/core_simd/src/type_i64x2.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct i64x2([i64; 2]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe i64x2 |bidirectional| core::arch::x86::__m128i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe i64x2 |bidirectional| core::arch::x86_64::__m128i }
|
7
crates/core_simd/src/type_i64x4.rs
Normal file
7
crates/core_simd/src/type_i64x4.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct i64x4([i64; 4]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe i64x4 |bidirectional| core::arch::x86::__m256i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe i64x4 |bidirectional| core::arch::x86_64::__m256i }
|
9
crates/core_simd/src/type_i64x8.rs
Normal file
9
crates/core_simd/src/type_i64x8.rs
Normal file
@ -0,0 +1,9 @@
|
||||
define_type! { struct i64x8([i64; 8]); }
|
||||
|
||||
/*
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe i64x8 |bidirectional| core::arch::x86::__m512i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe i64x8 |bidirectional| core::arch::x86_64::__m512i }
|
||||
*/
|
7
crates/core_simd/src/type_i8x16.rs
Normal file
7
crates/core_simd/src/type_i8x16.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct i8x16([i8; 16]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe i8x16 |bidirectional| core::arch::x86::__m128i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe i8x16 |bidirectional| core::arch::x86_64::__m128i }
|
1
crates/core_simd/src/type_i8x2.rs
Normal file
1
crates/core_simd/src/type_i8x2.rs
Normal file
@ -0,0 +1 @@
|
||||
define_type! { struct i8x2([i8; 2]); }
|
7
crates/core_simd/src/type_i8x32.rs
Normal file
7
crates/core_simd/src/type_i8x32.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct i8x32([i8; 32]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe i8x32 |bidirectional| core::arch::x86::__m256i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe i8x32 |bidirectional| core::arch::x86_64::__m256i }
|
1
crates/core_simd/src/type_i8x4.rs
Normal file
1
crates/core_simd/src/type_i8x4.rs
Normal file
@ -0,0 +1 @@
|
||||
define_type! { struct i8x4([i8; 4]); }
|
9
crates/core_simd/src/type_i8x64.rs
Normal file
9
crates/core_simd/src/type_i8x64.rs
Normal file
@ -0,0 +1,9 @@
|
||||
define_type! { struct i8x64([i8; 64]); }
|
||||
|
||||
/*
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u8x64 |bidirectional| core::arch::x86::__m512i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u8x64 |bidirectional| core::arch::x86_64::__m512i }
|
||||
*/
|
1
crates/core_simd/src/type_i8x8.rs
Normal file
1
crates/core_simd/src/type_i8x8.rs
Normal file
@ -0,0 +1 @@
|
||||
define_type! { struct i8x8([i8; 8]); }
|
7
crates/core_simd/src/type_isizex2.rs
Normal file
7
crates/core_simd/src/type_isizex2.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct isizex2([isize; 2]); }
|
||||
|
||||
#[cfg(all(target_arch = "x86", target_pointer_width = "64"))]
|
||||
from_aligned! { unsafe isizex2 |bidirectional| core::arch::x86::__m128i }
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
from_aligned! { unsafe isizex2 |bidirectional| core::arch::x86_64::__m128i }
|
13
crates/core_simd/src/type_isizex4.rs
Normal file
13
crates/core_simd/src/type_isizex4.rs
Normal file
@ -0,0 +1,13 @@
|
||||
define_type! { struct isizex4([isize; 4]); }
|
||||
|
||||
#[cfg(all(target_arch = "x86", target_pointer_width = "32"))]
|
||||
from_aligned! { unsafe isizex4 |bidirectional| core::arch::x86::__m128i }
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
|
||||
from_aligned! { unsafe isizex4 |bidirectional| core::arch::x86_64::__m128i }
|
||||
|
||||
#[cfg(all(target_arch = "x86", target_pointer_width = "64"))]
|
||||
from_aligned! { unsafe isizex4 |bidirectional| core::arch::x86::__m256i }
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
from_aligned! { unsafe isizex4 |bidirectional| core::arch::x86_64::__m256i }
|
15
crates/core_simd/src/type_isizex8.rs
Normal file
15
crates/core_simd/src/type_isizex8.rs
Normal file
@ -0,0 +1,15 @@
|
||||
define_type! { struct isizex8([isize; 8]); }
|
||||
|
||||
#[cfg(all(target_arch = "x86", target_pointer_width = "32"))]
|
||||
from_aligned! { unsafe isizex8 |bidirectional| core::arch::x86::__m256i }
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
|
||||
from_aligned! { unsafe isizex8 |bidirectional| core::arch::x86_64::__m256i }
|
||||
|
||||
/*
|
||||
#[cfg(all(target_arch = "x86", target_pointer_width = "64"))]
|
||||
from_aligned! { unsafe isizex8 |bidirectional| core::arch::x86::__m512i }
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
from_aligned! { unsafe isizex8 |bidirectional| core::arch::x86_64::__m512i }
|
||||
*/
|
7
crates/core_simd/src/type_u128x2.rs
Normal file
7
crates/core_simd/src/type_u128x2.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct u128x2([u128; 2]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u128x2 |bidirectional| core::arch::x86::__m256i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u128x2 |bidirectional| core::arch::x86_64::__m256i }
|
9
crates/core_simd/src/type_u128x4.rs
Normal file
9
crates/core_simd/src/type_u128x4.rs
Normal file
@ -0,0 +1,9 @@
|
||||
define_type! { struct u128x4([u128; 4]); }
|
||||
|
||||
/*
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u128x4 |bidirectional| core::arch::x86::__m512i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u128x4 |bidirectional| core::arch::x86_64::__m512i }
|
||||
*/
|
7
crates/core_simd/src/type_u16x16.rs
Normal file
7
crates/core_simd/src/type_u16x16.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct u16x16([u16; 16]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u16x16 |bidirectional| core::arch::x86::__m256i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u16x16 |bidirectional| core::arch::x86_64::__m256i }
|
1
crates/core_simd/src/type_u16x2.rs
Normal file
1
crates/core_simd/src/type_u16x2.rs
Normal file
@ -0,0 +1 @@
|
||||
define_type! { struct u16x2([u16; 2]); }
|
9
crates/core_simd/src/type_u16x32.rs
Normal file
9
crates/core_simd/src/type_u16x32.rs
Normal file
@ -0,0 +1,9 @@
|
||||
define_type! { struct u16x32([u16; 32]); }
|
||||
|
||||
/*
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u16x32 |bidirectional| core::arch::x86::__m512i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u16x32 |bidirectional| core::arch::x86_64::__m512i }
|
||||
*/
|
1
crates/core_simd/src/type_u16x4.rs
Normal file
1
crates/core_simd/src/type_u16x4.rs
Normal file
@ -0,0 +1 @@
|
||||
define_type! { struct u16x4([u16; 4]); }
|
7
crates/core_simd/src/type_u16x8.rs
Normal file
7
crates/core_simd/src/type_u16x8.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct u16x8([u16; 8]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u16x8 |bidirectional| core::arch::x86::__m128i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u16x8 |bidirectional| core::arch::x86_64::__m128i }
|
9
crates/core_simd/src/type_u32x16.rs
Normal file
9
crates/core_simd/src/type_u32x16.rs
Normal file
@ -0,0 +1,9 @@
|
||||
define_type! { struct u32x16([u32; 16]); }
|
||||
|
||||
/*
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u32x16 |bidirectional| core::arch::x86::__m512i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u32x16 |bidirectional| core::arch::x86_64::__m512i }
|
||||
*/
|
1
crates/core_simd/src/type_u32x2.rs
Normal file
1
crates/core_simd/src/type_u32x2.rs
Normal file
@ -0,0 +1 @@
|
||||
define_type! { struct u32x2([u32; 2]); }
|
7
crates/core_simd/src/type_u32x4.rs
Normal file
7
crates/core_simd/src/type_u32x4.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct u32x4([u32; 4]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u32x4 |bidirectional| core::arch::x86::__m128i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u32x4 |bidirectional| core::arch::x86_64::__m128i }
|
7
crates/core_simd/src/type_u32x8.rs
Normal file
7
crates/core_simd/src/type_u32x8.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct u32x8([u32; 8]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u32x8 |bidirectional| core::arch::x86::__m256i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u32x8 |bidirectional| core::arch::x86_64::__m256i }
|
7
crates/core_simd/src/type_u64x2.rs
Normal file
7
crates/core_simd/src/type_u64x2.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct u64x2([u64; 2]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u64x2 |bidirectional| core::arch::x86::__m128i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u64x2 |bidirectional| core::arch::x86_64::__m128i }
|
7
crates/core_simd/src/type_u64x4.rs
Normal file
7
crates/core_simd/src/type_u64x4.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct u64x4([u64; 4]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u64x4 |bidirectional| core::arch::x86::__m256i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u64x4 |bidirectional| core::arch::x86_64::__m256i }
|
9
crates/core_simd/src/type_u64x8.rs
Normal file
9
crates/core_simd/src/type_u64x8.rs
Normal file
@ -0,0 +1,9 @@
|
||||
define_type! { struct u64x8([u64; 8]); }
|
||||
|
||||
/*
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u64x8 |bidirectional| core::arch::x86::__m512i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u64x8 |bidirectional| core::arch::x86_64::__m512i }
|
||||
*/
|
7
crates/core_simd/src/type_u8x16.rs
Normal file
7
crates/core_simd/src/type_u8x16.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct u8x16([u8; 16]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u8x16 |bidirectional| core::arch::x86::__m128i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u8x16 |bidirectional| core::arch::x86_64::__m128i }
|
1
crates/core_simd/src/type_u8x2.rs
Normal file
1
crates/core_simd/src/type_u8x2.rs
Normal file
@ -0,0 +1 @@
|
||||
define_type! { struct u8x2([u8; 2]); }
|
7
crates/core_simd/src/type_u8x32.rs
Normal file
7
crates/core_simd/src/type_u8x32.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct u8x32([u8; 32]); }
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u8x32 |bidirectional| core::arch::x86::__m256i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u8x32 |bidirectional| core::arch::x86_64::__m256i }
|
1
crates/core_simd/src/type_u8x4.rs
Normal file
1
crates/core_simd/src/type_u8x4.rs
Normal file
@ -0,0 +1 @@
|
||||
define_type! { struct u8x4([u8; 4]); }
|
9
crates/core_simd/src/type_u8x64.rs
Normal file
9
crates/core_simd/src/type_u8x64.rs
Normal file
@ -0,0 +1,9 @@
|
||||
define_type! { struct u8x64([u8; 64]); }
|
||||
|
||||
/*
|
||||
#[cfg(target_arch = "x86")]
|
||||
from_aligned! { unsafe u8x64 |bidirectional| core::arch::x86::__m512i }
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
from_aligned! { unsafe u8x64 |bidirectional| core::arch::x86_64::__m512i }
|
||||
*/
|
1
crates/core_simd/src/type_u8x8.rs
Normal file
1
crates/core_simd/src/type_u8x8.rs
Normal file
@ -0,0 +1 @@
|
||||
define_type! { struct u8x8([u8; 8]); }
|
7
crates/core_simd/src/type_usizex2.rs
Normal file
7
crates/core_simd/src/type_usizex2.rs
Normal file
@ -0,0 +1,7 @@
|
||||
define_type! { struct usizex2([usize; 2]); }
|
||||
|
||||
#[cfg(all(target_arch = "x86", target_pointer_width = "64"))]
|
||||
from_aligned! { unsafe usizex2 |bidirectional| core::arch::x86::__m128i }
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
from_aligned! { unsafe usizex2 |bidirectional| core::arch::x86_64::__m128i }
|
13
crates/core_simd/src/type_usizex4.rs
Normal file
13
crates/core_simd/src/type_usizex4.rs
Normal file
@ -0,0 +1,13 @@
|
||||
define_type! { struct usizex4([usize; 4]); }
|
||||
|
||||
#[cfg(all(target_arch = "x86", target_pointer_width = "32"))]
|
||||
from_aligned! { unsafe usizex4 |bidirectional| core::arch::x86::__m128i }
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
|
||||
from_aligned! { unsafe usizex4 |bidirectional| core::arch::x86_64::__m128i }
|
||||
|
||||
#[cfg(all(target_arch = "x86", target_pointer_width = "64"))]
|
||||
from_aligned! { unsafe usizex4 |bidirectional| core::arch::x86::__m256i }
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
from_aligned! { unsafe usizex4 |bidirectional| core::arch::x86_64::__m256i }
|
15
crates/core_simd/src/type_usizex8.rs
Normal file
15
crates/core_simd/src/type_usizex8.rs
Normal file
@ -0,0 +1,15 @@
|
||||
define_type! { struct usizex8([usize; 8]); }
|
||||
|
||||
#[cfg(all(target_arch = "x86", target_pointer_width = "32"))]
|
||||
from_aligned! { unsafe usizex8 |bidirectional| core::arch::x86::__m256i }
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
|
||||
from_aligned! { unsafe usizex8 |bidirectional| core::arch::x86_64::__m256i }
|
||||
|
||||
/*
|
||||
#[cfg(all(target_arch = "x86", target_pointer_width = "64"))]
|
||||
from_aligned! { unsafe usizex8 |bidirectional| core::arch::x86::__m512i }
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
from_aligned! { unsafe usizex8 |bidirectional| core::arch::x86_64::__m512i }
|
||||
*/
|
Loading…
Reference in New Issue
Block a user