Skip to content

Commit 2a8adcc

Browse files
authored
Rollup merge of rust-lang#111332 - loongarch-rs:inline-asm, r=Amanieu
Improve inline asm for LoongArch This PR is a sub-part of rust-lang#111235, to improve inline asm for LoongArch. r? `@Amanieu`
2 parents c122ac3 + c5382ad commit 2a8adcc

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

compiler/rustc_codegen_llvm/src/asm.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,18 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
236236
InlineAsmArch::Nvptx64 => {}
237237
InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => {}
238238
InlineAsmArch::Hexagon => {}
239-
InlineAsmArch::LoongArch64 => {}
239+
InlineAsmArch::LoongArch64 => {
240+
constraints.extend_from_slice(&[
241+
"~{$fcc0}".to_string(),
242+
"~{$fcc1}".to_string(),
243+
"~{$fcc2}".to_string(),
244+
"~{$fcc3}".to_string(),
245+
"~{$fcc4}".to_string(),
246+
"~{$fcc5}".to_string(),
247+
"~{$fcc6}".to_string(),
248+
"~{$fcc7}".to_string(),
249+
]);
250+
}
240251
InlineAsmArch::Mips | InlineAsmArch::Mips64 => {}
241252
InlineAsmArch::S390x => {
242253
constraints.push("~{cc}".to_string());

compiler/rustc_target/src/asm/loongarch.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ impl LoongArchInlineAsmRegClass {
3333

3434
pub fn supported_types(
3535
self,
36-
arch: InlineAsmArch,
36+
_arch: InlineAsmArch,
3737
) -> &'static [(InlineAsmType, Option<Symbol>)] {
38-
match (self, arch) {
39-
(Self::reg, InlineAsmArch::LoongArch64) => types! { _: I8, I16, I32, I64, F32, F64; },
40-
(Self::reg, _) => types! { _: I8, I16, I32, F32; },
41-
(Self::freg, _) => types! { _: F32, F64; },
38+
match self {
39+
Self::reg => types! { _: I8, I16, I32, I64, F32, F64; },
40+
Self::freg => types! { _: F32, F64; },
4241
}
4342
}
4443
}

0 commit comments

Comments
 (0)