std_detect: Add target features for LoongArch v1.1
This commit is contained in:
committed by
Amanieu d'Antras
parent
c0fc23f2d8
commit
ad03413c39
@@ -11,8 +11,13 @@ features! {
|
|||||||
/// * `"f"`
|
/// * `"f"`
|
||||||
/// * `"d"`
|
/// * `"d"`
|
||||||
/// * `"frecipe"`
|
/// * `"frecipe"`
|
||||||
|
/// * `"div32"`
|
||||||
/// * `"lsx"`
|
/// * `"lsx"`
|
||||||
/// * `"lasx"`
|
/// * `"lasx"`
|
||||||
|
/// * `"lam-bh"`
|
||||||
|
/// * `"lamcas"`
|
||||||
|
/// * `"ld-seq-sa"`
|
||||||
|
/// * `"scq"`
|
||||||
/// * `"lbt"`
|
/// * `"lbt"`
|
||||||
/// * `"lvz"`
|
/// * `"lvz"`
|
||||||
/// * `"ual"`
|
/// * `"ual"`
|
||||||
@@ -23,10 +28,20 @@ features! {
|
|||||||
/// D
|
/// D
|
||||||
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] frecipe: "frecipe";
|
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] frecipe: "frecipe";
|
||||||
/// Frecipe
|
/// Frecipe
|
||||||
|
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] div32: "div32";
|
||||||
|
/// Div32
|
||||||
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] lsx: "lsx";
|
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] lsx: "lsx";
|
||||||
/// LSX
|
/// LSX
|
||||||
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] lasx: "lasx";
|
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] lasx: "lasx";
|
||||||
/// LASX
|
/// LASX
|
||||||
|
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] lam_bh: "lam-bh";
|
||||||
|
/// LAM-BH
|
||||||
|
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] lamcas: "lamcas";
|
||||||
|
/// LAM-CAS
|
||||||
|
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] ld_seq_sa: "ld-seq-sa";
|
||||||
|
/// LD-SEQ-SA
|
||||||
|
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] scq: "scq";
|
||||||
|
/// SCQ
|
||||||
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] lbt: "lbt";
|
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] lbt: "lbt";
|
||||||
/// LBT
|
/// LBT
|
||||||
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] lvz: "lvz";
|
@FEATURE: #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")] lvz: "lvz";
|
||||||
|
|||||||
@@ -24,7 +24,20 @@ pub(crate) fn detect_features() -> cache::Initializer {
|
|||||||
options(pure, nomem, preserves_flags, nostack)
|
options(pure, nomem, preserves_flags, nostack)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
let cpucfg3: usize;
|
||||||
|
unsafe {
|
||||||
|
asm!(
|
||||||
|
"cpucfg {}, {}",
|
||||||
|
out(reg) cpucfg3, in(reg) 3,
|
||||||
|
options(pure, nomem, preserves_flags, nostack)
|
||||||
|
);
|
||||||
|
}
|
||||||
enable_feature(&mut value, Feature::frecipe, bit::test(cpucfg2, 25));
|
enable_feature(&mut value, Feature::frecipe, bit::test(cpucfg2, 25));
|
||||||
|
enable_feature(&mut value, Feature::div32, bit::test(cpucfg2, 26));
|
||||||
|
enable_feature(&mut value, Feature::lam_bh, bit::test(cpucfg2, 27));
|
||||||
|
enable_feature(&mut value, Feature::lamcas, bit::test(cpucfg2, 28));
|
||||||
|
enable_feature(&mut value, Feature::scq, bit::test(cpucfg2, 30));
|
||||||
|
enable_feature(&mut value, Feature::ld_seq_sa, bit::test(cpucfg3, 23));
|
||||||
|
|
||||||
// The values are part of the platform-specific [asm/hwcap.h][hwcap]
|
// The values are part of the platform-specific [asm/hwcap.h][hwcap]
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user