-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #126849 - workingjubilee:correctly-classify-arm-low-d…
…regs, r=Amanieu Fix 32-bit Arm reg classes by hierarchically sorting them We were rejecting legal `asm!` because we were asking for the "greatest" feature that includes a register class, instead of the "least" feature that includes a register class. This was only revealed on certain 32-bit Arm targets because not all have the same register limitations. This is a somewhat hacky solution, but other solutions would require potentially rearchitecting how the internals of parsing or rejecting register classes work for all targets. Fixes #126797 r? ``@Amanieu``
- Loading branch information
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 | ||
} |