diff options
| author | WANG Rui <wangrui@loongson.cn> | 2025-08-08 21:59:51 +0800 |
|---|---|---|
| committer | WANG Rui <wangrui@loongson.cn> | 2025-08-09 13:54:09 +0800 |
| commit | 0246245420bbbb378db020c0492561cf701165cd (patch) | |
| tree | fd874fb7a4824d396bcdae13074b54748f15a22f /library/std_detect/src/detect/os/linux | |
| parent | 2886b36df4a646dd8d82fb65bf0c9d8d96c1f71a (diff) | |
| download | rust-0246245420bbbb378db020c0492561cf701165cd.tar.gz rust-0246245420bbbb378db020c0492561cf701165cd.zip | |
rustc_target: Add the `32s` target feature for LoongArch
Diffstat (limited to 'library/std_detect/src/detect/os/linux')
| -rw-r--r-- | library/std_detect/src/detect/os/linux/loongarch.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/library/std_detect/src/detect/os/linux/loongarch.rs b/library/std_detect/src/detect/os/linux/loongarch.rs index e97fda11d08..74415266f8b 100644 --- a/library/std_detect/src/detect/os/linux/loongarch.rs +++ b/library/std_detect/src/detect/os/linux/loongarch.rs @@ -17,22 +17,21 @@ pub(crate) fn detect_features() -> cache::Initializer { // The values are part of the platform-specific [cpucfg] // // [cpucfg]: LoongArch Reference Manual Volume 1: Basic Architecture v1.1 + let cpucfg1: usize; let cpucfg2: usize; - unsafe { - asm!( - "cpucfg {}, {}", - out(reg) cpucfg2, in(reg) 2, - options(pure, nomem, preserves_flags, nostack) - ); - } let cpucfg3: usize; unsafe { asm!( "cpucfg {}, {}", + "cpucfg {}, {}", + "cpucfg {}, {}", + out(reg) cpucfg1, in(reg) 1, + out(reg) cpucfg2, in(reg) 2, out(reg) cpucfg3, in(reg) 3, options(pure, nomem, preserves_flags, nostack) ); } + enable_feature(&mut value, Feature::_32s, bit::test(cpucfg1, 0) || bit::test(cpucfg1, 1)); 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)); |
