Add regression tests
This commit is contained in:
parent
5a6036a180
commit
c04b52ae9e
4 changed files with 62 additions and 0 deletions
20
tests/ui/asm/generic_const_simd_vec_len.rs
Normal file
20
tests/ui/asm/generic_const_simd_vec_len.rs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
//! This is a regression test to ensure that we emit a diagnostic pointing to the
|
||||||
|
//! reason the type was rejected in inline assembly.
|
||||||
|
|
||||||
|
//@ only-x86_64
|
||||||
|
|
||||||
|
#![feature(repr_simd)]
|
||||||
|
|
||||||
|
#[repr(simd)]
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
pub struct Foo<const C: usize>([u8; C]);
|
||||||
|
|
||||||
|
pub unsafe fn foo<const C: usize>(a: Foo<C>) {
|
||||||
|
std::arch::asm!(
|
||||||
|
"movaps {src}, {src}",
|
||||||
|
src = in(xmm_reg) a,
|
||||||
|
//~^ ERROR: cannot use value of type `Foo<C>` for inline assembly
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
10
tests/ui/asm/generic_const_simd_vec_len.stderr
Normal file
10
tests/ui/asm/generic_const_simd_vec_len.stderr
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
error: cannot use value of type `Foo<C>` for inline assembly
|
||||||
|
--> $DIR/generic_const_simd_vec_len.rs:15:27
|
||||||
|
|
|
||||||
|
LL | src = in(xmm_reg) a,
|
||||||
|
| ^
|
||||||
|
|
|
||||||
|
= note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
22
tests/ui/asm/named_const_simd_vec_len.rs
Normal file
22
tests/ui/asm/named_const_simd_vec_len.rs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
//! This is a regression test to ensure that we evaluate
|
||||||
|
//! SIMD vector length constants instead of assuming they are literals.
|
||||||
|
|
||||||
|
//@ only-x86_64
|
||||||
|
|
||||||
|
#![feature(repr_simd)]
|
||||||
|
|
||||||
|
const C: usize = 16;
|
||||||
|
|
||||||
|
#[repr(simd)]
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
pub struct Foo([u8; C]);
|
||||||
|
|
||||||
|
pub unsafe fn foo(a: Foo) {
|
||||||
|
std::arch::asm!(
|
||||||
|
"movaps {src}, {src}",
|
||||||
|
src = in(xmm_reg) a,
|
||||||
|
//~^ ERROR: cannot use value of type `Foo` for inline assembly
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
10
tests/ui/asm/named_const_simd_vec_len.stderr
Normal file
10
tests/ui/asm/named_const_simd_vec_len.stderr
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
error: cannot use value of type `Foo` for inline assembly
|
||||||
|
--> $DIR/named_const_simd_vec_len.rs:17:27
|
||||||
|
|
|
||||||
|
LL | src = in(xmm_reg) a,
|
||||||
|
| ^
|
||||||
|
|
|
||||||
|
= note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue