Skip to content

Commit

Permalink
Rollup merge of #111332 - loongarch-rs:inline-asm, r=Amanieu
Browse files Browse the repository at this point in the history
Improve inline asm for LoongArch

This PR is a sub-part of #111235, to improve inline asm for LoongArch.

r? `@Amanieu`
  • Loading branch information
JohnTitor authored May 8, 2023
2 parents c122ac3 + c5382ad commit 2a8adcc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
13 changes: 12 additions & 1 deletion compiler/rustc_codegen_llvm/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,18 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
InlineAsmArch::Nvptx64 => {}
InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => {}
InlineAsmArch::Hexagon => {}
InlineAsmArch::LoongArch64 => {}
InlineAsmArch::LoongArch64 => {
constraints.extend_from_slice(&[
"~{$fcc0}".to_string(),
"~{$fcc1}".to_string(),
"~{$fcc2}".to_string(),
"~{$fcc3}".to_string(),
"~{$fcc4}".to_string(),
"~{$fcc5}".to_string(),
"~{$fcc6}".to_string(),
"~{$fcc7}".to_string(),
]);
}
InlineAsmArch::Mips | InlineAsmArch::Mips64 => {}
InlineAsmArch::S390x => {
constraints.push("~{cc}".to_string());
Expand Down
9 changes: 4 additions & 5 deletions compiler/rustc_target/src/asm/loongarch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ impl LoongArchInlineAsmRegClass {

pub fn supported_types(
self,
arch: InlineAsmArch,
_arch: InlineAsmArch,
) -> &'static [(InlineAsmType, Option<Symbol>)] {
match (self, arch) {
(Self::reg, InlineAsmArch::LoongArch64) => types! { _: I8, I16, I32, I64, F32, F64; },
(Self::reg, _) => types! { _: I8, I16, I32, F32; },
(Self::freg, _) => types! { _: F32, F64; },
match self {
Self::reg => types! { _: I8, I16, I32, I64, F32, F64; },
Self::freg => types! { _: F32, F64; },
}
}
}
Expand Down

0 comments on commit 2a8adcc

Please sign in to comment.