Update tests on aarch64

This commit is contained in:
Oli Scherer 2022-05-27 09:18:11 +00:00
parent 6ba8da6aae
commit 4332c2fbbd
10 changed files with 183 additions and 127 deletions

View File

@ -36,9 +36,11 @@ fn main() {
asm!("", in("p0") foo);
//~^ ERROR register class `preg` can only be used as a clobber, not as an input or output
//~| ERROR type `i32` cannot be used with this register class
asm!("", out("p0") _);
asm!("{}", in(preg) foo);
//~^ ERROR register class `preg` can only be used as a clobber, not as an input or output
//~| ERROR type `i32` cannot be used with this register class
asm!("{}", out(preg) _);
//~^ ERROR register class `preg` can only be used as a clobber, not as an input or output

View File

@ -87,19 +87,19 @@ LL | asm!("", in("p0") foo);
| ^^^^^^^^^^^^
error: register class `preg` can only be used as a clobber, not as an input or output
--> $DIR/bad-reg.rs:40:20
--> $DIR/bad-reg.rs:41:20
|
LL | asm!("{}", in(preg) foo);
| ^^^^^^^^^^^^
error: register class `preg` can only be used as a clobber, not as an input or output
--> $DIR/bad-reg.rs:42:20
--> $DIR/bad-reg.rs:44:20
|
LL | asm!("{}", out(preg) _);
| ^^^^^^^^^^^
error: register `x0` conflicts with register `x0`
--> $DIR/bad-reg.rs:48:32
--> $DIR/bad-reg.rs:50:32
|
LL | asm!("", in("x0") foo, in("w0") bar);
| ------------ ^^^^^^^^^^^^ register `x0`
@ -107,7 +107,7 @@ LL | asm!("", in("x0") foo, in("w0") bar);
| register `x0`
error: register `x0` conflicts with register `x0`
--> $DIR/bad-reg.rs:50:32
--> $DIR/bad-reg.rs:52:32
|
LL | asm!("", in("x0") foo, out("x0") bar);
| ------------ ^^^^^^^^^^^^^ register `x0`
@ -115,13 +115,13 @@ LL | asm!("", in("x0") foo, out("x0") bar);
| register `x0`
|
help: use `lateout` instead of `out` to avoid conflict
--> $DIR/bad-reg.rs:50:18
--> $DIR/bad-reg.rs:52:18
|
LL | asm!("", in("x0") foo, out("x0") bar);
| ^^^^^^^^^^^^
error: register `v0` conflicts with register `v0`
--> $DIR/bad-reg.rs:53:32
--> $DIR/bad-reg.rs:55:32
|
LL | asm!("", in("v0") foo, in("q0") bar);
| ------------ ^^^^^^^^^^^^ register `v0`
@ -129,7 +129,7 @@ LL | asm!("", in("v0") foo, in("q0") bar);
| register `v0`
error: register `v0` conflicts with register `v0`
--> $DIR/bad-reg.rs:55:32
--> $DIR/bad-reg.rs:57:32
|
LL | asm!("", in("v0") foo, out("q0") bar);
| ------------ ^^^^^^^^^^^^^ register `v0`
@ -137,10 +137,26 @@ LL | asm!("", in("v0") foo, out("q0") bar);
| register `v0`
|
help: use `lateout` instead of `out` to avoid conflict
--> $DIR/bad-reg.rs:55:18
--> $DIR/bad-reg.rs:57:18
|
LL | asm!("", in("v0") foo, out("q0") bar);
| ^^^^^^^^^^^^
error: aborting due to 18 previous errors
error: type `i32` cannot be used with this register class
--> $DIR/bad-reg.rs:37:27
|
LL | asm!("", in("p0") foo);
| ^^^
|
= note: register class `preg` supports these types:
error: type `i32` cannot be used with this register class
--> $DIR/bad-reg.rs:41:29
|
LL | asm!("{}", in(preg) foo);
| ^^^
|
= note: register class `preg` supports these types:
error: aborting due to 20 previous errors

View File

@ -0,0 +1,37 @@
// only-aarch64
#![feature(repr_simd, never_type, asm_sym)]
use std::arch::{asm, global_asm};
#[repr(simd)]
#[derive(Clone, Copy)]
struct SimdType(f32, f32, f32, f32);
#[repr(simd)]
struct SimdNonCopy(f32, f32, f32, f32);
fn main() {
unsafe {
// Inputs must be initialized
let x: u64;
asm!("{}", in(reg) x);
//~^ ERROR use of possibly-uninitialized variable: `x`
let mut y: u64;
asm!("{}", inout(reg) y);
//~^ ERROR use of possibly-uninitialized variable: `y`
let _ = y;
// Outputs require mutable places
let v: Vec<u64> = vec![0, 1, 2];
asm!("{}", in(reg) v[0]);
asm!("{}", out(reg) v[0]);
//~^ ERROR cannot borrow `v` as mutable, as it is not declared as mutable
asm!("{}", inout(reg) v[0]);
//~^ ERROR cannot borrow `v` as mutable, as it is not declared as mutable
// Sym operands must point to a function or static
}
}

View File

@ -0,0 +1,34 @@
error[E0381]: use of possibly-uninitialized variable: `x`
--> $DIR/type-check-2-2.rs:19:28
|
LL | asm!("{}", in(reg) x);
| ^ use of possibly-uninitialized `x`
error[E0381]: use of possibly-uninitialized variable: `y`
--> $DIR/type-check-2-2.rs:22:9
|
LL | asm!("{}", inout(reg) y);
| ^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly-uninitialized `y`
error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
--> $DIR/type-check-2-2.rs:30:29
|
LL | let v: Vec<u64> = vec![0, 1, 2];
| - help: consider changing this to be mutable: `mut v`
LL | asm!("{}", in(reg) v[0]);
LL | asm!("{}", out(reg) v[0]);
| ^ cannot borrow as mutable
error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
--> $DIR/type-check-2-2.rs:32:31
|
LL | let v: Vec<u64> = vec![0, 1, 2];
| - help: consider changing this to be mutable: `mut v`
...
LL | asm!("{}", inout(reg) v[0]);
| ^ cannot borrow as mutable
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0381, E0596.
For more information about an error, try `rustc --explain E0381`.

View File

@ -15,23 +15,6 @@ fn main() {
unsafe {
// Inputs must be initialized
let x: u64;
asm!("{}", in(reg) x);
//~^ ERROR use of possibly-uninitialized variable: `x`
let mut y: u64;
asm!("{}", inout(reg) y);
//~^ ERROR use of possibly-uninitialized variable: `y`
let _ = y;
// Outputs require mutable places
let v: Vec<u64> = vec![0, 1, 2];
asm!("{}", in(reg) v[0]);
asm!("{}", out(reg) v[0]);
//~^ ERROR cannot borrow `v` as mutable, as it is not declared as mutable
asm!("{}", inout(reg) v[0]);
//~^ ERROR cannot borrow `v` as mutable, as it is not declared as mutable
// Sym operands must point to a function or static
const C: i32 = 0;

View File

@ -1,13 +1,29 @@
error: invalid `sym` operand
--> $DIR/type-check-2.rs:75:19
|
LL | global_asm!("{}", sym C);
| ^^^^^ is an `i32`
|
= help: `sym` operands must refer to either a function or a static
error: invalid `sym` operand
--> $DIR/type-check-2.rs:24:20
|
LL | asm!("{}", sym C);
| ^^^^^ is an `i32`
|
= help: `sym` operands must refer to either a function or a static
error: arguments for inline assembly must be copyable
--> $DIR/type-check-2.rs:46:31
--> $DIR/type-check-2.rs:29:31
|
LL | asm!("{:v}", in(vreg) SimdNonCopy(0.0, 0.0, 0.0, 0.0));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `SimdNonCopy` does not implement the Copy trait
error: cannot use value of type `[closure@$DIR/type-check-2.rs:58:28: 58:38]` for inline assembly
--> $DIR/type-check-2.rs:58:28
error: cannot use value of type `[closure@$DIR/type-check-2.rs:41:28: 41:38]` for inline assembly
--> $DIR/type-check-2.rs:41:28
|
LL | asm!("{}", in(reg) |x: i32| x);
| ^^^^^^^^^^
@ -15,7 +31,7 @@ LL | asm!("{}", in(reg) |x: i32| x);
= note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
error: cannot use value of type `Vec<i32>` for inline assembly
--> $DIR/type-check-2.rs:60:28
--> $DIR/type-check-2.rs:43:28
|
LL | asm!("{}", in(reg) vec![0]);
| ^^^^^^^
@ -24,7 +40,7 @@ LL | asm!("{}", in(reg) vec![0]);
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot use value of type `(i32, i32, i32)` for inline assembly
--> $DIR/type-check-2.rs:62:28
--> $DIR/type-check-2.rs:45:28
|
LL | asm!("{}", in(reg) (1, 2, 3));
| ^^^^^^^^^
@ -32,7 +48,7 @@ LL | asm!("{}", in(reg) (1, 2, 3));
= note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
error: cannot use value of type `[i32; 3]` for inline assembly
--> $DIR/type-check-2.rs:64:28
--> $DIR/type-check-2.rs:47:28
|
LL | asm!("{}", in(reg) [1, 2, 3]);
| ^^^^^^^^^
@ -40,7 +56,7 @@ LL | asm!("{}", in(reg) [1, 2, 3]);
= note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
error: cannot use value of type `fn() {main}` for inline assembly
--> $DIR/type-check-2.rs:72:31
--> $DIR/type-check-2.rs:55:31
|
LL | asm!("{}", inout(reg) f);
| ^
@ -48,60 +64,12 @@ LL | asm!("{}", inout(reg) f);
= note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
error: cannot use value of type `&mut i32` for inline assembly
--> $DIR/type-check-2.rs:75:31
--> $DIR/type-check-2.rs:58:31
|
LL | asm!("{}", inout(reg) r);
| ^
|
= note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
error: invalid `sym` operand
--> $DIR/type-check-2.rs:41:20
|
LL | asm!("{}", sym C);
| ^^^^^ is an `i32`
|
= help: `sym` operands must refer to either a function or a static
error: aborting due to 9 previous errors
error: invalid `sym` operand
--> $DIR/type-check-2.rs:92:19
|
LL | global_asm!("{}", sym C);
| ^^^^^ is an `i32`
|
= help: `sym` operands must refer to either a function or a static
error[E0381]: use of possibly-uninitialized variable: `x`
--> $DIR/type-check-2.rs:19:28
|
LL | asm!("{}", in(reg) x);
| ^ use of possibly-uninitialized `x`
error[E0381]: use of possibly-uninitialized variable: `y`
--> $DIR/type-check-2.rs:22:9
|
LL | asm!("{}", inout(reg) y);
| ^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly-uninitialized `y`
error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
--> $DIR/type-check-2.rs:30:29
|
LL | let v: Vec<u64> = vec![0, 1, 2];
| - help: consider changing this to be mutable: `mut v`
LL | asm!("{}", in(reg) v[0]);
LL | asm!("{}", out(reg) v[0]);
| ^ cannot borrow as mutable
error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
--> $DIR/type-check-2.rs:32:31
|
LL | let v: Vec<u64> = vec![0, 1, 2];
| - help: consider changing this to be mutable: `mut v`
...
LL | asm!("{}", inout(reg) v[0]);
| ^ cannot borrow as mutable
error: aborting due to 13 previous errors
Some errors have detailed explanations: E0381, E0596.
For more information about an error, try `rustc --explain E0381`.

View File

@ -95,21 +95,3 @@ fn main() {
asm!("{:x}", inout(reg) main => val_u64);
}
}
// Constants must be... constant
static S: i32 = 1;
const fn const_foo(x: i32) -> i32 {
x
}
const fn const_bar<T>(x: T) -> T {
x
}
global_asm!("{}", const S);
//~^ ERROR constants cannot refer to statics
global_asm!("{}", const const_foo(0));
global_asm!("{}", const const_foo(S));
//~^ ERROR constants cannot refer to statics
global_asm!("{}", const const_bar(0));
global_asm!("{}", const const_bar(S));
//~^ ERROR constants cannot refer to statics

View File

@ -143,30 +143,5 @@ LL | asm!("{:x}", inout(reg) main => val_u32);
|
= note: asm inout arguments must have the same type, unless they are both pointers or integers of the same size
error[E0013]: constants cannot refer to statics
--> $DIR/type-check-3.rs:108:25
|
LL | global_asm!("{}", const S);
| ^
|
= help: consider extracting the value of the `static` to a `const`, and referring to that
error: aborting due to 6 previous errors; 10 warnings emitted
error[E0013]: constants cannot refer to statics
--> $DIR/type-check-3.rs:111:35
|
LL | global_asm!("{}", const const_foo(S));
| ^
|
= help: consider extracting the value of the `static` to a `const`, and referring to that
error[E0013]: constants cannot refer to statics
--> $DIR/type-check-3.rs:114:35
|
LL | global_asm!("{}", const const_bar(S));
| ^
|
= help: consider extracting the value of the `static` to a `const`, and referring to that
error: aborting due to 9 previous errors; 10 warnings emitted
For more information about this error, try `rustc --explain E0013`.

View File

@ -0,0 +1,32 @@
// only-aarch64
// compile-flags: -C target-feature=+neon
#![feature(repr_simd, stdsimd, asm_const)]
use std::arch::aarch64::float64x2_t;
use std::arch::{asm, global_asm};
#[repr(simd)]
#[derive(Copy, Clone)]
struct Simd256bit(f64, f64, f64, f64);
fn main() {
}
// Constants must be... constant
static S: i32 = 1;
const fn const_foo(x: i32) -> i32 {
x
}
const fn const_bar<T>(x: T) -> T {
x
}
global_asm!("{}", const S);
//~^ ERROR constants cannot refer to statics
global_asm!("{}", const const_foo(0));
global_asm!("{}", const const_foo(S));
//~^ ERROR constants cannot refer to statics
global_asm!("{}", const const_bar(0));
global_asm!("{}", const const_bar(S));
//~^ ERROR constants cannot refer to statics

View File

@ -0,0 +1,27 @@
error[E0013]: constants cannot refer to statics
--> $DIR/type-check-4.rs:25:25
|
LL | global_asm!("{}", const S);
| ^
|
= help: consider extracting the value of the `static` to a `const`, and referring to that
error[E0013]: constants cannot refer to statics
--> $DIR/type-check-4.rs:28:35
|
LL | global_asm!("{}", const const_foo(S));
| ^
|
= help: consider extracting the value of the `static` to a `const`, and referring to that
error[E0013]: constants cannot refer to statics
--> $DIR/type-check-4.rs:31:35
|
LL | global_asm!("{}", const const_bar(S));
| ^
|
= help: consider extracting the value of the `static` to a `const`, and referring to that
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0013`.