1
Fork 0

Add regression tests

This commit is contained in:
Oli Scherer 2024-12-09 09:51:55 +00:00
parent 5a6036a180
commit c04b52ae9e
4 changed files with 62 additions and 0 deletions

View 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() {}

View 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

View 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() {}

View 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