diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-05-27 09:18:11 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-05-27 09:18:11 +0000 |
| commit | 4332c2fbbd47ecdcfb620a284254feed3367bec4 (patch) | |
| tree | cf2ee9a9fbf775b6ebdae164bba1dc41606e5275 /src/test | |
| parent | 6ba8da6aae5c0422b022b248799eb42244fae468 (diff) | |
| download | rust-4332c2fbbd47ecdcfb620a284254feed3367bec4.tar.gz rust-4332c2fbbd47ecdcfb620a284254feed3367bec4.zip | |
Update tests on aarch64
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/asm/aarch64/bad-reg.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/asm/aarch64/bad-reg.stderr | 34 | ||||
| -rw-r--r-- | src/test/ui/asm/aarch64/type-check-2-2.rs | 37 | ||||
| -rw-r--r-- | src/test/ui/asm/aarch64/type-check-2-2.stderr | 34 | ||||
| -rw-r--r-- | src/test/ui/asm/aarch64/type-check-2.rs | 17 | ||||
| -rw-r--r-- | src/test/ui/asm/aarch64/type-check-2.stderr | 82 | ||||
| -rw-r--r-- | src/test/ui/asm/aarch64/type-check-3.rs | 18 | ||||
| -rw-r--r-- | src/test/ui/asm/aarch64/type-check-3.stderr | 27 | ||||
| -rw-r--r-- | src/test/ui/asm/aarch64/type-check-4.rs | 32 | ||||
| -rw-r--r-- | src/test/ui/asm/aarch64/type-check-4.stderr | 27 |
10 files changed, 183 insertions, 127 deletions
diff --git a/src/test/ui/asm/aarch64/bad-reg.rs b/src/test/ui/asm/aarch64/bad-reg.rs index 1a314101916..2b6a9b71cd5 100644 --- a/src/test/ui/asm/aarch64/bad-reg.rs +++ b/src/test/ui/asm/aarch64/bad-reg.rs @@ -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 diff --git a/src/test/ui/asm/aarch64/bad-reg.stderr b/src/test/ui/asm/aarch64/bad-reg.stderr index e3316b85193..0ba627dac30 100644 --- a/src/test/ui/asm/aarch64/bad-reg.stderr +++ b/src/test/ui/asm/aarch64/bad-reg.stderr @@ -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 diff --git a/src/test/ui/asm/aarch64/type-check-2-2.rs b/src/test/ui/asm/aarch64/type-check-2-2.rs new file mode 100644 index 00000000000..e4d29754556 --- /dev/null +++ b/src/test/ui/asm/aarch64/type-check-2-2.rs @@ -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 + } +} diff --git a/src/test/ui/asm/aarch64/type-check-2-2.stderr b/src/test/ui/asm/aarch64/type-check-2-2.stderr new file mode 100644 index 00000000000..37bbe394994 --- /dev/null +++ b/src/test/ui/asm/aarch64/type-check-2-2.stderr @@ -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`. diff --git a/src/test/ui/asm/aarch64/type-check-2.rs b/src/test/ui/asm/aarch64/type-check-2.rs index 9e53a2e0c52..fdafe63c7b0 100644 --- a/src/test/ui/asm/aarch64/type-check-2.rs +++ b/src/test/ui/asm/aarch64/type-check-2.rs @@ -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; diff --git a/src/test/ui/asm/aarch64/type-check-2.stderr b/src/test/ui/asm/aarch64/type-check-2.stderr index 6047bed6e78..4b99652cd20 100644 --- a/src/test/ui/asm/aarch64/type-check-2.stderr +++ b/src/test/ui/asm/aarch64/type-check-2.stderr @@ -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: 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 +error: aborting due to 9 previous errors -Some errors have detailed explanations: E0381, E0596. -For more information about an error, try `rustc --explain E0381`. diff --git a/src/test/ui/asm/aarch64/type-check-3.rs b/src/test/ui/asm/aarch64/type-check-3.rs index 8cac18b8052..623f6593d79 100644 --- a/src/test/ui/asm/aarch64/type-check-3.rs +++ b/src/test/ui/asm/aarch64/type-check-3.rs @@ -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 diff --git a/src/test/ui/asm/aarch64/type-check-3.stderr b/src/test/ui/asm/aarch64/type-check-3.stderr index c31a62ae791..b320abdc01b 100644 --- a/src/test/ui/asm/aarch64/type-check-3.stderr +++ b/src/test/ui/asm/aarch64/type-check-3.stderr @@ -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[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 +error: aborting due to 6 previous errors; 10 warnings emitted -For more information about this error, try `rustc --explain E0013`. diff --git a/src/test/ui/asm/aarch64/type-check-4.rs b/src/test/ui/asm/aarch64/type-check-4.rs new file mode 100644 index 00000000000..bd23755c023 --- /dev/null +++ b/src/test/ui/asm/aarch64/type-check-4.rs @@ -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 diff --git a/src/test/ui/asm/aarch64/type-check-4.stderr b/src/test/ui/asm/aarch64/type-check-4.stderr new file mode 100644 index 00000000000..4837e647bea --- /dev/null +++ b/src/test/ui/asm/aarch64/type-check-4.stderr @@ -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`. |
