-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|