Skip to content

Commit 254a9b4

Browse files
xiangzhaiheiher
authored andcommitted
core_arch: Add LoongArch LSX intrinsics
Co-authored-by: WANG Rui <wangrui@loongson.cn>
1 parent 8668256 commit 254a9b4

File tree

8 files changed

+15688
-0
lines changed

8 files changed

+15688
-0
lines changed

crates/core_arch/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
avx512_target_feature,
2525
mips_target_feature,
2626
powerpc_target_feature,
27+
loongarch_target_feature,
2728
wasm_target_feature,
2829
abi_unadjusted,
2930
rtm_target_feature,

crates/core_arch/src/loongarch64/lsx/generated.rs

Lines changed: 6843 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//! LoongArch64 LSX intrinsics
2+
3+
#![allow(non_camel_case_types)]
4+
5+
#[rustfmt::skip]
6+
mod types;
7+
8+
#[rustfmt::skip]
9+
mod generated;
10+
11+
#[rustfmt::skip]
12+
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
13+
pub use self::generated::*;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
types! {
2+
/// LOONGARCH-specific 128-bit wide vector of 16 packed `i8`.
3+
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
4+
pub struct v16i8(pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8);
5+
6+
/// LOONGARCH-specific 128-bit wide vector of 8 packed `i16`.
7+
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
8+
pub struct v8i16(pub(crate) i16, pub(crate) i16, pub(crate) i16, pub(crate) i16, pub(crate) i16, pub(crate) i16, pub(crate) i16, pub(crate) i16);
9+
10+
/// LOONGARCH-specific 128-bit wide vector of 4 packed `i32`.
11+
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
12+
pub struct v4i32(pub(crate) i32, pub(crate) i32, pub(crate) i32, pub(crate) i32);
13+
14+
/// LOONGARCH-specific 128-bit wide vector of 2 packed `i64`.
15+
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
16+
pub struct v2i64(pub(crate) i64, pub(crate) i64);
17+
18+
/// LOONGARCH-specific 128-bit wide vector of 16 packed `u8`.
19+
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
20+
pub struct v16u8(pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) u8);
21+
22+
/// LOONGARCH-specific 128-bit wide vector of 8 packed `u16`.
23+
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
24+
pub struct v8u16(pub(crate) u16, pub(crate) u16, pub(crate) u16, pub(crate) u16, pub(crate) u16, pub(crate) u16, pub(crate) u16, pub(crate) u16);
25+
26+
/// LOONGARCH-specific 128-bit wide vector of 4 packed `u32`.
27+
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
28+
pub struct v4u32(pub(crate) u32, pub(crate) u32, pub(crate) u32, pub(crate) u32);
29+
30+
/// LOONGARCH-specific 128-bit wide vector of 2 packed `u64`.
31+
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
32+
pub struct v2u64(pub(crate) u64, pub(crate) u64);
33+
34+
/// LOONGARCH-specific 128-bit wide vector of 4 packed `f32`.
35+
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
36+
pub struct v4f32(pub(crate) f32, pub(crate) f32, pub(crate) f32, pub(crate) f32);
37+
38+
/// LOONGARCH-specific 128-bit wide vector of 2 packed `f64`.
39+
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
40+
pub struct v2f64(pub(crate) f64, pub(crate) f64);
41+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//! `LoongArch` intrinsics
2+
3+
mod lsx;
4+
5+
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
6+
pub use self::lsx::*;

crates/core_arch/src/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,16 @@ pub mod arch {
263263
pub mod nvptx {
264264
pub use crate::core_arch::nvptx::*;
265265
}
266+
267+
/// Platform-specific intrinsics for the `loongarch` platform.
268+
///
269+
/// See the [module documentation](../index.html) for more details.
270+
#[cfg(any(target_arch = "loongarch64", doc))]
271+
#[doc(cfg(target_arch = "loongarch64"))]
272+
#[unstable(feature = "stdarch_loongarch", issue = "117427")]
273+
pub mod loongarch64 {
274+
pub use crate::core_arch::loongarch64::*;
275+
}
266276
}
267277

268278
#[cfg(any(target_arch = "x86", target_arch = "x86_64", doc))]
@@ -306,3 +316,7 @@ mod powerpc64;
306316
#[cfg(any(target_arch = "nvptx64", doc))]
307317
#[doc(cfg(target_arch = "nvptx64"))]
308318
mod nvptx;
319+
320+
#[cfg(any(target_arch = "loongarch64", doc))]
321+
#[doc(cfg(target_arch = "loongarch64"))]
322+
mod loongarch64;

0 commit comments

Comments
 (0)