Skip to content

Commit fb54b14

Browse files
committed
Move the endian-biased intrinsics in a separate module
1 parent 15beb5b commit fb54b14

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

coresimd/powerpc/altivec.rs

+25-9
Original file line numberDiff line numberDiff line change
@@ -701,15 +701,18 @@ where
701701
a.vec_add(b)
702702
}
703703

704-
/// Vector permute.
705-
#[inline]
706-
#[target_feature(enable = "altivec")]
707-
pub unsafe fn vec_perm<T>(a: T, b: T, c: vector_unsigned_char) -> T
708-
where
709-
T: sealed::VectorPerm,
710-
{
711704

712-
if cfg!(target_endian = "little") {
705+
/// Endian-biased intrinsics
706+
#[cfg(target_endian = "little")]
707+
mod endian {
708+
use super::*;
709+
/// Vector permute.
710+
#[inline]
711+
#[target_feature(enable = "altivec")]
712+
pub unsafe fn vec_perm<T>(a: T, b: T, c: vector_unsigned_char) -> T
713+
where
714+
T: sealed::VectorPerm,
715+
{
713716
// vperm has big-endian bias
714717
//
715718
// Xor the mask and flip the arguments
@@ -718,11 +721,24 @@ where
718721
let c = simd_xor(c, d);
719722

720723
b.vec_vperm(a, c)
721-
} else {
724+
}
725+
}
726+
#[cfg(target_endian = "big")]
727+
mod endian {
728+
use super::*;
729+
/// Vector permute.
730+
#[inline]
731+
#[target_feature(enable = "altivec")]
732+
pub unsafe fn vec_perm<T>(a: T, b: T, c: vector_unsigned_char) -> T
733+
where
734+
T: sealed::VectorPerm,
735+
{
722736
a.vec_vperm(b, c)
723737
}
724738
}
725739

740+
pub use self::endian::*;
741+
726742
#[cfg(test)]
727743
mod tests {
728744
#[cfg(target_arch = "powerpc")]

0 commit comments

Comments
 (0)