core/stdarch/crates/core_arch/src/loongarch64/lsx/
types.rs

1types! {
2    #![unstable(feature = "stdarch_loongarch", issue = "117427")]
3
4    /// 128-bit wide integer vector type, LoongArch-specific
5    ///
6    /// This type is the same as the `__m128i` type defined in `lsxintrin.h`,
7    /// representing a 128-bit SIMD register. Usage of this type typically
8    /// occurs in conjunction with the `lsx` and higher target features for
9    /// LoongArch.
10    ///
11    /// Internally this type may be viewed as:
12    ///
13    /// * `i8x16` - sixteen `i8` values packed together
14    /// * `i16x8` - eight `i16` values packed together
15    /// * `i32x4` - four `i32` values packed together
16    /// * `i64x2` - two `i64` values packed together
17    ///
18    /// (as well as unsigned versions). Each intrinsic may interpret the
19    /// internal bits differently, check the documentation of the intrinsic
20    /// to see how it's being used.
21    ///
22    /// The in-memory representation of this type is the same as the one of an
23    /// equivalent array (i.e. the in-memory order of elements is the same, and
24    /// there is no padding); however, the alignment is different and equal to
25    /// the size of the type. Note that the ABI for function calls may *not* be
26    /// the same.
27    ///
28    /// Note that this means that an instance of `m128i` typically just means
29    /// a "bag of bits" which is left up to interpretation at the point of use.
30    ///
31    /// Most intrinsics using `m128i` are prefixed with `lsx_` and the integer
32    /// types tend to correspond to suffixes like "b", "h", "w" or "d".
33    pub struct m128i(2 x i64);
34
35    /// 128-bit wide set of four `f32` values, LoongArch-specific
36    ///
37    /// This type is the same as the `__m128` type defined in `lsxintrin.h`,
38    /// representing a 128-bit SIMD register which internally consists of
39    /// four packed `f32` instances. Usage of this type typically occurs in
40    /// conjunction with the `lsx` and higher target features for LoongArch.
41    ///
42    /// Note that unlike `m128i`, the integer version of the 128-bit registers,
43    /// this `m128` type has *one* interpretation. Each instance of `m128`
44    /// corresponds to `f32x4`, or four `f32` values packed together.
45    ///
46    /// The in-memory representation of this type is the same as the one of an
47    /// equivalent array (i.e. the in-memory order of elements is the same, and
48    /// there is no padding); however, the alignment is different and equal to
49    /// the size of the type. Note that the ABI for function calls may *not* be
50    /// the same.
51    ///
52    /// Most intrinsics using `m128` are prefixed with `lsx_` and are suffixed
53    /// with "s".
54    pub struct m128(4 x f32);
55
56    /// 128-bit wide set of two `f64` values, LoongArch-specific
57    ///
58    /// This type is the same as the `__m128d` type defined in `lsxintrin.h`,
59    /// representing a 128-bit SIMD register which internally consists of
60    /// two packed `f64` instances. Usage of this type typically occurs in
61    /// conjunction with the `lsx` and higher target features for LoongArch.
62    ///
63    /// Note that unlike `m128i`, the integer version of the 128-bit registers,
64    /// this `m128d` type has *one* interpretation. Each instance of `m128d`
65    /// always corresponds to `f64x2`, or two `f64` values packed together.
66    ///
67    /// The in-memory representation of this type is the same as the one of an
68    /// equivalent array (i.e. the in-memory order of elements is the same, and
69    /// there is no padding); however, the alignment is different and equal to
70    /// the size of the type. Note that the ABI for function calls may *not* be
71    /// the same.
72    ///
73    /// Most intrinsics using `m128d` are prefixed with `lsx_` and are suffixed
74    /// with "d". Not to be confused with "d" which is used for `m128i`.
75    pub struct m128d(2 x f64);
76}
77
78#[allow(non_camel_case_types)]
79#[repr(simd)]
80pub(crate) struct __v16i8([i8; 16]);
81#[allow(non_camel_case_types)]
82#[repr(simd)]
83pub(crate) struct __v8i16([i16; 8]);
84#[allow(non_camel_case_types)]
85#[repr(simd)]
86pub(crate) struct __v4i32([i32; 4]);
87#[allow(non_camel_case_types)]
88#[repr(simd)]
89pub(crate) struct __v2i64([i64; 2]);
90#[allow(non_camel_case_types)]
91#[repr(simd)]
92pub(crate) struct __v16u8([u8; 16]);
93#[allow(non_camel_case_types)]
94#[repr(simd)]
95pub(crate) struct __v8u16([u16; 8]);
96#[allow(non_camel_case_types)]
97#[repr(simd)]
98pub(crate) struct __v4u32([u32; 4]);
99#[allow(non_camel_case_types)]
100#[repr(simd)]
101pub(crate) struct __v2u64([u64; 2]);
102#[allow(non_camel_case_types)]
103#[repr(simd)]
104pub(crate) struct __v4f32([f32; 4]);
105#[allow(non_camel_case_types)]
106#[repr(simd)]
107pub(crate) struct __v2f64([f64; 2]);
108
109// These type aliases are provided solely for transitional compatibility.
110// They are temporary and will be removed when appropriate.
111#[allow(non_camel_case_types)]
112#[unstable(feature = "stdarch_loongarch", issue = "117427")]
113pub type v16i8 = m128i;
114#[allow(non_camel_case_types)]
115#[unstable(feature = "stdarch_loongarch", issue = "117427")]
116pub type v8i16 = m128i;
117#[allow(non_camel_case_types)]
118#[unstable(feature = "stdarch_loongarch", issue = "117427")]
119pub type v4i32 = m128i;
120#[allow(non_camel_case_types)]
121#[unstable(feature = "stdarch_loongarch", issue = "117427")]
122pub type v2i64 = m128i;
123#[allow(non_camel_case_types)]
124#[unstable(feature = "stdarch_loongarch", issue = "117427")]
125pub type v16u8 = m128i;
126#[allow(non_camel_case_types)]
127#[unstable(feature = "stdarch_loongarch", issue = "117427")]
128pub type v8u16 = m128i;
129#[allow(non_camel_case_types)]
130#[unstable(feature = "stdarch_loongarch", issue = "117427")]
131pub type v4u32 = m128i;
132#[allow(non_camel_case_types)]
133#[unstable(feature = "stdarch_loongarch", issue = "117427")]
134pub type v2u64 = m128i;
135#[allow(non_camel_case_types)]
136#[unstable(feature = "stdarch_loongarch", issue = "117427")]
137pub type v4f32 = m128;
138#[allow(non_camel_case_types)]
139#[unstable(feature = "stdarch_loongarch", issue = "117427")]
140pub type v2f64 = m128d;