Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/core_simd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
any(target_arch = "powerpc", target_arch = "powerpc64"),
feature(stdarch_powerpc)
)]
#![cfg_attr(target_arch = "hexagon", feature(stdarch_hexagon))]
#![warn(missing_docs, clippy::missing_inline_in_public_items)] // basically all items, really
#![deny(
unsafe_op_in_unsafe_fn,
Expand Down
3 changes: 3 additions & 0 deletions crates/core_simd/src/vendor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ mod powerpc;

#[cfg(target_arch = "loongarch64")]
mod loongarch64;

#[cfg(target_arch = "hexagon")]
mod hexagon;
40 changes: 40 additions & 0 deletions crates/core_simd/src/vendor/hexagon.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//! Conversions to Hexagon HVX SIMD types.

use crate::simd::*;

// HVX 128-byte mode (1024-bit vectors)
// Enable with: -C target-feature=+hvx-length128b
#[cfg(target_feature = "hvx-length128b")]
mod hvx_128b {
use super::*;
use core::arch::hexagon::v128::HvxVector;

// Full vectors (1024-bit) map to HvxVector
from_transmute! { unsafe u16x64 => HvxVector }
from_transmute! { unsafe i16x64 => HvxVector }
from_transmute! { unsafe u32x32 => HvxVector }
from_transmute! { unsafe i32x32 => HvxVector }
from_transmute! { unsafe u64x16 => HvxVector }
from_transmute! { unsafe i64x16 => HvxVector }

// FIXME: u8x128/i8x128 don't exist in portable-simd (max lane count is 64)
// u8x64/i8x64 are only 512-bit (half of HvxVector in 128B mode)
}

// HVX 64-byte mode (512-bit vectors)
// Default when hvx-length128b is not specified
#[cfg(not(target_feature = "hvx-length128b"))]
mod hvx_64b {
use super::*;
use core::arch::hexagon::v64::HvxVector;

// Full vectors (512-bit) map to HvxVector
from_transmute! { unsafe u8x64 => HvxVector }
from_transmute! { unsafe i8x64 => HvxVector }
from_transmute! { unsafe u16x32 => HvxVector }
from_transmute! { unsafe i16x32 => HvxVector }
from_transmute! { unsafe u32x16 => HvxVector }
from_transmute! { unsafe i32x16 => HvxVector }
from_transmute! { unsafe u64x8 => HvxVector }
from_transmute! { unsafe i64x8 => HvxVector }
}
Loading