-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Allow rustdoc to handle asm! of foreign architectures #82838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,6 +229,8 @@ pub enum InlineAsmReg { | |
Mips(MipsInlineAsmReg), | ||
SpirV(SpirVInlineAsmReg), | ||
Wasm(WasmInlineAsmReg), | ||
// Placeholder for invalid register constraints for the current target | ||
Err, | ||
} | ||
|
||
impl InlineAsmReg { | ||
|
@@ -240,6 +242,7 @@ impl InlineAsmReg { | |
Self::RiscV(r) => r.name(), | ||
Self::Hexagon(r) => r.name(), | ||
Self::Mips(r) => r.name(), | ||
Self::Err => "<reg>", | ||
} | ||
} | ||
|
||
|
@@ -251,6 +254,7 @@ impl InlineAsmReg { | |
Self::RiscV(r) => InlineAsmRegClass::RiscV(r.reg_class()), | ||
Self::Hexagon(r) => InlineAsmRegClass::Hexagon(r.reg_class()), | ||
Self::Mips(r) => InlineAsmRegClass::Mips(r.reg_class()), | ||
Self::Err => InlineAsmRegClass::Err, | ||
} | ||
} | ||
|
||
|
@@ -309,6 +313,7 @@ impl InlineAsmReg { | |
Self::RiscV(r) => r.emit(out, arch, modifier), | ||
Self::Hexagon(r) => r.emit(out, arch, modifier), | ||
Self::Mips(r) => r.emit(out, arch, modifier), | ||
Self::Err => unreachable!(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Many of these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
} | ||
|
||
|
@@ -320,6 +325,7 @@ impl InlineAsmReg { | |
Self::RiscV(_) => cb(self), | ||
Self::Hexagon(r) => r.overlapping_regs(|r| cb(Self::Hexagon(r))), | ||
Self::Mips(_) => cb(self), | ||
Self::Err => unreachable!(), | ||
} | ||
} | ||
} | ||
|
@@ -346,6 +352,8 @@ pub enum InlineAsmRegClass { | |
Mips(MipsInlineAsmRegClass), | ||
SpirV(SpirVInlineAsmRegClass), | ||
Wasm(WasmInlineAsmRegClass), | ||
// Placeholder for invalid register constraints for the current target | ||
Err, | ||
} | ||
|
||
impl InlineAsmRegClass { | ||
|
@@ -360,6 +368,7 @@ impl InlineAsmRegClass { | |
Self::Mips(r) => r.name(), | ||
Self::SpirV(r) => r.name(), | ||
Self::Wasm(r) => r.name(), | ||
Self::Err => rustc_span::symbol::sym::reg, | ||
} | ||
} | ||
|
||
|
@@ -377,6 +386,7 @@ impl InlineAsmRegClass { | |
Self::Mips(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::Mips), | ||
Self::SpirV(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::SpirV), | ||
Self::Wasm(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::Wasm), | ||
Self::Err => unreachable!(), | ||
} | ||
} | ||
|
||
|
@@ -401,6 +411,7 @@ impl InlineAsmRegClass { | |
Self::Mips(r) => r.suggest_modifier(arch, ty), | ||
Self::SpirV(r) => r.suggest_modifier(arch, ty), | ||
Self::Wasm(r) => r.suggest_modifier(arch, ty), | ||
Self::Err => unreachable!(), | ||
} | ||
} | ||
|
||
|
@@ -421,6 +432,7 @@ impl InlineAsmRegClass { | |
Self::Mips(r) => r.default_modifier(arch), | ||
Self::SpirV(r) => r.default_modifier(arch), | ||
Self::Wasm(r) => r.default_modifier(arch), | ||
Self::Err => unreachable!(), | ||
} | ||
} | ||
|
||
|
@@ -440,6 +452,7 @@ impl InlineAsmRegClass { | |
Self::Mips(r) => r.supported_types(arch), | ||
Self::SpirV(r) => r.supported_types(arch), | ||
Self::Wasm(r) => r.supported_types(arch), | ||
Self::Err => unreachable!(), | ||
} | ||
} | ||
|
||
|
@@ -476,6 +489,7 @@ impl InlineAsmRegClass { | |
Self::Mips(r) => r.valid_modifiers(arch), | ||
Self::SpirV(r) => r.valid_modifiers(arch), | ||
Self::Wasm(r) => r.valid_modifiers(arch), | ||
Self::Err => unreachable!(), | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// check-pass | ||
// Make sure rustdoc accepts asm! for a foreign architecture. | ||
|
||
#![feature(asm)] | ||
|
||
pub unsafe fn aarch64(a: f64, b: f64) { | ||
let c; | ||
asm!("add {:d}, {:d}, d0", out(vreg) c, in(vreg) a, in("d0") { | ||
|| {}; | ||
b | ||
}); | ||
c | ||
} | ||
Amanieu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
pub unsafe fn x86(a: f64, b: f64) { | ||
let c; | ||
asm!("addsd {}, {}, xmm0", out(xmm_reg) c, in(xmm_reg) a, in("xmm0") b); | ||
c | ||
} |
Uh oh!
There was an error while loading. Please reload this page.