|
1 | 1 | // This file is autogenerated by fearless_simd_gen
|
2 | 2 |
|
3 |
| -use crate::{Level, SimdElement, SimdInto, seal::Seal}; |
| 3 | +use crate::{Level, SimdCvtFloat, SimdCvtTruncate, SimdElement, SimdInto, seal::Seal}; |
4 | 4 | use crate::{
|
5 | 5 | f32x4, f32x8, f32x16, i8x16, i8x32, i8x64, i16x8, i16x16, i16x32, i32x4, i32x8, i32x16,
|
6 | 6 | mask8x16, mask8x32, mask8x64, mask16x8, mask16x16, mask16x32, mask32x4, mask32x8, mask32x16,
|
7 | 7 | u8x16, u8x32, u8x64, u16x8, u16x16, u16x32, u32x4, u32x8, u32x16,
|
8 | 8 | };
|
9 | 9 | #[doc = r" TODO: docstring"]
|
10 | 10 | pub trait Simd: Sized + Clone + Copy + Send + Sync + Seal + 'static {
|
11 |
| - type f32s: SimdFloat<f32, Self, Block = f32x4<Self>>; |
| 11 | + type f32s: SimdFloat<f32, Self, Block = f32x4<Self>> |
| 12 | + + SimdCvtFloat<Self::u32s> |
| 13 | + + SimdCvtFloat<Self::i32s>; |
12 | 14 | type u8s: SimdInt<u8, Self, Block = u8x16<Self>>;
|
13 | 15 | type i8s: SimdInt<i8, Self, Block = i8x16<Self>>;
|
14 | 16 | type u16s: SimdInt<u16, Self, Block = u16x8<Self>>;
|
15 | 17 | type i16s: SimdInt<i16, Self, Block = i16x8<Self>>;
|
16 |
| - type u32s: SimdInt<u32, Self, Block = u32x4<Self>>; |
17 |
| - type i32s: SimdInt<i32, Self, Block = i32x4<Self>>; |
| 18 | + type u32s: SimdInt<u32, Self, Block = u32x4<Self>> + SimdCvtTruncate<Self::f32s>; |
| 19 | + type i32s: SimdInt<i32, Self, Block = i32x4<Self>> + SimdCvtTruncate<Self::f32s>; |
18 | 20 | type mask8s: SimdMask<i8, Self, Block = mask8x16<Self>>;
|
19 | 21 | type mask16s: SimdMask<i16, Self, Block = mask16x8<Self>>;
|
20 | 22 | type mask32s: SimdMask<i32, Self, Block = mask32x4<Self>>;
|
@@ -655,6 +657,10 @@ pub trait SimdFloat<Element: SimdElement, S: Simd>:
|
655 | 657 | + core::ops::Div<Output = Self>
|
656 | 658 | + core::ops::Div<Element, Output = Self>
|
657 | 659 | {
|
| 660 | + #[inline(always)] |
| 661 | + fn to_int<T: SimdCvtTruncate<Self>>(self) -> T { |
| 662 | + T::truncate_from(self) |
| 663 | + } |
658 | 664 | fn abs(self) -> Self;
|
659 | 665 | fn sqrt(self) -> Self;
|
660 | 666 | fn copysign(self, rhs: impl SimdInto<Self, S>) -> Self;
|
@@ -690,6 +696,10 @@ pub trait SimdInt<Element: SimdElement, S: Simd>:
|
690 | 696 | + core::ops::BitXor<Output = Self>
|
691 | 697 | + core::ops::BitXor<Element, Output = Self>
|
692 | 698 | {
|
| 699 | + #[inline(always)] |
| 700 | + fn to_float<T: SimdCvtFloat<Self>>(self) -> T { |
| 701 | + T::float_from(self) |
| 702 | + } |
693 | 703 | fn simd_eq(self, rhs: impl SimdInto<Self, S>) -> Self::Mask;
|
694 | 704 | fn simd_lt(self, rhs: impl SimdInto<Self, S>) -> Self::Mask;
|
695 | 705 | fn simd_le(self, rhs: impl SimdInto<Self, S>) -> Self::Mask;
|
|
0 commit comments