2021-06-24 09:01:49 -05:00
|
|
|
// only-aarch64
|
Fold aarch64 feature +fp into +neon
Arm's FEAT_FP and Feat_AdvSIMD describe the same thing on AArch64:
The Neon unit, which handles both floating point and SIMD instructions.
Moreover, a configuration for AArch64 must include both or neither.
Arm says "entirely proprietary" toolchains may omit floating point:
https://developer.arm.com/documentation/102374/0101/Data-processing---floating-point
In the Programmer's Guide for Armv8-A, Arm says AArch64 can have
both FP and Neon or neither in custom implementations:
https://developer.arm.com/documentation/den0024/a/AArch64-Floating-point-and-NEON
In "Bare metal boot code for Armv8-A", enabling Neon and FP
is just disabling the same trap flag:
https://developer.arm.com/documentation/dai0527/a
In an unlikely future where "Neon and FP" become unrelated,
we can add "[+-]fp" as its own feature flag.
Until then, we can simplify programming with Rust on AArch64 by
folding both into "[+-]neon", which is valid as it supersets both.
"[+-]neon" is retained for niche uses such as firmware, kernels,
"I just hate floats", and so on.
2021-12-03 19:56:59 -06:00
|
|
|
// compile-flags: -C target-feature=+neon
|
2021-06-24 09:01:49 -05:00
|
|
|
|
2022-10-17 16:38:37 -05:00
|
|
|
#![feature(asm_const)]
|
2021-12-09 18:15:33 -06:00
|
|
|
|
|
|
|
use std::arch::asm;
|
2021-06-24 09:01:49 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut foo = 0;
|
|
|
|
let mut bar = 0;
|
|
|
|
unsafe {
|
|
|
|
// Bad register/register class
|
|
|
|
|
|
|
|
asm!("{}", in(foo) foo);
|
|
|
|
//~^ ERROR invalid register class `foo`: unknown register class
|
|
|
|
asm!("", in("foo") foo);
|
|
|
|
//~^ ERROR invalid register `foo`: unknown register
|
|
|
|
asm!("{:z}", in(reg) foo);
|
|
|
|
//~^ ERROR invalid asm template modifier for this register class
|
|
|
|
asm!("{:r}", in(vreg) foo);
|
|
|
|
//~^ ERROR invalid asm template modifier for this register class
|
|
|
|
asm!("{:r}", in(vreg_low16) foo);
|
|
|
|
//~^ ERROR invalid asm template modifier for this register class
|
|
|
|
asm!("{:a}", const 0);
|
|
|
|
//~^ ERROR asm template modifiers are not allowed for `const` arguments
|
|
|
|
asm!("{:a}", sym main);
|
|
|
|
//~^ ERROR asm template modifiers are not allowed for `sym` arguments
|
|
|
|
asm!("", in("x29") foo);
|
|
|
|
//~^ ERROR invalid register `x29`: the frame pointer cannot be used as an operand
|
|
|
|
asm!("", in("sp") foo);
|
|
|
|
//~^ ERROR invalid register `sp`: the stack pointer cannot be used as an operand
|
|
|
|
asm!("", in("xzr") foo);
|
|
|
|
//~^ ERROR invalid register `xzr`: the zero register cannot be used as an operand
|
|
|
|
asm!("", in("x19") foo);
|
|
|
|
//~^ ERROR invalid register `x19`: x19 is used internally by LLVM and cannot be used as an operand for inline asm
|
|
|
|
|
|
|
|
asm!("", in("p0") foo);
|
|
|
|
//~^ ERROR register class `preg` can only be used as a clobber, not as an input or output
|
2022-05-27 04:18:11 -05:00
|
|
|
//~| ERROR type `i32` cannot be used with this register class
|
2021-06-24 09:01:49 -05:00
|
|
|
asm!("", out("p0") _);
|
|
|
|
asm!("{}", in(preg) foo);
|
|
|
|
//~^ ERROR register class `preg` can only be used as a clobber, not as an input or output
|
2022-05-27 04:18:11 -05:00
|
|
|
//~| ERROR type `i32` cannot be used with this register class
|
2021-06-24 09:01:49 -05:00
|
|
|
asm!("{}", out(preg) _);
|
|
|
|
//~^ ERROR register class `preg` can only be used as a clobber, not as an input or output
|
|
|
|
|
|
|
|
// Explicit register conflicts
|
|
|
|
// (except in/lateout which don't conflict)
|
|
|
|
|
|
|
|
asm!("", in("x0") foo, in("w0") bar);
|
|
|
|
//~^ ERROR register `x0` conflicts with register `x0`
|
|
|
|
asm!("", in("x0") foo, out("x0") bar);
|
|
|
|
//~^ ERROR register `x0` conflicts with register `x0`
|
|
|
|
asm!("", in("w0") foo, lateout("w0") bar);
|
|
|
|
asm!("", in("v0") foo, in("q0") bar);
|
|
|
|
//~^ ERROR register `v0` conflicts with register `v0`
|
|
|
|
asm!("", in("v0") foo, out("q0") bar);
|
|
|
|
//~^ ERROR register `v0` conflicts with register `v0`
|
|
|
|
asm!("", in("v0") foo, lateout("q0") bar);
|
|
|
|
}
|
|
|
|
}
|