-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Basic inline assembly support for SPARC and SPARC64 #132472
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
Merged
+770
−43
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2175,6 +2175,7 @@ symbols! { | |
yes, | ||
yield_expr, | ||
ymm_reg, | ||
yreg, | ||
zfh, | ||
zfhmin, | ||
zmm_reg, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
use std::fmt; | ||
|
||
use rustc_data_structures::fx::FxIndexSet; | ||
use rustc_span::Symbol; | ||
|
||
use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; | ||
use crate::spec::{RelocModel, Target}; | ||
|
||
def_reg_class! { | ||
Sparc SparcInlineAsmRegClass { | ||
reg, | ||
yreg, | ||
} | ||
} | ||
|
||
impl SparcInlineAsmRegClass { | ||
pub fn valid_modifiers(self, _arch: super::InlineAsmArch) -> &'static [char] { | ||
&[] | ||
} | ||
|
||
pub fn suggest_class(self, _arch: InlineAsmArch, _ty: InlineAsmType) -> Option<Self> { | ||
None | ||
} | ||
|
||
pub fn suggest_modifier( | ||
self, | ||
_arch: InlineAsmArch, | ||
_ty: InlineAsmType, | ||
) -> Option<ModifierInfo> { | ||
None | ||
} | ||
|
||
pub fn default_modifier(self, _arch: InlineAsmArch) -> Option<ModifierInfo> { | ||
None | ||
} | ||
|
||
pub fn supported_types( | ||
self, | ||
arch: InlineAsmArch, | ||
) -> &'static [(InlineAsmType, Option<Symbol>)] { | ||
match self { | ||
Self::reg => { | ||
if arch == InlineAsmArch::Sparc { | ||
types! { | ||
_: I8, I16, I32; | ||
// FIXME: i64 is ok for g*/o* registers on SPARC-V8+ ("h" constraint in GCC), | ||
// but not yet supported in LLVM. | ||
// v8plus: I64; | ||
} | ||
} else { | ||
types! { _: I8, I16, I32, I64; } | ||
} | ||
} | ||
Self::yreg => &[], | ||
} | ||
} | ||
} | ||
|
||
fn reserved_g5( | ||
arch: InlineAsmArch, | ||
_reloc_model: RelocModel, | ||
_target_features: &FxIndexSet<Symbol>, | ||
_target: &Target, | ||
_is_clobber: bool, | ||
) -> Result<(), &'static str> { | ||
if arch == InlineAsmArch::Sparc { | ||
// FIXME: Section 2.1.5 "Function Registers with Unassigned Roles" of the V8+ Technical | ||
// Specification says "%g5; no longer reserved for system software" [1], but LLVM always | ||
// reserves it on SPARC32 [2]. | ||
// [1]: https://temlib.org/pub/SparcStation/Standards/V8plus.pdf | ||
// [2]: https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp#L64-L66 | ||
Err("g5 is reserved for system on SPARC32") | ||
} else { | ||
Ok(()) | ||
} | ||
} | ||
|
||
def_regs! { | ||
Sparc SparcInlineAsmReg SparcInlineAsmRegClass { | ||
// FIXME: | ||
// - LLVM has reserve-{g,o,l,i}N feature to reserve each general-purpose registers. | ||
// - g2-g4 are reserved for application (optional in both LLVM and GCC, and GCC has -mno-app-regs option to reserve them). | ||
// There are currently no builtin targets that use them, but in the future they may need to | ||
// be supported via options similar to AArch64's -Z fixed-x18. | ||
r2: reg = ["r2", "g2"], // % reserved_g2 | ||
r3: reg = ["r3", "g3"], // % reserved_g3 | ||
r4: reg = ["r4", "g4"], // % reserved_g4 | ||
r5: reg = ["r5", "g5"] % reserved_g5, | ||
r8: reg = ["r8", "o0"], // % reserved_o0 | ||
r9: reg = ["r9", "o1"], // % reserved_o1 | ||
r10: reg = ["r10", "o2"], // % reserved_o2 | ||
r11: reg = ["r11", "o3"], // % reserved_o3 | ||
r12: reg = ["r12", "o4"], // % reserved_o4 | ||
r13: reg = ["r13", "o5"], // % reserved_o5 | ||
r15: reg = ["r15", "o7"], // % reserved_o7 | ||
r16: reg = ["r16", "l0"], // % reserved_l0 | ||
r17: reg = ["r17", "l1"], // % reserved_l1 | ||
r18: reg = ["r18", "l2"], // % reserved_l2 | ||
r19: reg = ["r19", "l3"], // % reserved_l3 | ||
r20: reg = ["r20", "l4"], // % reserved_l4 | ||
r21: reg = ["r21", "l5"], // % reserved_l5 | ||
r22: reg = ["r22", "l6"], // % reserved_l6 | ||
r23: reg = ["r23", "l7"], // % reserved_l7 | ||
r24: reg = ["r24", "i0"], // % reserved_i0 | ||
r25: reg = ["r25", "i1"], // % reserved_i1 | ||
r26: reg = ["r26", "i2"], // % reserved_i2 | ||
r27: reg = ["r27", "i3"], // % reserved_i3 | ||
r28: reg = ["r28", "i4"], // % reserved_i4 | ||
r29: reg = ["r29", "i5"], // % reserved_i5 | ||
y: yreg = ["y"], | ||
#error = ["r0", "g0"] => | ||
"g0 is always zero and cannot be used as an operand for inline asm", | ||
// FIXME: %g1 is volatile in ABI, but used internally by LLVM. | ||
// https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp#L55-L56 | ||
// > FIXME: G1 reserved for now for large imm generation by frame code. | ||
#error = ["r1", "g1"] => | ||
"reserved by LLVM and cannot be used as an operand for inline asm", | ||
#error = ["r6", "g6", "r7", "g7"] => | ||
"reserved for system and cannot be used as an operand for inline asm", | ||
#error = ["sp", "r14", "o6"] => | ||
"the stack pointer cannot be used as an operand for inline asm", | ||
#error = ["fp", "r30", "i6"] => | ||
"the frame pointer cannot be used as an operand for inline asm", | ||
#error = ["r31", "i7"] => | ||
"the return address register cannot be used as an operand for inline asm", | ||
} | ||
} | ||
|
||
impl SparcInlineAsmReg { | ||
pub fn emit( | ||
self, | ||
out: &mut dyn fmt::Write, | ||
_arch: InlineAsmArch, | ||
_modifier: Option<char>, | ||
) -> fmt::Result { | ||
write!(out, "%{}", self.name()) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
//@ revisions: sparc sparcv8plus sparc64 | ||
//@ assembly-output: emit-asm | ||
//@[sparc] compile-flags: --target sparc-unknown-none-elf | ||
//@[sparc] needs-llvm-components: sparc | ||
//@[sparcv8plus] compile-flags: --target sparc-unknown-linux-gnu | ||
//@[sparcv8plus] needs-llvm-components: sparc | ||
//@[sparc64] compile-flags: --target sparc64-unknown-linux-gnu | ||
//@[sparc64] needs-llvm-components: sparc | ||
//@ compile-flags: -Zmerge-functions=disabled | ||
|
||
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] | ||
#![crate_type = "rlib"] | ||
#![no_core] | ||
#![allow(asm_sub_register, non_camel_case_types)] | ||
|
||
#[rustc_builtin_macro] | ||
macro_rules! asm { | ||
() => {}; | ||
} | ||
#[rustc_builtin_macro] | ||
macro_rules! concat { | ||
() => {}; | ||
} | ||
#[rustc_builtin_macro] | ||
macro_rules! stringify { | ||
() => {}; | ||
} | ||
|
||
#[lang = "sized"] | ||
trait Sized {} | ||
#[lang = "copy"] | ||
trait Copy {} | ||
|
||
type ptr = *const i32; | ||
|
||
impl Copy for i8 {} | ||
impl Copy for u8 {} | ||
impl Copy for i16 {} | ||
impl Copy for i32 {} | ||
impl Copy for i64 {} | ||
impl Copy for f32 {} | ||
impl Copy for f64 {} | ||
impl Copy for ptr {} | ||
|
||
extern "C" { | ||
fn extern_func(); | ||
static extern_static: u8; | ||
} | ||
|
||
macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => { | ||
#[no_mangle] | ||
pub unsafe fn $func(x: $ty) -> $ty { | ||
let y; | ||
asm!(concat!($mov," {}, {}"), in($class) x, out($class) y); | ||
y | ||
} | ||
};} | ||
|
||
macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => { | ||
#[no_mangle] | ||
pub unsafe fn $func(x: $ty) -> $ty { | ||
let y; | ||
asm!(concat!($mov, " %", $reg, ", %", $reg), in($reg) x, lateout($reg) y); | ||
y | ||
} | ||
};} | ||
|
||
// CHECK-LABEL: sym_fn_32: | ||
// CHECK: !APP | ||
// CHECK-NEXT: call extern_func | ||
// CHECK-NEXT: !NO_APP | ||
#[no_mangle] | ||
pub unsafe fn sym_fn_32() { | ||
asm!("call {}", sym extern_func); | ||
} | ||
|
||
// CHECK-LABEL: sym_static: | ||
// CHECK: !APP | ||
// CHECK-NEXT: call extern_static | ||
// CHECK-NEXT: !NO_APP | ||
#[no_mangle] | ||
pub unsafe fn sym_static() { | ||
asm!("call {}", sym extern_static); | ||
} | ||
|
||
// CHECK-LABEL: reg_i8: | ||
// CHECK: !APP | ||
// CHECK-NEXT: mov %{{[goli]}}{{[0-9]+}}, %{{[goli]}}{{[0-9]+}} | ||
// CHECK-NEXT: !NO_APP | ||
check!(reg_i8, i8, reg, "mov"); | ||
|
||
// CHECK-LABEL: reg_i16: | ||
// CHECK: !APP | ||
// CHECK-NEXT: mov %{{[goli]}}{{[0-9]+}}, %{{[goli]}}{{[0-9]+}} | ||
// CHECK-NEXT: !NO_APP | ||
check!(reg_i16, i16, reg, "mov"); | ||
|
||
// CHECK-LABEL: reg_i32: | ||
// CHECK: !APP | ||
// CHECK-NEXT: mov %{{[goli]}}{{[0-9]+}}, %{{[goli]}}{{[0-9]+}} | ||
// CHECK-NEXT: !NO_APP | ||
check!(reg_i32, i32, reg, "mov"); | ||
|
||
// FIXME: should be allowed for sparcv8plus but not yet supported in LLVM | ||
// sparc64-LABEL: reg_i64: | ||
// sparc64: !APP | ||
// sparc64-NEXT: mov %{{[goli]}}{{[0-9]+}}, %{{[goli]}}{{[0-9]+}} | ||
// sparc64-NEXT: !NO_APP | ||
#[cfg(sparc64)] | ||
check!(reg_i64, i64, reg, "mov"); | ||
|
||
// CHECK-LABEL: reg_ptr: | ||
// CHECK: !APP | ||
// CHECK-NEXT: mov %{{[goli]}}{{[0-9]+}}, %{{[goli]}}{{[0-9]+}} | ||
// CHECK-NEXT: !NO_APP | ||
check!(reg_ptr, ptr, reg, "mov"); | ||
|
||
// CHECK-LABEL: o0_i8: | ||
// CHECK: !APP | ||
// CHECK-NEXT: mov %o0, %o0 | ||
// CHECK-NEXT: !NO_APP | ||
check_reg!(o0_i8, i8, "o0", "mov"); | ||
|
||
// CHECK-LABEL: o0_i16: | ||
// CHECK: !APP | ||
// CHECK-NEXT: mov %o0, %o0 | ||
// CHECK-NEXT: !NO_APP | ||
check_reg!(o0_i16, i16, "o0", "mov"); | ||
|
||
// CHECK-LABEL: o0_i32: | ||
// CHECK: !APP | ||
// CHECK-NEXT: mov %o0, %o0 | ||
// CHECK-NEXT: !NO_APP | ||
check_reg!(o0_i32, i32, "o0", "mov"); | ||
|
||
// FIXME: should be allowed for sparcv8plus but not yet supported in LLVM | ||
// sparc64-LABEL: o0_i64: | ||
// sparc64: !APP | ||
// sparc64-NEXT: mov %o0, %o0 | ||
// sparc64-NEXT: !NO_APP | ||
#[cfg(sparc64)] | ||
check_reg!(o0_i64, i64, "o0", "mov"); | ||
|
||
// CHECK-LABEL: r9_i8: | ||
// CHECK: !APP | ||
// CHECK-NEXT: mov %o1, %o1 | ||
// CHECK-NEXT: !NO_APP | ||
check_reg!(r9_i8, i8, "r9", "mov"); | ||
|
||
// CHECK-LABEL: r9_i16: | ||
// CHECK: !APP | ||
// CHECK-NEXT: mov %o1, %o1 | ||
// CHECK-NEXT: !NO_APP | ||
check_reg!(r9_i16, i16, "r9", "mov"); | ||
|
||
// CHECK-LABEL: r9_i32: | ||
// CHECK: !APP | ||
// CHECK-NEXT: mov %o1, %o1 | ||
// CHECK-NEXT: !NO_APP | ||
check_reg!(r9_i32, i32, "r9", "mov"); | ||
|
||
// FIXME: should be allowed for sparcv8plus but not yet supported in LLVM | ||
// sparc64-LABEL: r9_i64: | ||
// sparc64: !APP | ||
// sparc64-NEXT: mov %o1, %o1 | ||
// sparc64-NEXT: !NO_APP | ||
#[cfg(sparc64)] | ||
check_reg!(r9_i64, i64, "r9", "mov"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//@ revisions: sparc sparcv8plus sparc64 | ||
//@[sparc] compile-flags: --target sparc-unknown-none-elf | ||
//@[sparc] needs-llvm-components: sparc | ||
//@[sparcv8plus] compile-flags: --target sparc-unknown-linux-gnu | ||
//@[sparcv8plus] needs-llvm-components: sparc | ||
//@[sparc64] compile-flags: --target sparc64-unknown-linux-gnu | ||
//@[sparc64] needs-llvm-components: sparc | ||
|
||
#![crate_type = "rlib"] | ||
#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] | ||
#![no_core] | ||
|
||
#[lang = "sized"] | ||
trait Sized {} | ||
|
||
#[rustc_builtin_macro] | ||
macro_rules! asm { | ||
() => {}; | ||
} | ||
|
||
// CHECK-LABEL: @cc_clobber | ||
// CHECK: call void asm sideeffect "", "~{icc},~{fcc0},~{fcc1},~{fcc2},~{fcc3}"() | ||
#[no_mangle] | ||
pub unsafe fn cc_clobber() { | ||
asm!("", options(nostack, nomem)); | ||
} | ||
|
||
// CHECK-LABEL: @no_clobber | ||
// CHECK: call void asm sideeffect "", ""() | ||
#[no_mangle] | ||
pub unsafe fn no_clobber() { | ||
asm!("", options(nostack, nomem, preserves_flags)); | ||
} | ||
|
||
// CHECK-LABEL: @y_clobber | ||
// CHECK: call void asm sideeffect "", "~{y}"() | ||
#[no_mangle] | ||
pub unsafe fn y_clobber() { | ||
asm!("", out("y") _, options(nostack, nomem, preserves_flags)); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
//@ revisions: sparc sparcv8plus sparc64 | ||
//@[sparc] compile-flags: --target sparc-unknown-none-elf | ||
//@[sparc] needs-llvm-components: sparc | ||
//@[sparcv8plus] compile-flags: --target sparc-unknown-linux-gnu | ||
//@[sparcv8plus] needs-llvm-components: sparc | ||
//@[sparc64] compile-flags: --target sparc64-unknown-linux-gnu | ||
//@[sparc64] needs-llvm-components: sparc | ||
//@ needs-asm-support | ||
|
||
#![crate_type = "rlib"] | ||
#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] | ||
#![no_core] | ||
|
||
#[lang = "sized"] | ||
trait Sized {} | ||
#[lang = "copy"] | ||
trait Copy {} | ||
|
||
impl Copy for i32 {} | ||
|
||
#[rustc_builtin_macro] | ||
macro_rules! asm { | ||
() => {}; | ||
} | ||
|
||
fn f() { | ||
let mut x = 0; | ||
unsafe { | ||
// Unsupported registers | ||
asm!("", out("g0") _); | ||
//~^ ERROR invalid register `g0`: g0 is always zero and cannot be used as an operand for inline asm | ||
// FIXME: see FIXME in compiler/rustc_target/src/asm/sparc.rs. | ||
asm!("", out("g1") _); | ||
//~^ ERROR invalid register `g1`: reserved by LLVM and cannot be used as an operand for inline asm | ||
asm!("", out("g2") _); | ||
asm!("", out("g3") _); | ||
asm!("", out("g4") _); | ||
asm!("", out("g5") _); | ||
//[sparc,sparcv8plus]~^ ERROR cannot use register `r5`: g5 is reserved for system on SPARC32 | ||
asm!("", out("g6") _); | ||
//~^ ERROR invalid register `g6`: reserved for system and cannot be used as an operand for inline asm | ||
asm!("", out("g7") _); | ||
//~^ ERROR invalid register `g7`: reserved for system and cannot be used as an operand for inline asm | ||
asm!("", out("sp") _); | ||
//~^ ERROR invalid register `sp`: the stack pointer cannot be used as an operand for inline asm | ||
asm!("", out("fp") _); | ||
//~^ ERROR invalid register `fp`: the frame pointer cannot be used as an operand for inline asm | ||
asm!("", out("i7") _); | ||
//~^ ERROR invalid register `i7`: the return address register cannot be used as an operand for inline asm | ||
|
||
// Clobber-only registers | ||
// yreg | ||
asm!("", out("y") _); // ok | ||
asm!("", in("y") x); | ||
//~^ ERROR can only be used as a clobber | ||
//~| ERROR type `i32` cannot be used with this register class | ||
asm!("", out("y") x); | ||
//~^ ERROR can only be used as a clobber | ||
//~| ERROR type `i32` cannot be used with this register class | ||
asm!("/* {} */", in(yreg) x); | ||
//~^ ERROR can only be used as a clobber | ||
//~| ERROR type `i32` cannot be used with this register class | ||
asm!("/* {} */", out(yreg) _); | ||
//~^ ERROR can only be used as a clobber | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
error: invalid register `g0`: g0 is always zero and cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:30:18 | ||
| | ||
LL | asm!("", out("g0") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `g1`: reserved by LLVM and cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:33:18 | ||
| | ||
LL | asm!("", out("g1") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `g6`: reserved for system and cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:40:18 | ||
| | ||
LL | asm!("", out("g6") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `g7`: reserved for system and cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:42:18 | ||
| | ||
LL | asm!("", out("g7") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:44:18 | ||
| | ||
LL | asm!("", out("sp") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:46:18 | ||
| | ||
LL | asm!("", out("fp") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `i7`: the return address register cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:48:18 | ||
| | ||
LL | asm!("", out("i7") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: register class `yreg` can only be used as a clobber, not as an input or output | ||
--> $DIR/bad-reg.rs:54:18 | ||
| | ||
LL | asm!("", in("y") x); | ||
| ^^^^^^^^^ | ||
|
||
error: register class `yreg` can only be used as a clobber, not as an input or output | ||
--> $DIR/bad-reg.rs:57:18 | ||
| | ||
LL | asm!("", out("y") x); | ||
| ^^^^^^^^^^ | ||
|
||
error: register class `yreg` can only be used as a clobber, not as an input or output | ||
--> $DIR/bad-reg.rs:60:26 | ||
| | ||
LL | asm!("/* {} */", in(yreg) x); | ||
| ^^^^^^^^^^ | ||
|
||
error: register class `yreg` can only be used as a clobber, not as an input or output | ||
--> $DIR/bad-reg.rs:63:26 | ||
| | ||
LL | asm!("/* {} */", out(yreg) _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: cannot use register `r5`: g5 is reserved for system on SPARC32 | ||
--> $DIR/bad-reg.rs:38:18 | ||
| | ||
LL | asm!("", out("g5") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: type `i32` cannot be used with this register class | ||
--> $DIR/bad-reg.rs:54:26 | ||
| | ||
LL | asm!("", in("y") x); | ||
| ^ | ||
| | ||
= note: register class `yreg` supports these types: | ||
|
||
error: type `i32` cannot be used with this register class | ||
--> $DIR/bad-reg.rs:57:27 | ||
| | ||
LL | asm!("", out("y") x); | ||
| ^ | ||
| | ||
= note: register class `yreg` supports these types: | ||
|
||
error: type `i32` cannot be used with this register class | ||
--> $DIR/bad-reg.rs:60:35 | ||
| | ||
LL | asm!("/* {} */", in(yreg) x); | ||
| ^ | ||
| | ||
= note: register class `yreg` supports these types: | ||
|
||
error: aborting due to 15 previous errors | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
error: invalid register `g0`: g0 is always zero and cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:30:18 | ||
| | ||
LL | asm!("", out("g0") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `g1`: reserved by LLVM and cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:33:18 | ||
| | ||
LL | asm!("", out("g1") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `g6`: reserved for system and cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:40:18 | ||
| | ||
LL | asm!("", out("g6") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `g7`: reserved for system and cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:42:18 | ||
| | ||
LL | asm!("", out("g7") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:44:18 | ||
| | ||
LL | asm!("", out("sp") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:46:18 | ||
| | ||
LL | asm!("", out("fp") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `i7`: the return address register cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:48:18 | ||
| | ||
LL | asm!("", out("i7") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: register class `yreg` can only be used as a clobber, not as an input or output | ||
--> $DIR/bad-reg.rs:54:18 | ||
| | ||
LL | asm!("", in("y") x); | ||
| ^^^^^^^^^ | ||
|
||
error: register class `yreg` can only be used as a clobber, not as an input or output | ||
--> $DIR/bad-reg.rs:57:18 | ||
| | ||
LL | asm!("", out("y") x); | ||
| ^^^^^^^^^^ | ||
|
||
error: register class `yreg` can only be used as a clobber, not as an input or output | ||
--> $DIR/bad-reg.rs:60:26 | ||
| | ||
LL | asm!("/* {} */", in(yreg) x); | ||
| ^^^^^^^^^^ | ||
|
||
error: register class `yreg` can only be used as a clobber, not as an input or output | ||
--> $DIR/bad-reg.rs:63:26 | ||
| | ||
LL | asm!("/* {} */", out(yreg) _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: type `i32` cannot be used with this register class | ||
--> $DIR/bad-reg.rs:54:26 | ||
| | ||
LL | asm!("", in("y") x); | ||
| ^ | ||
| | ||
= note: register class `yreg` supports these types: | ||
|
||
error: type `i32` cannot be used with this register class | ||
--> $DIR/bad-reg.rs:57:27 | ||
| | ||
LL | asm!("", out("y") x); | ||
| ^ | ||
| | ||
= note: register class `yreg` supports these types: | ||
|
||
error: type `i32` cannot be used with this register class | ||
--> $DIR/bad-reg.rs:60:35 | ||
| | ||
LL | asm!("/* {} */", in(yreg) x); | ||
| ^ | ||
| | ||
= note: register class `yreg` supports these types: | ||
|
||
error: aborting due to 14 previous errors | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
error: invalid register `g0`: g0 is always zero and cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:30:18 | ||
| | ||
LL | asm!("", out("g0") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `g1`: reserved by LLVM and cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:33:18 | ||
| | ||
LL | asm!("", out("g1") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `g6`: reserved for system and cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:40:18 | ||
| | ||
LL | asm!("", out("g6") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `g7`: reserved for system and cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:42:18 | ||
| | ||
LL | asm!("", out("g7") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:44:18 | ||
| | ||
LL | asm!("", out("sp") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:46:18 | ||
| | ||
LL | asm!("", out("fp") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: invalid register `i7`: the return address register cannot be used as an operand for inline asm | ||
--> $DIR/bad-reg.rs:48:18 | ||
| | ||
LL | asm!("", out("i7") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: register class `yreg` can only be used as a clobber, not as an input or output | ||
--> $DIR/bad-reg.rs:54:18 | ||
| | ||
LL | asm!("", in("y") x); | ||
| ^^^^^^^^^ | ||
|
||
error: register class `yreg` can only be used as a clobber, not as an input or output | ||
--> $DIR/bad-reg.rs:57:18 | ||
| | ||
LL | asm!("", out("y") x); | ||
| ^^^^^^^^^^ | ||
|
||
error: register class `yreg` can only be used as a clobber, not as an input or output | ||
--> $DIR/bad-reg.rs:60:26 | ||
| | ||
LL | asm!("/* {} */", in(yreg) x); | ||
| ^^^^^^^^^^ | ||
|
||
error: register class `yreg` can only be used as a clobber, not as an input or output | ||
--> $DIR/bad-reg.rs:63:26 | ||
| | ||
LL | asm!("/* {} */", out(yreg) _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: cannot use register `r5`: g5 is reserved for system on SPARC32 | ||
--> $DIR/bad-reg.rs:38:18 | ||
| | ||
LL | asm!("", out("g5") _); | ||
| ^^^^^^^^^^^ | ||
|
||
error: type `i32` cannot be used with this register class | ||
--> $DIR/bad-reg.rs:54:26 | ||
| | ||
LL | asm!("", in("y") x); | ||
| ^ | ||
| | ||
= note: register class `yreg` supports these types: | ||
|
||
error: type `i32` cannot be used with this register class | ||
--> $DIR/bad-reg.rs:57:27 | ||
| | ||
LL | asm!("", out("y") x); | ||
| ^ | ||
| | ||
= note: register class `yreg` supports these types: | ||
|
||
error: type `i32` cannot be used with this register class | ||
--> $DIR/bad-reg.rs:60:35 | ||
| | ||
LL | asm!("/* {} */", in(yreg) x); | ||
| ^ | ||
| | ||
= note: register class `yreg` supports these types: | ||
|
||
error: aborting due to 15 previous errors | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.