diff --git a/tests/ui/scalable-vectors/debuginfo-does-not-spill.rs b/tests/ui/scalable-vectors/debuginfo-does-not-spill.rs new file mode 100644 index 000000000000..f7cc455dc8ef --- /dev/null +++ b/tests/ui/scalable-vectors/debuginfo-does-not-spill.rs @@ -0,0 +1,39 @@ +// Compiletest for rust-lang/rust#150419: Do not spill operands to the stack when +// creating debuginfo for AArch64 SVE predicates `` where `N != 16` +//@ edition: 2021 +//@ only-aarch64 +//@ build-pass +//@ compile-flags: -C debuginfo=2 -C target-feature=+sve + +#![crate_type = "lib"] +#![allow(internal_features)] +#![feature(rustc_attrs, link_llvm_intrinsics)] + +#[rustc_scalable_vector(16)] +#[allow(non_camel_case_types)] +#[repr(transparent)] +pub struct svbool_t(bool); + +#[rustc_scalable_vector(4)] +#[allow(non_camel_case_types)] +#[repr(transparent)] +pub struct svbool4_t(bool); + +impl std::convert::Into for svbool4_t { + #[inline(always)] + fn into(self) -> svbool_t { + unsafe extern "C" { + #[link_name = "llvm.aarch64.sve.convert.to.svbool.nxv4i1"] + fn convert_to_svbool(b: svbool4_t) -> svbool_t; + } + unsafe { convert_to_svbool(self) } + } +} + +pub fn svwhilelt_b32_u64(op1: u64, op2: u64) -> svbool_t { + unsafe extern "C" { + #[link_name = "llvm.aarch64.sve.whilelo.nxv4i1.u64"] + fn _svwhilelt_b32_u64(op1: u64, op2: u64) -> svbool4_t; + } + unsafe { _svwhilelt_b32_u64(op1, op2) }.into() +}