Skip to content

Commit c04b52a

Browse files
committed
Add regression tests
1 parent 5a6036a commit c04b52a

4 files changed

Lines changed: 62 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//! This is a regression test to ensure that we emit a diagnostic pointing to the
2+
//! reason the type was rejected in inline assembly.
3+
4+
//@ only-x86_64
5+
6+
#![feature(repr_simd)]
7+
8+
#[repr(simd)]
9+
#[derive(Copy,Clone)]
10+
pubstructFoo<constC:usize>([u8;C]);
11+
12+
pubunsafefnfoo<constC:usize>(a:Foo<C>){
13+
std::arch::asm!(
14+
"movaps {src}, {src}",
15+
src = in(xmm_reg) a,
16+
//~^ ERROR: cannot use value of type `Foo<C>` for inline assembly
17+
);
18+
}
19+
20+
fnmain(){}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: cannot use value of type `Foo<C>` for inline assembly
2+
--> $DIR/generic_const_simd_vec_len.rs:15:27
3+
|
4+
LL | src = in(xmm_reg) a,
5+
| ^
6+
|
7+
= note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
8+
9+
error: aborting due to 1 previous error
10+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//! This is a regression test to ensure that we evaluate
2+
//! SIMD vector length constants instead of assuming they are literals.
3+
4+
//@ only-x86_64
5+
6+
#![feature(repr_simd)]
7+
8+
constC:usize = 16;
9+
10+
#[repr(simd)]
11+
#[derive(Copy,Clone)]
12+
pubstructFoo([u8;C]);
13+
14+
pubunsafefnfoo(a:Foo){
15+
std::arch::asm!(
16+
"movaps {src}, {src}",
17+
src = in(xmm_reg) a,
18+
//~^ ERROR: cannot use value of type `Foo` for inline assembly
19+
);
20+
}
21+
22+
fnmain(){}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: cannot use value of type `Foo` for inline assembly
2+
--> $DIR/named_const_simd_vec_len.rs:17:27
3+
|
4+
LL | src = in(xmm_reg) a,
5+
| ^
6+
|
7+
= note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
8+
9+
error: aborting due to 1 previous error
10+

0 commit comments

Comments
 (0)