-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiler: Fix arm32 asm issues by hierarchically sorting reg classes
- Loading branch information
1 parent
a0f01c3
commit 0d8f734
Showing
2 changed files
with
73 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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 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,33 @@ | ||
//@ build-pass | ||
//@ compile-flags: --target=armv7-unknown-linux-gnueabihf | ||
//@ needs-llvm-components: arm | ||
#![feature(no_core, rustc_attrs, decl_macro, lang_items)] | ||
#![crate_type = "rlib"] | ||
#![no_std] | ||
#![no_core] | ||
|
||
// We accidentally classified "d0"..="d15" as dregs, even though they are in dreg_low16, | ||
// and thus didn't compile them on platforms with only 16 dregs. | ||
// Highlighted in https://github.com/rust-lang/rust/issues/126797 | ||
|
||
#[lang = "sized"] | ||
trait Sized {} | ||
|
||
#[lang = "copy"] | ||
trait Copy {} | ||
|
||
impl Copy for f64 {} | ||
|
||
#[rustc_builtin_macro] | ||
pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) { | ||
/* compiler built-in */ | ||
} | ||
|
||
|
||
fn f(x: f64) -> f64 { | ||
let out: f64; | ||
unsafe { | ||
asm!("vmov.f64 d1, d0", out("d1") out, in("d0") x); | ||
} | ||
out | ||
} |