Skip to content

Commit 28c06c4

Browse files
committed
Add supported asm types for LoongArch32
1 parent 7c10378 commit 28c06c4

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

compiler/rustc_target/src/asm/loongarch.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ impl LoongArchInlineAsmRegClass {
3434

3535
pub fn supported_types(
3636
self,
37-
_arch: InlineAsmArch,
37+
arch: InlineAsmArch,
3838
) -> &'static [(InlineAsmType, Option<Symbol>)] {
39-
match self {
40-
Self::reg => types! { _: I8, I16, I32, I64, F32, F64; },
41-
Self::freg => types! { f: F32; d: F64; },
39+
match (self, arch) {
40+
(Self::reg, InlineAsmArch::LoongArch64) => types! { _: I8, I16, I32, I64, F32, F64; },
41+
(Self::reg, InlineAsmArch::LoongArch32) => types! { _: I8, I16, I32, F32; },
42+
(Self::freg, _) => types! { f: F32; d: F64; },
43+
_ => unimplemented!("unsupported register class"),
4244
}
4345
}
4446
}

src/doc/unstable-book/src/language-features/asm-experimental-arch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
1919
- M68k
2020
- CSKY
2121
- SPARC
22+
- LoongArch32
2223

2324
## Register classes
2425

@@ -53,6 +54,8 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
5354
| CSKY | `freg` | `f[0-31]` | `f` |
5455
| SPARC | `reg` | `r[2-29]` | `r` |
5556
| SPARC | `yreg` | `y` | Only clobbers |
57+
| LoongArch32 | `reg` | `$r1`, `$r[4-20]`, `$r[23,30]` | `r` |
58+
| LoongArch32 | `freg` | `$f[0-31]` | `f` |
5659

5760
> **Notes**:
5861
> - NVPTX doesn't have a fixed register set, so named registers are not supported.
@@ -91,6 +94,8 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
9194
| CSKY | `freg` | None | `f32`, |
9295
| SPARC | `reg` | None | `i8`, `i16`, `i32`, `i64` (SPARC64 only) |
9396
| SPARC | `yreg` | N/A | Only clobbers |
97+
| LoongArch32 | `reg` | None | `i8`, `i16`, `i32`, `f32` |
98+
| LoongArch32 | `freg` | None | `f32`, `f64` |
9499

95100
## Register aliases
96101

0 commit comments

Comments
 (0)