diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/asm/x86_64 | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/asm/x86_64')
33 files changed, 0 insertions, 2660 deletions
diff --git a/src/test/ui/asm/x86_64/bad-clobber-abi.rs b/src/test/ui/asm/x86_64/bad-clobber-abi.rs deleted file mode 100644 index ddcd2065b..000000000 --- a/src/test/ui/asm/x86_64/bad-clobber-abi.rs +++ /dev/null @@ -1,32 +0,0 @@ -// needs-asm-support -// only-x86_64 - -use std::arch::asm; - -// checks various modes of failure for the `clobber_abi` argument (after parsing) - -fn main() { - unsafe { - asm!("", clobber_abi("C")); - asm!("", clobber_abi("foo")); - //~^ ERROR invalid ABI for `clobber_abi` - asm!("", clobber_abi("C", "foo")); - //~^ ERROR invalid ABI for `clobber_abi` - asm!("", clobber_abi("C", "C")); - //~^ ERROR `C` ABI specified multiple times - asm!("", clobber_abi("win64", "sysv64")); - asm!("", clobber_abi("win64", "efiapi")); - //~^ ERROR `win64` ABI specified multiple times - asm!("", clobber_abi("C", "foo", "C")); - //~^ ERROR invalid ABI for `clobber_abi` - //~| ERROR `C` ABI specified multiple times - asm!("", clobber_abi("win64", "foo", "efiapi")); - //~^ ERROR invalid ABI for `clobber_abi` - //~| ERROR `win64` ABI specified multiple times - asm!("", clobber_abi("C"), clobber_abi("C")); - //~^ ERROR `C` ABI specified multiple times - asm!("", clobber_abi("win64"), clobber_abi("sysv64")); - asm!("", clobber_abi("win64"), clobber_abi("efiapi")); - //~^ ERROR `win64` ABI specified multiple times - } -} diff --git a/src/test/ui/asm/x86_64/bad-clobber-abi.stderr b/src/test/ui/asm/x86_64/bad-clobber-abi.stderr deleted file mode 100644 index 46e91a395..000000000 --- a/src/test/ui/asm/x86_64/bad-clobber-abi.stderr +++ /dev/null @@ -1,88 +0,0 @@ -error: invalid ABI for `clobber_abi` - --> $DIR/bad-clobber-abi.rs:11:18 - | -LL | asm!("", clobber_abi("foo")); - | ^^^^^^^^^^^^^^^^^^ - | - = note: the following ABIs are supported on this target: `C`, `system`, `efiapi`, `win64`, `sysv64` - -error: invalid ABI for `clobber_abi` - --> $DIR/bad-clobber-abi.rs:13:35 - | -LL | asm!("", clobber_abi("C", "foo")); - | ^^^^^ - | - = note: the following ABIs are supported on this target: `C`, `system`, `efiapi`, `win64`, `sysv64` - -error: `C` ABI specified multiple times - --> $DIR/bad-clobber-abi.rs:15:35 - | -LL | asm!("", clobber_abi("C", "C")); - | --- ^^^ - | | - | previously specified here - -error: `win64` ABI specified multiple times - --> $DIR/bad-clobber-abi.rs:18:39 - | -LL | asm!("", clobber_abi("win64", "efiapi")); - | ------- ^^^^^^^^ - | | - | previously specified here - | - = note: these ABIs are equivalent on the current target - -error: invalid ABI for `clobber_abi` - --> $DIR/bad-clobber-abi.rs:20:35 - | -LL | asm!("", clobber_abi("C", "foo", "C")); - | ^^^^^ - | - = note: the following ABIs are supported on this target: `C`, `system`, `efiapi`, `win64`, `sysv64` - -error: `C` ABI specified multiple times - --> $DIR/bad-clobber-abi.rs:20:42 - | -LL | asm!("", clobber_abi("C", "foo", "C")); - | --- ^^^ - | | - | previously specified here - -error: invalid ABI for `clobber_abi` - --> $DIR/bad-clobber-abi.rs:23:39 - | -LL | asm!("", clobber_abi("win64", "foo", "efiapi")); - | ^^^^^ - | - = note: the following ABIs are supported on this target: `C`, `system`, `efiapi`, `win64`, `sysv64` - -error: `win64` ABI specified multiple times - --> $DIR/bad-clobber-abi.rs:23:46 - | -LL | asm!("", clobber_abi("win64", "foo", "efiapi")); - | ------- ^^^^^^^^ - | | - | previously specified here - | - = note: these ABIs are equivalent on the current target - -error: `C` ABI specified multiple times - --> $DIR/bad-clobber-abi.rs:26:36 - | -LL | asm!("", clobber_abi("C"), clobber_abi("C")); - | ---------------- ^^^^^^^^^^^^^^^^ - | | - | previously specified here - -error: `win64` ABI specified multiple times - --> $DIR/bad-clobber-abi.rs:29:40 - | -LL | asm!("", clobber_abi("win64"), clobber_abi("efiapi")); - | -------------------- ^^^^^^^^^^^^^^^^^^^^^ - | | - | previously specified here - | - = note: these ABIs are equivalent on the current target - -error: aborting due to 10 previous errors - diff --git a/src/test/ui/asm/x86_64/bad-options.rs b/src/test/ui/asm/x86_64/bad-options.rs deleted file mode 100644 index f7c2cd6c5..000000000 --- a/src/test/ui/asm/x86_64/bad-options.rs +++ /dev/null @@ -1,42 +0,0 @@ -// only-x86_64 - -use std::arch::{asm, global_asm}; - -fn main() { - let mut foo = 0; - unsafe { - asm!("", options(nomem, readonly)); - //~^ ERROR the `nomem` and `readonly` options are mutually exclusive - asm!("", options(pure, nomem, noreturn)); - //~^ ERROR the `pure` and `noreturn` options are mutually exclusive - //~^^ ERROR asm with the `pure` option must have at least one output - asm!("{}", in(reg) foo, options(pure, nomem)); - //~^ ERROR asm with the `pure` option must have at least one output - asm!("{}", out(reg) foo, options(noreturn)); - //~^ ERROR asm outputs are not allowed with the `noreturn` option - } - - unsafe { - asm!("", clobber_abi("foo")); - //~^ ERROR invalid ABI for `clobber_abi` - asm!("{}", out(reg) foo, clobber_abi("C")); - //~^ ERROR asm with `clobber_abi` must specify explicit registers for outputs - asm!("{}", out(reg) foo, clobber_abi("C"), clobber_abi("C")); - //~^ ERROR asm with `clobber_abi` must specify explicit registers for outputs - //~| ERROR `C` ABI specified multiple times - asm!("", out("eax") foo, clobber_abi("C")); - } -} - -global_asm!("", options(nomem)); -//~^ ERROR expected one of -global_asm!("", options(readonly)); -//~^ ERROR expected one of -global_asm!("", options(noreturn)); -//~^ ERROR expected one of -global_asm!("", options(pure)); -//~^ ERROR expected one of -global_asm!("", options(nostack)); -//~^ ERROR expected one of -global_asm!("", options(preserves_flags)); -//~^ ERROR expected one of diff --git a/src/test/ui/asm/x86_64/bad-options.stderr b/src/test/ui/asm/x86_64/bad-options.stderr deleted file mode 100644 index e2351840e..000000000 --- a/src/test/ui/asm/x86_64/bad-options.stderr +++ /dev/null @@ -1,101 +0,0 @@ -error: the `nomem` and `readonly` options are mutually exclusive - --> $DIR/bad-options.rs:8:18 - | -LL | asm!("", options(nomem, readonly)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -error: the `pure` and `noreturn` options are mutually exclusive - --> $DIR/bad-options.rs:10:18 - | -LL | asm!("", options(pure, nomem, noreturn)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: asm with the `pure` option must have at least one output - --> $DIR/bad-options.rs:10:18 - | -LL | asm!("", options(pure, nomem, noreturn)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: asm with the `pure` option must have at least one output - --> $DIR/bad-options.rs:13:33 - | -LL | asm!("{}", in(reg) foo, options(pure, nomem)); - | ^^^^^^^^^^^^^^^^^^^^ - -error: asm outputs are not allowed with the `noreturn` option - --> $DIR/bad-options.rs:15:20 - | -LL | asm!("{}", out(reg) foo, options(noreturn)); - | ^^^^^^^^^^^^ - -error: asm with `clobber_abi` must specify explicit registers for outputs - --> $DIR/bad-options.rs:22:20 - | -LL | asm!("{}", out(reg) foo, clobber_abi("C")); - | ^^^^^^^^^^^^ ---------------- clobber_abi - | | - | generic outputs - -error: asm with `clobber_abi` must specify explicit registers for outputs - --> $DIR/bad-options.rs:24:20 - | -LL | asm!("{}", out(reg) foo, clobber_abi("C"), clobber_abi("C")); - | ^^^^^^^^^^^^ ---------------- ---------------- clobber_abi - | | | - | | clobber_abi - | generic outputs - -error: expected one of `)`, `att_syntax`, or `raw`, found `nomem` - --> $DIR/bad-options.rs:31:25 - | -LL | global_asm!("", options(nomem)); - | ^^^^^ expected one of `)`, `att_syntax`, or `raw` - -error: expected one of `)`, `att_syntax`, or `raw`, found `readonly` - --> $DIR/bad-options.rs:33:25 - | -LL | global_asm!("", options(readonly)); - | ^^^^^^^^ expected one of `)`, `att_syntax`, or `raw` - -error: expected one of `)`, `att_syntax`, or `raw`, found `noreturn` - --> $DIR/bad-options.rs:35:25 - | -LL | global_asm!("", options(noreturn)); - | ^^^^^^^^ expected one of `)`, `att_syntax`, or `raw` - -error: expected one of `)`, `att_syntax`, or `raw`, found `pure` - --> $DIR/bad-options.rs:37:25 - | -LL | global_asm!("", options(pure)); - | ^^^^ expected one of `)`, `att_syntax`, or `raw` - -error: expected one of `)`, `att_syntax`, or `raw`, found `nostack` - --> $DIR/bad-options.rs:39:25 - | -LL | global_asm!("", options(nostack)); - | ^^^^^^^ expected one of `)`, `att_syntax`, or `raw` - -error: expected one of `)`, `att_syntax`, or `raw`, found `preserves_flags` - --> $DIR/bad-options.rs:41:25 - | -LL | global_asm!("", options(preserves_flags)); - | ^^^^^^^^^^^^^^^ expected one of `)`, `att_syntax`, or `raw` - -error: invalid ABI for `clobber_abi` - --> $DIR/bad-options.rs:20:18 - | -LL | asm!("", clobber_abi("foo")); - | ^^^^^^^^^^^^^^^^^^ - | - = note: the following ABIs are supported on this target: `C`, `system`, `efiapi`, `win64`, `sysv64` - -error: `C` ABI specified multiple times - --> $DIR/bad-options.rs:24:52 - | -LL | asm!("{}", out(reg) foo, clobber_abi("C"), clobber_abi("C")); - | ---------------- ^^^^^^^^^^^^^^^^ - | | - | previously specified here - -error: aborting due to 15 previous errors - diff --git a/src/test/ui/asm/x86_64/bad-reg.rs b/src/test/ui/asm/x86_64/bad-reg.rs deleted file mode 100644 index f5728079a..000000000 --- a/src/test/ui/asm/x86_64/bad-reg.rs +++ /dev/null @@ -1,72 +0,0 @@ -// only-x86_64 -// compile-flags: -C target-feature=+avx2 - -#![feature(asm_const)] - -use std::arch::asm; - -fn main() { - let mut foo = 0; - let mut bar = 0; - unsafe { - // Bad register/register class - - asm!("{}", in(foo) foo); - //~^ ERROR invalid register class `foo`: unknown register class - asm!("", in("foo") foo); - //~^ ERROR invalid register `foo`: unknown register - asm!("{:z}", in(reg) foo); - //~^ ERROR invalid asm template modifier for this register class - asm!("{:r}", in(xmm_reg) foo); - //~^ ERROR invalid asm template modifier for this register class - asm!("{:a}", const 0); - //~^ ERROR asm template modifiers are not allowed for `const` arguments - asm!("{:a}", sym main); - //~^ ERROR asm template modifiers are not allowed for `sym` arguments - asm!("", in("ebp") foo); - //~^ ERROR invalid register `ebp`: the frame pointer cannot be used as an operand - asm!("", in("rsp") foo); - //~^ ERROR invalid register `rsp`: the stack pointer cannot be used as an operand - asm!("", in("ip") foo); - //~^ ERROR invalid register `ip`: the instruction pointer cannot be used as an operand - - asm!("", in("st(2)") foo); - //~^ ERROR register class `x87_reg` can only be used as a clobber, not as an input or output - //~| ERROR `i32` cannot be used with this register class - asm!("", in("mm0") foo); - //~^ ERROR register class `mmx_reg` can only be used as a clobber, not as an input or output - //~| ERROR `i32` cannot be used with this register class - asm!("", in("k0") foo); - //~^ ERROR register class `kreg0` can only be used as a clobber, not as an input or output - //~| ERROR `i32` cannot be used with this register class - asm!("", out("st(2)") _); - asm!("", out("mm0") _); - asm!("{}", in(x87_reg) foo); - //~^ ERROR register class `x87_reg` can only be used as a clobber, not as an input or output - //~| ERROR `i32` cannot be used with this register class - asm!("{}", in(mmx_reg) foo); - //~^ ERROR register class `mmx_reg` can only be used as a clobber, not as an input or output - //~| ERROR `i32` cannot be used with this register class - asm!("{}", out(x87_reg) _); - //~^ ERROR register class `x87_reg` can only be used as a clobber, not as an input or output - asm!("{}", out(mmx_reg) _); - //~^ ERROR register class `mmx_reg` can only be used as a clobber, not as an input or output - - // Explicit register conflicts - // (except in/lateout which don't conflict) - - asm!("", in("eax") foo, in("al") bar); - //~^ ERROR register `al` conflicts with register `ax` - //~| ERROR `i32` cannot be used with this register class - asm!("", in("rax") foo, out("rax") bar); - //~^ ERROR register `ax` conflicts with register `ax` - asm!("", in("al") foo, lateout("al") bar); - //~^ ERROR `i32` cannot be used with this register class - //~| ERROR `i32` cannot be used with this register class - asm!("", in("xmm0") foo, in("ymm0") bar); - //~^ ERROR register `ymm0` conflicts with register `xmm0` - asm!("", in("xmm0") foo, out("ymm0") bar); - //~^ ERROR register `ymm0` conflicts with register `xmm0` - asm!("", in("xmm0") foo, lateout("ymm0") bar); - } -} diff --git a/src/test/ui/asm/x86_64/bad-reg.stderr b/src/test/ui/asm/x86_64/bad-reg.stderr deleted file mode 100644 index 82b7ebd0f..000000000 --- a/src/test/ui/asm/x86_64/bad-reg.stderr +++ /dev/null @@ -1,218 +0,0 @@ -error: invalid register class `foo`: unknown register class - --> $DIR/bad-reg.rs:14:20 - | -LL | asm!("{}", in(foo) foo); - | ^^^^^^^^^^^ - -error: invalid register `foo`: unknown register - --> $DIR/bad-reg.rs:16:18 - | -LL | asm!("", in("foo") foo); - | ^^^^^^^^^^^^^ - -error: invalid asm template modifier for this register class - --> $DIR/bad-reg.rs:18:15 - | -LL | asm!("{:z}", in(reg) foo); - | ^^^^ ----------- argument - | | - | template modifier - | - = note: the `reg` register class supports the following template modifiers: `l`, `x`, `e`, `r` - -error: invalid asm template modifier for this register class - --> $DIR/bad-reg.rs:20:15 - | -LL | asm!("{:r}", in(xmm_reg) foo); - | ^^^^ --------------- argument - | | - | template modifier - | - = note: the `xmm_reg` register class supports the following template modifiers: `x`, `y`, `z` - -error: asm template modifiers are not allowed for `const` arguments - --> $DIR/bad-reg.rs:22:15 - | -LL | asm!("{:a}", const 0); - | ^^^^ ------- argument - | | - | template modifier - -error: asm template modifiers are not allowed for `sym` arguments - --> $DIR/bad-reg.rs:24:15 - | -LL | asm!("{:a}", sym main); - | ^^^^ -------- argument - | | - | template modifier - -error: invalid register `ebp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:26:18 - | -LL | asm!("", in("ebp") foo); - | ^^^^^^^^^^^^^ - -error: invalid register `rsp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:28:18 - | -LL | asm!("", in("rsp") foo); - | ^^^^^^^^^^^^^ - -error: invalid register `ip`: the instruction pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:30:18 - | -LL | asm!("", in("ip") foo); - | ^^^^^^^^^^^^ - -error: register class `x87_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:33:18 - | -LL | asm!("", in("st(2)") foo); - | ^^^^^^^^^^^^^^^ - -error: register class `mmx_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:36:18 - | -LL | asm!("", in("mm0") foo); - | ^^^^^^^^^^^^^ - -error: register class `kreg0` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:39:18 - | -LL | asm!("", in("k0") foo); - | ^^^^^^^^^^^^ - -error: register class `x87_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:44:20 - | -LL | asm!("{}", in(x87_reg) foo); - | ^^^^^^^^^^^^^^^ - -error: register class `mmx_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:47:20 - | -LL | asm!("{}", in(mmx_reg) foo); - | ^^^^^^^^^^^^^^^ - -error: register class `x87_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:50:20 - | -LL | asm!("{}", out(x87_reg) _); - | ^^^^^^^^^^^^^^ - -error: register class `mmx_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:52:20 - | -LL | asm!("{}", out(mmx_reg) _); - | ^^^^^^^^^^^^^^ - -error: register `al` conflicts with register `ax` - --> $DIR/bad-reg.rs:58:33 - | -LL | asm!("", in("eax") foo, in("al") bar); - | ------------- ^^^^^^^^^^^^ register `al` - | | - | register `ax` - -error: register `ax` conflicts with register `ax` - --> $DIR/bad-reg.rs:61:33 - | -LL | asm!("", in("rax") foo, out("rax") bar); - | ------------- ^^^^^^^^^^^^^^ register `ax` - | | - | register `ax` - | -help: use `lateout` instead of `out` to avoid conflict - --> $DIR/bad-reg.rs:61:18 - | -LL | asm!("", in("rax") foo, out("rax") bar); - | ^^^^^^^^^^^^^ - -error: register `ymm0` conflicts with register `xmm0` - --> $DIR/bad-reg.rs:66:34 - | -LL | asm!("", in("xmm0") foo, in("ymm0") bar); - | -------------- ^^^^^^^^^^^^^^ register `ymm0` - | | - | register `xmm0` - -error: register `ymm0` conflicts with register `xmm0` - --> $DIR/bad-reg.rs:68:34 - | -LL | asm!("", in("xmm0") foo, out("ymm0") bar); - | -------------- ^^^^^^^^^^^^^^^ register `ymm0` - | | - | register `xmm0` - | -help: use `lateout` instead of `out` to avoid conflict - --> $DIR/bad-reg.rs:68:18 - | -LL | asm!("", in("xmm0") foo, out("ymm0") bar); - | ^^^^^^^^^^^^^^ - -error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:33:30 - | -LL | asm!("", in("st(2)") foo); - | ^^^ - | - = note: register class `x87_reg` supports these types: - -error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:36:28 - | -LL | asm!("", in("mm0") foo); - | ^^^ - | - = note: register class `mmx_reg` supports these types: - -error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:39:27 - | -LL | asm!("", in("k0") foo); - | ^^^ - | - = note: register class `kreg0` supports these types: - -error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:44:32 - | -LL | asm!("{}", in(x87_reg) foo); - | ^^^ - | - = note: register class `x87_reg` supports these types: - -error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:47:32 - | -LL | asm!("{}", in(mmx_reg) foo); - | ^^^ - | - = note: register class `mmx_reg` supports these types: - -error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:58:42 - | -LL | asm!("", in("eax") foo, in("al") bar); - | ^^^ - | - = note: register class `reg_byte` supports these types: i8 - -error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:63:27 - | -LL | asm!("", in("al") foo, lateout("al") bar); - | ^^^ - | - = note: register class `reg_byte` supports these types: i8 - -error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:63:46 - | -LL | asm!("", in("al") foo, lateout("al") bar); - | ^^^ - | - = note: register class `reg_byte` supports these types: i8 - -error: aborting due to 28 previous errors - diff --git a/src/test/ui/asm/x86_64/const.rs b/src/test/ui/asm/x86_64/const.rs deleted file mode 100644 index d523ae021..000000000 --- a/src/test/ui/asm/x86_64/const.rs +++ /dev/null @@ -1,44 +0,0 @@ -// only-x86_64 -// run-pass -// needs-asm-support -// revisions: mirunsafeck thirunsafeck -// [thirunsafeck]compile-flags: -Z thir-unsafeck - -#![feature(asm_const)] - -use std::arch::{asm, global_asm}; - -fn const_generic<const X: usize>() -> usize { - unsafe { - let a: usize; - asm!("mov {}, {}", out(reg) a, const X); - a - } -} - -const fn constfn(x: usize) -> usize { - x -} - -fn main() { - unsafe { - let a: usize; - asm!("mov {}, {}", out(reg) a, const 5); - assert_eq!(a, 5); - - let b: usize; - asm!("mov {}, {}", out(reg) b, const constfn(5)); - assert_eq!(b, 5); - - let c: usize; - asm!("mov {}, {}", out(reg) c, const constfn(5) + constfn(5)); - assert_eq!(c, 10); - } - - let d = const_generic::<5>(); - assert_eq!(d, 5); -} - -global_asm!("mov eax, {}", const 5); -global_asm!("mov eax, {}", const constfn(5)); -global_asm!("mov eax, {}", const constfn(5) + constfn(5)); diff --git a/src/test/ui/asm/x86_64/duplicate-options.fixed b/src/test/ui/asm/x86_64/duplicate-options.fixed deleted file mode 100644 index c5f14f5f7..000000000 --- a/src/test/ui/asm/x86_64/duplicate-options.fixed +++ /dev/null @@ -1,29 +0,0 @@ -// only-x86_64 -// run-rustfix - -use std::arch::{asm, global_asm}; - -fn main() { - unsafe { - asm!("", options(nomem, )); - //~^ ERROR the `nomem` option was already provided - asm!("", options(att_syntax, )); - //~^ ERROR the `att_syntax` option was already provided - asm!("", options(nostack, att_syntax), options()); - //~^ ERROR the `nostack` option was already provided - asm!("", options(nostack, ), options(), options()); - //~^ ERROR the `nostack` option was already provided - //~| ERROR the `nostack` option was already provided - //~| ERROR the `nostack` option was already provided - asm!( - "", - options(nomem, noreturn), - options(att_syntax, ), //~ ERROR the `noreturn` option was already provided - options( nostack), //~ ERROR the `nomem` option was already provided - options(), //~ ERROR the `noreturn` option was already provided - ); - } -} - -global_asm!("", options(att_syntax, )); -//~^ ERROR the `att_syntax` option was already provided diff --git a/src/test/ui/asm/x86_64/duplicate-options.rs b/src/test/ui/asm/x86_64/duplicate-options.rs deleted file mode 100644 index a8dce1f8d..000000000 --- a/src/test/ui/asm/x86_64/duplicate-options.rs +++ /dev/null @@ -1,29 +0,0 @@ -// only-x86_64 -// run-rustfix - -use std::arch::{asm, global_asm}; - -fn main() { - unsafe { - asm!("", options(nomem, nomem)); - //~^ ERROR the `nomem` option was already provided - asm!("", options(att_syntax, att_syntax)); - //~^ ERROR the `att_syntax` option was already provided - asm!("", options(nostack, att_syntax), options(nostack)); - //~^ ERROR the `nostack` option was already provided - asm!("", options(nostack, nostack), options(nostack), options(nostack)); - //~^ ERROR the `nostack` option was already provided - //~| ERROR the `nostack` option was already provided - //~| ERROR the `nostack` option was already provided - asm!( - "", - options(nomem, noreturn), - options(att_syntax, noreturn), //~ ERROR the `noreturn` option was already provided - options(nomem, nostack), //~ ERROR the `nomem` option was already provided - options(noreturn), //~ ERROR the `noreturn` option was already provided - ); - } -} - -global_asm!("", options(att_syntax, att_syntax)); -//~^ ERROR the `att_syntax` option was already provided diff --git a/src/test/ui/asm/x86_64/duplicate-options.stderr b/src/test/ui/asm/x86_64/duplicate-options.stderr deleted file mode 100644 index 53edf8fb9..000000000 --- a/src/test/ui/asm/x86_64/duplicate-options.stderr +++ /dev/null @@ -1,62 +0,0 @@ -error: the `nomem` option was already provided - --> $DIR/duplicate-options.rs:8:33 - | -LL | asm!("", options(nomem, nomem)); - | ^^^^^ this option was already provided - -error: the `att_syntax` option was already provided - --> $DIR/duplicate-options.rs:10:38 - | -LL | asm!("", options(att_syntax, att_syntax)); - | ^^^^^^^^^^ this option was already provided - -error: the `nostack` option was already provided - --> $DIR/duplicate-options.rs:12:56 - | -LL | asm!("", options(nostack, att_syntax), options(nostack)); - | ^^^^^^^ this option was already provided - -error: the `nostack` option was already provided - --> $DIR/duplicate-options.rs:14:35 - | -LL | asm!("", options(nostack, nostack), options(nostack), options(nostack)); - | ^^^^^^^ this option was already provided - -error: the `nostack` option was already provided - --> $DIR/duplicate-options.rs:14:53 - | -LL | asm!("", options(nostack, nostack), options(nostack), options(nostack)); - | ^^^^^^^ this option was already provided - -error: the `nostack` option was already provided - --> $DIR/duplicate-options.rs:14:71 - | -LL | asm!("", options(nostack, nostack), options(nostack), options(nostack)); - | ^^^^^^^ this option was already provided - -error: the `noreturn` option was already provided - --> $DIR/duplicate-options.rs:21:33 - | -LL | options(att_syntax, noreturn), - | ^^^^^^^^ this option was already provided - -error: the `nomem` option was already provided - --> $DIR/duplicate-options.rs:22:21 - | -LL | options(nomem, nostack), - | ^^^^^ this option was already provided - -error: the `noreturn` option was already provided - --> $DIR/duplicate-options.rs:23:21 - | -LL | options(noreturn), - | ^^^^^^^^ this option was already provided - -error: the `att_syntax` option was already provided - --> $DIR/duplicate-options.rs:28:37 - | -LL | global_asm!("", options(att_syntax, att_syntax)); - | ^^^^^^^^^^ this option was already provided - -error: aborting due to 10 previous errors - diff --git a/src/test/ui/asm/x86_64/interpolated-idents.rs b/src/test/ui/asm/x86_64/interpolated-idents.rs deleted file mode 100644 index c05633ae8..000000000 --- a/src/test/ui/asm/x86_64/interpolated-idents.rs +++ /dev/null @@ -1,24 +0,0 @@ -// only-x86_64 - -use std::arch::asm; - -macro_rules! m { - ($in:ident $out:ident $lateout:ident $inout:ident $inlateout:ident $const:ident $sym:ident - $pure:ident $nomem:ident $readonly:ident $preserves_flags:ident - $noreturn:ident $nostack:ident $att_syntax:ident $options:ident) => { - unsafe { - asm!("", $in(x) x, $out(x) x, $lateout(x) x, $inout(x) x, $inlateout(x) x, - //~^ ERROR asm outputs are not allowed with the `noreturn` option - const x, sym x, - $options($pure, $nomem, $readonly, $preserves_flags, $noreturn, $nostack, $att_syntax)); - //~^ ERROR the `nomem` and `readonly` options are mutually exclusive - //~| ERROR the `pure` and `noreturn` options are mutually exclusive - } - }; -} - -fn main() { - m!(in out lateout inout inlateout const sym - pure nomem readonly preserves_flags - noreturn nostack att_syntax options); -} diff --git a/src/test/ui/asm/x86_64/interpolated-idents.stderr b/src/test/ui/asm/x86_64/interpolated-idents.stderr deleted file mode 100644 index 6ac2ac5a7..000000000 --- a/src/test/ui/asm/x86_64/interpolated-idents.stderr +++ /dev/null @@ -1,51 +0,0 @@ -error: the `nomem` and `readonly` options are mutually exclusive - --> $DIR/interpolated-idents.rs:13:13 - | -LL | $options($pure, $nomem, $readonly, $preserves_flags, $noreturn, $nostack, $att_syntax)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | / m!(in out lateout inout inlateout const sym -LL | | pure nomem readonly preserves_flags -LL | | noreturn nostack att_syntax options); - | |___________________________________________- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: the `pure` and `noreturn` options are mutually exclusive - --> $DIR/interpolated-idents.rs:13:13 - | -LL | $options($pure, $nomem, $readonly, $preserves_flags, $noreturn, $nostack, $att_syntax)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | / m!(in out lateout inout inlateout const sym -LL | | pure nomem readonly preserves_flags -LL | | noreturn nostack att_syntax options); - | |___________________________________________- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: asm outputs are not allowed with the `noreturn` option - --> $DIR/interpolated-idents.rs:10:32 - | -LL | asm!("", $in(x) x, $out(x) x, $lateout(x) x, $inout(x) x, $inlateout(x) x, - | ^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^ -... -LL | m!(in out lateout inout inlateout const sym - | _____- - | |_____| - | |_____| - | |_____| - | | -LL | | pure nomem readonly preserves_flags -LL | | noreturn nostack att_syntax options); - | | - - | |___________________________________________| - | |___________________________________________in this macro invocation - | |___________________________________________in this macro invocation - | |___________________________________________in this macro invocation - | in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/asm/x86_64/issue-82869.rs b/src/test/ui/asm/x86_64/issue-82869.rs deleted file mode 100644 index 67933666e..000000000 --- a/src/test/ui/asm/x86_64/issue-82869.rs +++ /dev/null @@ -1,25 +0,0 @@ -// needs-asm-support -// only-x86_64 -// Make sure rustc doesn't ICE on asm! for a foreign architecture. - -#![crate_type = "rlib"] - -use std::arch::asm; - -pub unsafe fn aarch64(a: f64, b: f64) -> f64 { - let c; - asm!("add {:d}, {:d}, d0", out(vreg) c, in(vreg) a, in("d0") { - || {}; - b - }); - //~^^^^ invalid register class - //~^^^^^ invalid register class - //~^^^^^^ invalid register - c -} - -pub unsafe fn x86(a: f64, b: f64) -> f64 { - let c; - asm!("addsd {}, {}, xmm0", out(xmm_reg) c, in(xmm_reg) a, in("xmm0") b); - c -} diff --git a/src/test/ui/asm/x86_64/issue-82869.stderr b/src/test/ui/asm/x86_64/issue-82869.stderr deleted file mode 100644 index 3cf9d6d1c..000000000 --- a/src/test/ui/asm/x86_64/issue-82869.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: invalid register class `vreg`: unknown register class - --> $DIR/issue-82869.rs:11:32 - | -LL | asm!("add {:d}, {:d}, d0", out(vreg) c, in(vreg) a, in("d0") { - | ^^^^^^^^^^^ - -error: invalid register class `vreg`: unknown register class - --> $DIR/issue-82869.rs:11:45 - | -LL | asm!("add {:d}, {:d}, d0", out(vreg) c, in(vreg) a, in("d0") { - | ^^^^^^^^^^ - -error: invalid register `d0`: unknown register - --> $DIR/issue-82869.rs:11:57 - | -LL | asm!("add {:d}, {:d}, d0", out(vreg) c, in(vreg) a, in("d0") { - | _________________________________________________________^ -LL | | || {}; -LL | | b -LL | | }); - | |_____^ - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/asm/x86_64/issue-89875.rs b/src/test/ui/asm/x86_64/issue-89875.rs deleted file mode 100644 index 669fd7e7e..000000000 --- a/src/test/ui/asm/x86_64/issue-89875.rs +++ /dev/null @@ -1,17 +0,0 @@ -// build-pass -// needs-asm-support -// only-x86_64 - -#![feature(target_feature_11)] - -use std::arch::asm; - -#[target_feature(enable = "avx")] -fn main() { - unsafe { - asm!( - "/* {} */", - out(ymm_reg) _, - ); - } -} diff --git a/src/test/ui/asm/x86_64/issue-96797.rs b/src/test/ui/asm/x86_64/issue-96797.rs deleted file mode 100644 index 954f8c5cc..000000000 --- a/src/test/ui/asm/x86_64/issue-96797.rs +++ /dev/null @@ -1,24 +0,0 @@ -// build-pass -// compile-flags: -O -// min-llvm-version: 14.0.5 -// needs-asm-support -// only-x86_64 -// only-linux - -// regression test for #96797 - -use std::arch::global_asm; - -#[no_mangle] -fn my_func() {} - -global_asm!("call_foobar: jmp {}", sym foobar); - -fn foobar() {} - -fn main() { - extern "Rust" { - fn call_foobar(); - } - unsafe { call_foobar() }; -} diff --git a/src/test/ui/asm/x86_64/may_unwind.rs b/src/test/ui/asm/x86_64/may_unwind.rs deleted file mode 100644 index c11f0938d..000000000 --- a/src/test/ui/asm/x86_64/may_unwind.rs +++ /dev/null @@ -1,38 +0,0 @@ -// only-x86_64 -// run-pass -// needs-asm-support -// needs-unwind - -#![feature(asm_unwind)] - -use std::arch::asm; -use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe}; - -struct Foo<'a>(&'a mut bool); - -impl Drop for Foo<'_> { - fn drop(&mut self) { - *self.0 = false; - } -} - -extern "C" fn panicky() { - resume_unwind(Box::new(())); -} - -fn main() { - let flag = &mut true; - catch_unwind(AssertUnwindSafe(|| { - let _foo = Foo(flag); - unsafe { - asm!( - "call {}", - sym panicky, - clobber_abi("C"), - options(may_unwind) - ); - } - })) - .expect_err("expected a panic"); - assert_eq!(*flag, false); -} diff --git a/src/test/ui/asm/x86_64/multiple-clobber-abi.rs b/src/test/ui/asm/x86_64/multiple-clobber-abi.rs deleted file mode 100644 index 06589431a..000000000 --- a/src/test/ui/asm/x86_64/multiple-clobber-abi.rs +++ /dev/null @@ -1,33 +0,0 @@ -// run-pass -// needs-asm-support -// only-x86_64 - -// Checks that multiple clobber_abi options can be used - -use std::arch::asm; - -extern "sysv64" fn foo(x: i32) -> i32 { - x + 16 -} - -extern "win64" fn bar(x: i32) -> i32 { - x / 2 -} - -fn main() { - let x = 8; - let y: i32; - // call `foo` with `x` as the input, and then `bar` with the output of `foo` - // and output that to `y` - unsafe { - asm!( - "call {}; mov rcx, rax; call {}", - sym foo, - sym bar, - in("rdi") x, - out("rax") y, - clobber_abi("sysv64", "win64"), - ); - } - assert_eq!((x, y), (8, 12)); -} diff --git a/src/test/ui/asm/x86_64/parse-error.rs b/src/test/ui/asm/x86_64/parse-error.rs deleted file mode 100644 index 9aeb6b285..000000000 --- a/src/test/ui/asm/x86_64/parse-error.rs +++ /dev/null @@ -1,137 +0,0 @@ -// only-x86_64 - -#![feature(asm_const)] - -use std::arch::{asm, global_asm}; - -fn main() { - let mut foo = 0; - let mut bar = 0; - unsafe { - asm!(); - //~^ ERROR requires at least a template string argument - asm!(foo); - //~^ ERROR asm template must be a string literal - asm!("{}" foo); - //~^ ERROR expected token: `,` - asm!("{}", foo); - //~^ ERROR expected operand, clobber_abi, options, or additional template string - asm!("{}", in foo); - //~^ ERROR expected `(`, found `foo` - asm!("{}", in(reg foo)); - //~^ ERROR expected `)`, found `foo` - asm!("{}", in(reg)); - //~^ ERROR expected expression, found end of macro arguments - asm!("{}", inout(=) foo => bar); - //~^ ERROR expected register class or explicit register - asm!("{}", inout(reg) foo =>); - //~^ ERROR expected expression, found end of macro arguments - asm!("{}", in(reg) foo => bar); - //~^ ERROR expected one of `!`, `,`, `.`, `::`, `?`, `{`, or an operator, found `=>` - asm!("{}", sym foo + bar); - //~^ ERROR expected a path for argument to `sym` - asm!("", options(foo)); - //~^ ERROR expected one of - asm!("", options(nomem foo)); - //~^ ERROR expected one of - asm!("", options(nomem, foo)); - //~^ ERROR expected one of - asm!("{}", options(), const foo); - //~^ ERROR arguments are not allowed after options - //~^^ ERROR attempt to use a non-constant value in a constant - asm!("", clobber_abi()); - //~^ ERROR at least one abi must be provided - asm!("", clobber_abi(foo)); - //~^ ERROR expected string literal - asm!("", clobber_abi("C" foo)); - //~^ ERROR expected one of `)` or `,`, found `foo` - asm!("", clobber_abi("C", foo)); - //~^ ERROR expected string literal - asm!("{}", clobber_abi("C"), const foo); - //~^ ERROR arguments are not allowed after clobber_abi - //~^^ ERROR attempt to use a non-constant value in a constant - asm!("", options(), clobber_abi("C")); - //~^ ERROR clobber_abi is not allowed after options - asm!("{}", options(), clobber_abi("C"), const foo); - //~^ ERROR clobber_abi is not allowed after options - asm!("{a}", a = const foo, a = const bar); - //~^ ERROR duplicate argument named `a` - //~^^ ERROR argument never used - //~^^^ ERROR attempt to use a non-constant value in a constant - //~^^^^ ERROR attempt to use a non-constant value in a constant - asm!("", a = in("eax") foo); - //~^ ERROR explicit register arguments cannot have names - asm!("{a}", in("eax") foo, a = const bar); - //~^ ERROR named arguments cannot follow explicit register arguments - //~^^ ERROR attempt to use a non-constant value in a constant - asm!("{a}", in("eax") foo, a = const bar); - //~^ ERROR named arguments cannot follow explicit register arguments - //~^^ ERROR attempt to use a non-constant value in a constant - asm!("{1}", in("eax") foo, const bar); - //~^ ERROR positional arguments cannot follow named arguments or explicit register arguments - //~^^ ERROR attempt to use a non-constant value in a constant - asm!("", options(), ""); - //~^ ERROR expected one of - asm!("{}", in(reg) foo, "{}", out(reg) foo); - //~^ ERROR expected one of - asm!(format!("{{{}}}", 0), in(reg) foo); - //~^ ERROR asm template must be a string literal - asm!("{1}", format!("{{{}}}", 0), in(reg) foo, out(reg) bar); - //~^ ERROR asm template must be a string literal - asm!("{}", in(reg) _); - //~^ ERROR _ cannot be used for input operands - asm!("{}", inout(reg) _); - //~^ ERROR _ cannot be used for input operands - asm!("{}", inlateout(reg) _); - //~^ ERROR _ cannot be used for input operands - } -} - -const FOO: i32 = 1; -const BAR: i32 = 2; -global_asm!(); -//~^ ERROR requires at least a template string argument -global_asm!(FOO); -//~^ ERROR asm template must be a string literal -global_asm!("{}" FOO); -//~^ ERROR expected token: `,` -global_asm!("{}", FOO); -//~^ ERROR expected operand, options, or additional template string -global_asm!("{}", const); -//~^ ERROR expected expression, found end of macro arguments -global_asm!("{}", const(reg) FOO); -//~^ ERROR expected one of -global_asm!("", options(FOO)); -//~^ ERROR expected one of -global_asm!("", options(nomem FOO)); -//~^ ERROR expected one of -global_asm!("", options(nomem, FOO)); -//~^ ERROR expected one of -global_asm!("{}", options(), const FOO); -//~^ ERROR arguments are not allowed after options -global_asm!("", clobber_abi(FOO)); -//~^ ERROR expected string literal -global_asm!("", clobber_abi("C" FOO)); -//~^ ERROR expected one of `)` or `,`, found `FOO` -global_asm!("", clobber_abi("C", FOO)); -//~^ ERROR expected string literal -global_asm!("{}", clobber_abi("C"), const FOO); -//~^ ERROR arguments are not allowed after clobber_abi -//~^^ ERROR `clobber_abi` cannot be used with `global_asm!` -global_asm!("", options(), clobber_abi("C")); -//~^ ERROR clobber_abi is not allowed after options -global_asm!("{}", options(), clobber_abi("C"), const FOO); -//~^ ERROR clobber_abi is not allowed after options -global_asm!("", clobber_abi("C"), clobber_abi("C")); -//~^ ERROR `clobber_abi` cannot be used with `global_asm!` -global_asm!("{a}", a = const FOO, a = const BAR); -//~^ ERROR duplicate argument named `a` -//~^^ ERROR argument never used -global_asm!("", options(), ""); -//~^ ERROR expected one of -global_asm!("{}", const FOO, "{}", const FOO); -//~^ ERROR expected one of -global_asm!(format!("{{{}}}", 0), const FOO); -//~^ ERROR asm template must be a string literal -global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR); -//~^ ERROR asm template must be a string literal diff --git a/src/test/ui/asm/x86_64/parse-error.stderr b/src/test/ui/asm/x86_64/parse-error.stderr deleted file mode 100644 index 57702c37b..000000000 --- a/src/test/ui/asm/x86_64/parse-error.stderr +++ /dev/null @@ -1,458 +0,0 @@ -error: requires at least a template string argument - --> $DIR/parse-error.rs:11:9 - | -LL | asm!(); - | ^^^^^^ - -error: asm template must be a string literal - --> $DIR/parse-error.rs:13:14 - | -LL | asm!(foo); - | ^^^ - -error: expected token: `,` - --> $DIR/parse-error.rs:15:19 - | -LL | asm!("{}" foo); - | ^^^ expected `,` - -error: expected operand, clobber_abi, options, or additional template string - --> $DIR/parse-error.rs:17:20 - | -LL | asm!("{}", foo); - | ^^^ expected operand, clobber_abi, options, or additional template string - -error: expected `(`, found `foo` - --> $DIR/parse-error.rs:19:23 - | -LL | asm!("{}", in foo); - | ^^^ expected `(` - -error: expected `)`, found `foo` - --> $DIR/parse-error.rs:21:27 - | -LL | asm!("{}", in(reg foo)); - | ^^^ expected `)` - -error: expected expression, found end of macro arguments - --> $DIR/parse-error.rs:23:27 - | -LL | asm!("{}", in(reg)); - | ^ expected expression - -error: expected register class or explicit register - --> $DIR/parse-error.rs:25:26 - | -LL | asm!("{}", inout(=) foo => bar); - | ^ - -error: expected expression, found end of macro arguments - --> $DIR/parse-error.rs:27:37 - | -LL | asm!("{}", inout(reg) foo =>); - | ^ expected expression - -error: expected one of `!`, `,`, `.`, `::`, `?`, `{`, or an operator, found `=>` - --> $DIR/parse-error.rs:29:32 - | -LL | asm!("{}", in(reg) foo => bar); - | ^^ expected one of 7 possible tokens - -error: expected a path for argument to `sym` - --> $DIR/parse-error.rs:31:24 - | -LL | asm!("{}", sym foo + bar); - | ^^^^^^^^^ - -error: expected one of `)`, `att_syntax`, `may_unwind`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` - --> $DIR/parse-error.rs:33:26 - | -LL | asm!("", options(foo)); - | ^^^ expected one of 10 possible tokens - -error: expected one of `)` or `,`, found `foo` - --> $DIR/parse-error.rs:35:32 - | -LL | asm!("", options(nomem foo)); - | ^^^ expected one of `)` or `,` - -error: expected one of `)`, `att_syntax`, `may_unwind`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` - --> $DIR/parse-error.rs:37:33 - | -LL | asm!("", options(nomem, foo)); - | ^^^ expected one of 10 possible tokens - -error: arguments are not allowed after options - --> $DIR/parse-error.rs:39:31 - | -LL | asm!("{}", options(), const foo); - | --------- ^^^^^^^^^ argument - | | - | previous options - -error: at least one abi must be provided as an argument to `clobber_abi` - --> $DIR/parse-error.rs:42:30 - | -LL | asm!("", clobber_abi()); - | ^ - -error: expected string literal - --> $DIR/parse-error.rs:44:30 - | -LL | asm!("", clobber_abi(foo)); - | ^^^ not a string literal - -error: expected one of `)` or `,`, found `foo` - --> $DIR/parse-error.rs:46:34 - | -LL | asm!("", clobber_abi("C" foo)); - | ^^^ expected one of `)` or `,` - -error: expected string literal - --> $DIR/parse-error.rs:48:35 - | -LL | asm!("", clobber_abi("C", foo)); - | ^^^ not a string literal - -error: arguments are not allowed after clobber_abi - --> $DIR/parse-error.rs:50:38 - | -LL | asm!("{}", clobber_abi("C"), const foo); - | ---------------- ^^^^^^^^^ argument - | | - | clobber_abi - -error: clobber_abi is not allowed after options - --> $DIR/parse-error.rs:53:29 - | -LL | asm!("", options(), clobber_abi("C")); - | --------- ^^^^^^^^^^^^^^^^ - | | - | options - -error: clobber_abi is not allowed after options - --> $DIR/parse-error.rs:55:31 - | -LL | asm!("{}", options(), clobber_abi("C"), const foo); - | --------- ^^^^^^^^^^^^^^^^ - | | - | options - -error: duplicate argument named `a` - --> $DIR/parse-error.rs:57:36 - | -LL | asm!("{a}", a = const foo, a = const bar); - | ------------- ^^^^^^^^^^^^^ duplicate argument - | | - | previously here - -error: argument never used - --> $DIR/parse-error.rs:57:36 - | -LL | asm!("{a}", a = const foo, a = const bar); - | ^^^^^^^^^^^^^ argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {1} */"` - -error: explicit register arguments cannot have names - --> $DIR/parse-error.rs:62:18 - | -LL | asm!("", a = in("eax") foo); - | ^^^^^^^^^^^^^^^^^ - -error: named arguments cannot follow explicit register arguments - --> $DIR/parse-error.rs:64:36 - | -LL | asm!("{a}", in("eax") foo, a = const bar); - | ------------- ^^^^^^^^^^^^^ named argument - | | - | explicit register argument - -error: named arguments cannot follow explicit register arguments - --> $DIR/parse-error.rs:67:36 - | -LL | asm!("{a}", in("eax") foo, a = const bar); - | ------------- ^^^^^^^^^^^^^ named argument - | | - | explicit register argument - -error: positional arguments cannot follow named arguments or explicit register arguments - --> $DIR/parse-error.rs:70:36 - | -LL | asm!("{1}", in("eax") foo, const bar); - | ------------- ^^^^^^^^^ positional argument - | | - | explicit register argument - -error: expected one of `clobber_abi`, `const`, `in`, `inlateout`, `inout`, `lateout`, `options`, `out`, or `sym`, found `""` - --> $DIR/parse-error.rs:73:29 - | -LL | asm!("", options(), ""); - | ^^ expected one of 9 possible tokens - -error: expected one of `clobber_abi`, `const`, `in`, `inlateout`, `inout`, `lateout`, `options`, `out`, or `sym`, found `"{}"` - --> $DIR/parse-error.rs:75:33 - | -LL | asm!("{}", in(reg) foo, "{}", out(reg) foo); - | ^^^^ expected one of 9 possible tokens - -error: asm template must be a string literal - --> $DIR/parse-error.rs:77:14 - | -LL | asm!(format!("{{{}}}", 0), in(reg) foo); - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: asm template must be a string literal - --> $DIR/parse-error.rs:79:21 - | -LL | asm!("{1}", format!("{{{}}}", 0), in(reg) foo, out(reg) bar); - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: _ cannot be used for input operands - --> $DIR/parse-error.rs:81:28 - | -LL | asm!("{}", in(reg) _); - | ^ - -error: _ cannot be used for input operands - --> $DIR/parse-error.rs:83:31 - | -LL | asm!("{}", inout(reg) _); - | ^ - -error: _ cannot be used for input operands - --> $DIR/parse-error.rs:85:35 - | -LL | asm!("{}", inlateout(reg) _); - | ^ - -error: requires at least a template string argument - --> $DIR/parse-error.rs:92:1 - | -LL | global_asm!(); - | ^^^^^^^^^^^^^ - -error: asm template must be a string literal - --> $DIR/parse-error.rs:94:13 - | -LL | global_asm!(FOO); - | ^^^ - -error: expected token: `,` - --> $DIR/parse-error.rs:96:18 - | -LL | global_asm!("{}" FOO); - | ^^^ expected `,` - -error: expected operand, options, or additional template string - --> $DIR/parse-error.rs:98:19 - | -LL | global_asm!("{}", FOO); - | ^^^ expected operand, options, or additional template string - -error: expected expression, found end of macro arguments - --> $DIR/parse-error.rs:100:24 - | -LL | global_asm!("{}", const); - | ^ expected expression - -error: expected one of `,`, `.`, `?`, or an operator, found `FOO` - --> $DIR/parse-error.rs:102:30 - | -LL | global_asm!("{}", const(reg) FOO); - | ^^^ expected one of `,`, `.`, `?`, or an operator - -error: expected one of `)`, `att_syntax`, or `raw`, found `FOO` - --> $DIR/parse-error.rs:104:25 - | -LL | global_asm!("", options(FOO)); - | ^^^ expected one of `)`, `att_syntax`, or `raw` - -error: expected one of `)`, `att_syntax`, or `raw`, found `nomem` - --> $DIR/parse-error.rs:106:25 - | -LL | global_asm!("", options(nomem FOO)); - | ^^^^^ expected one of `)`, `att_syntax`, or `raw` - -error: expected one of `)`, `att_syntax`, or `raw`, found `nomem` - --> $DIR/parse-error.rs:108:25 - | -LL | global_asm!("", options(nomem, FOO)); - | ^^^^^ expected one of `)`, `att_syntax`, or `raw` - -error: arguments are not allowed after options - --> $DIR/parse-error.rs:110:30 - | -LL | global_asm!("{}", options(), const FOO); - | --------- ^^^^^^^^^ argument - | | - | previous options - -error: expected string literal - --> $DIR/parse-error.rs:112:29 - | -LL | global_asm!("", clobber_abi(FOO)); - | ^^^ not a string literal - -error: expected one of `)` or `,`, found `FOO` - --> $DIR/parse-error.rs:114:33 - | -LL | global_asm!("", clobber_abi("C" FOO)); - | ^^^ expected one of `)` or `,` - -error: expected string literal - --> $DIR/parse-error.rs:116:34 - | -LL | global_asm!("", clobber_abi("C", FOO)); - | ^^^ not a string literal - -error: arguments are not allowed after clobber_abi - --> $DIR/parse-error.rs:118:37 - | -LL | global_asm!("{}", clobber_abi("C"), const FOO); - | ---------------- ^^^^^^^^^ argument - | | - | clobber_abi - -error: `clobber_abi` cannot be used with `global_asm!` - --> $DIR/parse-error.rs:118:19 - | -LL | global_asm!("{}", clobber_abi("C"), const FOO); - | ^^^^^^^^^^^^^^^^ - -error: clobber_abi is not allowed after options - --> $DIR/parse-error.rs:121:28 - | -LL | global_asm!("", options(), clobber_abi("C")); - | --------- ^^^^^^^^^^^^^^^^ - | | - | options - -error: clobber_abi is not allowed after options - --> $DIR/parse-error.rs:123:30 - | -LL | global_asm!("{}", options(), clobber_abi("C"), const FOO); - | --------- ^^^^^^^^^^^^^^^^ - | | - | options - -error: `clobber_abi` cannot be used with `global_asm!` - --> $DIR/parse-error.rs:125:17 - | -LL | global_asm!("", clobber_abi("C"), clobber_abi("C")); - | ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ - -error: duplicate argument named `a` - --> $DIR/parse-error.rs:127:35 - | -LL | global_asm!("{a}", a = const FOO, a = const BAR); - | ------------- ^^^^^^^^^^^^^ duplicate argument - | | - | previously here - -error: argument never used - --> $DIR/parse-error.rs:127:35 - | -LL | global_asm!("{a}", a = const FOO, a = const BAR); - | ^^^^^^^^^^^^^ argument never used - | - = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {1} */"` - -error: expected one of `clobber_abi`, `const`, `options`, or `sym`, found `""` - --> $DIR/parse-error.rs:130:28 - | -LL | global_asm!("", options(), ""); - | ^^ expected one of `clobber_abi`, `const`, `options`, or `sym` - -error: expected one of `clobber_abi`, `const`, `options`, or `sym`, found `"{}"` - --> $DIR/parse-error.rs:132:30 - | -LL | global_asm!("{}", const FOO, "{}", const FOO); - | ^^^^ expected one of `clobber_abi`, `const`, `options`, or `sym` - -error: asm template must be a string literal - --> $DIR/parse-error.rs:134:13 - | -LL | global_asm!(format!("{{{}}}", 0), const FOO); - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: asm template must be a string literal - --> $DIR/parse-error.rs:136:20 - | -LL | global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR); - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:39:37 - | -LL | let mut foo = 0; - | ----------- help: consider using `const` instead of `let`: `const foo` -... -LL | asm!("{}", options(), const foo); - | ^^^ non-constant value - -error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:50:44 - | -LL | let mut foo = 0; - | ----------- help: consider using `const` instead of `let`: `const foo` -... -LL | asm!("{}", clobber_abi("C"), const foo); - | ^^^ non-constant value - -error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:57:31 - | -LL | let mut foo = 0; - | ----------- help: consider using `const` instead of `let`: `const foo` -... -LL | asm!("{a}", a = const foo, a = const bar); - | ^^^ non-constant value - -error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:57:46 - | -LL | let mut bar = 0; - | ----------- help: consider using `const` instead of `let`: `const bar` -... -LL | asm!("{a}", a = const foo, a = const bar); - | ^^^ non-constant value - -error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:64:46 - | -LL | let mut bar = 0; - | ----------- help: consider using `const` instead of `let`: `const bar` -... -LL | asm!("{a}", in("eax") foo, a = const bar); - | ^^^ non-constant value - -error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:67:46 - | -LL | let mut bar = 0; - | ----------- help: consider using `const` instead of `let`: `const bar` -... -LL | asm!("{a}", in("eax") foo, a = const bar); - | ^^^ non-constant value - -error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:70:42 - | -LL | let mut bar = 0; - | ----------- help: consider using `const` instead of `let`: `const bar` -... -LL | asm!("{1}", in("eax") foo, const bar); - | ^^^ non-constant value - -error: aborting due to 66 previous errors - -For more information about this error, try `rustc --explain E0435`. diff --git a/src/test/ui/asm/x86_64/srcloc.rs b/src/test/ui/asm/x86_64/srcloc.rs deleted file mode 100644 index 1135ad2e1..000000000 --- a/src/test/ui/asm/x86_64/srcloc.rs +++ /dev/null @@ -1,131 +0,0 @@ -// only-x86_64 -// build-fail -// compile-flags: -Ccodegen-units=1 - -use std::arch::asm; - -// Checks that inline asm errors are mapped to the correct line in the source code. - -fn main() { - unsafe { - asm!("invalid_instruction"); - //~^ ERROR: invalid instruction mnemonic 'invalid_instruction' - - asm!(" - invalid_instruction - "); - //~^^ ERROR: invalid instruction mnemonic 'invalid_instruction' - - asm!(r#" - invalid_instruction - "#); - //~^^ ERROR: invalid instruction mnemonic 'invalid_instruction' - - asm!(" - mov eax, eax - invalid_instruction - mov eax, eax - "); - //~^^^ ERROR: invalid instruction mnemonic 'invalid_instruction' - - asm!(r#" - mov eax, eax - invalid_instruction - mov eax, eax - "#); - //~^^^ ERROR: invalid instruction mnemonic 'invalid_instruction' - - asm!(concat!("invalid", "_", "instruction")); - //~^ ERROR: invalid instruction mnemonic 'invalid_instruction' - - asm!("movaps %xmm3, (%esi, 2)", options(att_syntax)); - //~^ WARN: scale factor without index register is ignored - - asm!( - "invalid_instruction", - ); - //~^^ ERROR: invalid instruction mnemonic 'invalid_instruction' - - asm!( - "mov eax, eax", - "invalid_instruction", - "mov eax, eax", - ); - //~^^^ ERROR: invalid instruction mnemonic 'invalid_instruction' - - asm!( - "mov eax, eax\n", - "invalid_instruction", - "mov eax, eax", - ); - //~^^^ ERROR: invalid instruction mnemonic 'invalid_instruction' - - asm!( - "mov eax, eax", - concat!("invalid", "_", "instruction"), - "mov eax, eax", - ); - //~^^^ ERROR: invalid instruction mnemonic 'invalid_instruction' - - asm!( - concat!("mov eax", ", ", "eax"), - concat!("invalid", "_", "instruction"), - concat!("mov eax", ", ", "eax"), - ); - //~^^^ ERROR: invalid instruction mnemonic 'invalid_instruction' - - // Make sure template strings get separated - asm!( - "invalid_instruction1", - "invalid_instruction2", - ); - //~^^^ ERROR: invalid instruction mnemonic 'invalid_instruction1' - //~^^^ ERROR: invalid instruction mnemonic 'invalid_instruction2' - - asm!( - concat!( - "invalid", "_", "instruction1", "\n", - "invalid", "_", "instruction2", - ), - ); - //~^^^^^ ERROR: invalid instruction mnemonic 'invalid_instruction1' - //~^^^^^^ ERROR: invalid instruction mnemonic 'invalid_instruction2' - - asm!( - concat!( - "invalid", "_", "instruction1", "\n", - "invalid", "_", "instruction2", - ), - concat!( - "invalid", "_", "instruction3", "\n", - "invalid", "_", "instruction4", - ), - ); - //~^^^^^^^^^ ERROR: invalid instruction mnemonic 'invalid_instruction1' - //~^^^^^^^^^^ ERROR: invalid instruction mnemonic 'invalid_instruction2' - //~^^^^^^^ ERROR: invalid instruction mnemonic 'invalid_instruction3' - //~^^^^^^^^ ERROR: invalid instruction mnemonic 'invalid_instruction4' - - asm!( - concat!( - "invalid", "_", "instruction1", "\n", - "invalid", "_", "instruction2", "\n", - ), - concat!( - "invalid", "_", "instruction3", "\n", - "invalid", "_", "instruction4", "\n", - ), - ); - //~^^^^^^^^^ ERROR: invalid instruction mnemonic 'invalid_instruction1' - //~^^^^^^^^^^ ERROR: invalid instruction mnemonic 'invalid_instruction2' - //~^^^^^^^ ERROR: invalid instruction mnemonic 'invalid_instruction3' - //~^^^^^^^^ ERROR: invalid instruction mnemonic 'invalid_instruction4' - - asm!( - "", - "\n", - "invalid_instruction" - ); - //~^^ ERROR: invalid instruction mnemonic 'invalid_instruction' - } -} diff --git a/src/test/ui/asm/x86_64/srcloc.stderr b/src/test/ui/asm/x86_64/srcloc.stderr deleted file mode 100644 index 8899c1b91..000000000 --- a/src/test/ui/asm/x86_64/srcloc.stderr +++ /dev/null @@ -1,302 +0,0 @@ -error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:11:15 - | -LL | asm!("invalid_instruction"); - | ^ - | -note: instantiated into assembly here - --> <inline asm>:2:2 - | -LL | invalid_instruction - | ^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:15:13 - | -LL | invalid_instruction - | ^ - | -note: instantiated into assembly here - --> <inline asm>:3:13 - | -LL | invalid_instruction - | ^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:20:13 - | -LL | invalid_instruction - | ^ - | -note: instantiated into assembly here - --> <inline asm>:3:13 - | -LL | invalid_instruction - | ^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:26:13 - | -LL | invalid_instruction - | ^ - | -note: instantiated into assembly here - --> <inline asm>:4:13 - | -LL | invalid_instruction - | ^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:33:13 - | -LL | invalid_instruction - | ^ - | -note: instantiated into assembly here - --> <inline asm>:4:13 - | -LL | invalid_instruction - | ^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:38:14 - | -LL | asm!(concat!("invalid", "_", "instruction")); - | ^ - | -note: instantiated into assembly here - --> <inline asm>:2:2 - | -LL | invalid_instruction - | ^^^^^^^^^^^^^^^^^^^ - -warning: scale factor without index register is ignored - --> $DIR/srcloc.rs:41:15 - | -LL | asm!("movaps %xmm3, (%esi, 2)", options(att_syntax)); - | ^ - | -note: instantiated into assembly here - --> <inline asm>:1:23 - | -LL | movaps %xmm3, (%esi, 2) - | ^ - -error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:45:14 - | -LL | "invalid_instruction", - | ^ - | -note: instantiated into assembly here - --> <inline asm>:2:2 - | -LL | invalid_instruction - | ^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:51:14 - | -LL | "invalid_instruction", - | ^ - | -note: instantiated into assembly here - --> <inline asm>:3:1 - | -LL | invalid_instruction - | ^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:58:14 - | -LL | "invalid_instruction", - | ^ - | -note: instantiated into assembly here - --> <inline asm>:4:1 - | -LL | invalid_instruction - | ^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:65:13 - | -LL | concat!("invalid", "_", "instruction"), - | ^ - | -note: instantiated into assembly here - --> <inline asm>:3:1 - | -LL | invalid_instruction - | ^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:72:13 - | -LL | concat!("invalid", "_", "instruction"), - | ^ - | -note: instantiated into assembly here - --> <inline asm>:3:1 - | -LL | invalid_instruction - | ^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction1' - --> $DIR/srcloc.rs:79:14 - | -LL | "invalid_instruction1", - | ^ - | -note: instantiated into assembly here - --> <inline asm>:2:2 - | -LL | invalid_instruction1 - | ^^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction2' - --> $DIR/srcloc.rs:80:14 - | -LL | "invalid_instruction2", - | ^ - | -note: instantiated into assembly here - --> <inline asm>:3:1 - | -LL | invalid_instruction2 - | ^^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction1' - --> $DIR/srcloc.rs:86:13 - | -LL | concat!( - | ^ - | -note: instantiated into assembly here - --> <inline asm>:2:2 - | -LL | invalid_instruction1 - | ^^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction2' - --> $DIR/srcloc.rs:86:13 - | -LL | concat!( - | ^ - | -note: instantiated into assembly here - --> <inline asm>:3:1 - | -LL | invalid_instruction2 - | ^^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction1' - --> $DIR/srcloc.rs:95:13 - | -LL | concat!( - | ^ - | -note: instantiated into assembly here - --> <inline asm>:2:2 - | -LL | invalid_instruction1 - | ^^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction2' - --> $DIR/srcloc.rs:95:13 - | -LL | concat!( - | ^ - | -note: instantiated into assembly here - --> <inline asm>:3:1 - | -LL | invalid_instruction2 - | ^^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction3' - --> $DIR/srcloc.rs:99:13 - | -LL | concat!( - | ^ - | -note: instantiated into assembly here - --> <inline asm>:4:1 - | -LL | invalid_instruction3 - | ^^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction4' - --> $DIR/srcloc.rs:99:13 - | -LL | concat!( - | ^ - | -note: instantiated into assembly here - --> <inline asm>:5:1 - | -LL | invalid_instruction4 - | ^^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction1' - --> $DIR/srcloc.rs:110:13 - | -LL | concat!( - | ^ - | -note: instantiated into assembly here - --> <inline asm>:2:2 - | -LL | invalid_instruction1 - | ^^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction2' - --> $DIR/srcloc.rs:110:13 - | -LL | concat!( - | ^ - | -note: instantiated into assembly here - --> <inline asm>:3:1 - | -LL | invalid_instruction2 - | ^^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction3' - --> $DIR/srcloc.rs:114:13 - | -LL | concat!( - | ^ - | -note: instantiated into assembly here - --> <inline asm>:5:1 - | -LL | invalid_instruction3 - | ^^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction4' - --> $DIR/srcloc.rs:114:13 - | -LL | concat!( - | ^ - | -note: instantiated into assembly here - --> <inline asm>:6:1 - | -LL | invalid_instruction4 - | ^^^^^^^^^^^^^^^^^^^^ - -error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:127:14 - | -LL | "invalid_instruction" - | ^ - | -note: instantiated into assembly here - --> <inline asm>:5:1 - | -LL | invalid_instruction - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 24 previous errors; 1 warning emitted - diff --git a/src/test/ui/asm/x86_64/sym.rs b/src/test/ui/asm/x86_64/sym.rs deleted file mode 100644 index 93ef4f090..000000000 --- a/src/test/ui/asm/x86_64/sym.rs +++ /dev/null @@ -1,84 +0,0 @@ -// only-x86_64 -// only-linux -// needs-asm-support -// run-pass - -#![feature(thread_local)] - -use std::arch::asm; - -extern "C" fn f1() -> i32 { - 111 -} - -// The compiler will generate a shim to hide the caller location parameter. -#[track_caller] -fn f2() -> i32 { - 222 -} - -macro_rules! call { - ($func:path) => { - unsafe { - let result: i32; - asm!("call {}", sym $func, - out("rax") result, - out("rcx") _, out("rdx") _, out("rdi") _, out("rsi") _, - out("r8") _, out("r9") _, out("r10") _, out("r11") _, - out("xmm0") _, out("xmm1") _, out("xmm2") _, out("xmm3") _, - out("xmm4") _, out("xmm5") _, out("xmm6") _, out("xmm7") _, - out("xmm8") _, out("xmm9") _, out("xmm10") _, out("xmm11") _, - out("xmm12") _, out("xmm13") _, out("xmm14") _, out("xmm15") _, - ); - result - } - } -} - -macro_rules! static_addr { - ($s:expr) => { - unsafe { - let result: *const u32; - // LEA performs a RIP-relative address calculation and returns the address - asm!("lea {}, [rip + {}]", out(reg) result, sym $s); - result - } - } -} -macro_rules! static_tls_addr { - ($s:expr) => { - unsafe { - let result: *const u32; - asm!( - " - # Load TLS base address - mov {out}, qword ptr fs:[0] - # Calculate the address of sym in the TLS block. The @tpoff - # relocation gives the offset of the symbol from the start - # of the TLS block. - lea {out}, [{out} + {sym}@tpoff] - ", - out = out(reg) result, - sym = sym $s - ); - result - } - } -} - -static S1: u32 = 111; -#[thread_local] -static S2: u32 = 222; - -fn main() { - assert_eq!(call!(f1), 111); - assert_eq!(call!(f2), 222); - assert_eq!(static_addr!(S1), &S1 as *const u32); - assert_eq!(static_tls_addr!(S2), &S2 as *const u32); - std::thread::spawn(|| { - assert_eq!(static_addr!(S1), &S1 as *const u32); - assert_eq!(static_tls_addr!(S2), &S2 as *const u32); - }) - .join() - .unwrap(); -} diff --git a/src/test/ui/asm/x86_64/target-feature-attr.rs b/src/test/ui/asm/x86_64/target-feature-attr.rs deleted file mode 100644 index 14490c3e0..000000000 --- a/src/test/ui/asm/x86_64/target-feature-attr.rs +++ /dev/null @@ -1,42 +0,0 @@ -// only-x86_64 - -#![feature(avx512_target_feature)] - -use std::arch::asm; - -#[target_feature(enable = "avx")] -unsafe fn foo() { - let mut x = 1; - let y = 2; - asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x); - assert_eq!(x, 3); -} - -unsafe fn bar() { - let mut x = 1; - let y = 2; - asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x); - //~^ ERROR: register class `ymm_reg` requires the `avx` target feature - //~| ERROR: register class `ymm_reg` requires the `avx` target feature - //~| ERROR: register class `ymm_reg` requires the `avx` target feature - assert_eq!(x, 3); -} - -#[target_feature(enable = "avx512bw")] -unsafe fn baz() { - let x = 1; - asm!("/* {0} */", in(kreg) x); -} - -unsafe fn baz2() { - let x = 1; - asm!("/* {0} */", in(kreg) x); - //~^ ERROR: register class `kreg` requires at least one of the following target features: avx512bw, avx512f -} - -fn main() { - unsafe { - foo(); - bar(); - } -} diff --git a/src/test/ui/asm/x86_64/target-feature-attr.stderr b/src/test/ui/asm/x86_64/target-feature-attr.stderr deleted file mode 100644 index c852726ee..000000000 --- a/src/test/ui/asm/x86_64/target-feature-attr.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: register class `ymm_reg` requires the `avx` target feature - --> $DIR/target-feature-attr.rs:18:40 - | -LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x); - | ^^^^^^^^^^^^^ - -error: register class `ymm_reg` requires the `avx` target feature - --> $DIR/target-feature-attr.rs:18:55 - | -LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x); - | ^^^^^^^^^^^^^ - -error: register class `ymm_reg` requires the `avx` target feature - --> $DIR/target-feature-attr.rs:18:70 - | -LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x); - | ^^^^^^^^^^^^^^^^^^ - -error: register class `kreg` requires at least one of the following target features: avx512bw, avx512f - --> $DIR/target-feature-attr.rs:33:23 - | -LL | asm!("/* {0} */", in(kreg) x); - | ^^^^^^^^^^ - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/asm/x86_64/type-check-2.rs b/src/test/ui/asm/x86_64/type-check-2.rs deleted file mode 100644 index 80b29ec87..000000000 --- a/src/test/ui/asm/x86_64/type-check-2.rs +++ /dev/null @@ -1,87 +0,0 @@ -// only-x86_64 - -#![feature(repr_simd, never_type)] - -use std::arch::{asm, global_asm}; - -#[repr(simd)] -struct SimdNonCopy(f32, f32, f32, f32); - -fn main() { - unsafe { - // Inputs must be initialized - - let x: u64; - asm!("{}", in(reg) x); - let mut y: u64; - asm!("{}", inout(reg) 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]); - asm!("{}", inout(reg) v[0]); - - // Sym operands must point to a function or static - - const C: i32 = 0; - static S: i32 = 0; - asm!("{}", sym S); - asm!("{}", sym main); - asm!("{}", sym C); - //~^ ERROR invalid `sym` operand - asm!("{}", sym x); - //~^ ERROR invalid `sym` operand - - // Register operands must be Copy - - asm!("{}", in(xmm_reg) SimdNonCopy(0.0, 0.0, 0.0, 0.0)); - //~^ ERROR arguments for inline assembly must be copyable - - // Register operands must be integers, floats, SIMD vectors, pointers or - // function pointers. - - asm!("{}", in(reg) 0i64); - asm!("{}", in(reg) 0f64); - asm!("{}", in(xmm_reg) std::arch::x86_64::_mm_setzero_ps()); - asm!("{}", in(reg) 0 as *const u8); - asm!("{}", in(reg) 0 as *mut u8); - asm!("{}", in(reg) main as fn()); - asm!("{}", in(reg) |x: i32| x); - //~^ ERROR cannot use value of type - asm!("{}", in(reg) vec![0]); - //~^ ERROR cannot use value of type `Vec<i32>` for inline assembly - asm!("{}", in(reg) (1, 2, 3)); - //~^ ERROR cannot use value of type `(i32, i32, i32)` for inline assembly - asm!("{}", in(reg) [1, 2, 3]); - //~^ ERROR cannot use value of type `[i32; 3]` for inline assembly - - // Register inputs (but not outputs) allow references and function types - - let mut f = main; - let mut r = &mut 0; - asm!("{}", in(reg) f); - asm!("{}", inout(reg) f); - //~^ ERROR cannot use value of type `fn() {main}` for inline assembly - asm!("{}", in(reg) r); - asm!("{}", inout(reg) r); - //~^ ERROR cannot use value of type `&mut i32` for inline assembly - let _ = (f, r); - - // Type checks ignore never type - - let u: ! = unreachable!(); - asm!("{}", in(reg) u); - } -} - -// Sym operands must point to a function or static - -const C: i32 = 0; -static S: i32 = 0; -global_asm!("{}", sym S); -global_asm!("{}", sym main); -global_asm!("{}", sym C); -//~^ ERROR invalid `sym` operand diff --git a/src/test/ui/asm/x86_64/type-check-2.stderr b/src/test/ui/asm/x86_64/type-check-2.stderr deleted file mode 100644 index d9ca25519..000000000 --- a/src/test/ui/asm/x86_64/type-check-2.stderr +++ /dev/null @@ -1,83 +0,0 @@ -error: invalid `sym` operand - --> $DIR/type-check-2.rs:35:24 - | -LL | asm!("{}", sym x); - | ^ is a local variable - | - = help: `sym` operands must refer to either a function or a static - -error: invalid `sym` operand - --> $DIR/type-check-2.rs:86: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:33: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:40:32 - | -LL | asm!("{}", in(xmm_reg) 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:52:28: 52:36]` for inline assembly - --> $DIR/type-check-2.rs:52:28 - | -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:54:28 - | -LL | asm!("{}", in(reg) vec![0]); - | ^^^^^^^ - | - = note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly - = 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:56:28 - | -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:58:28 - | -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:66:31 - | -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:69: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: aborting due to 10 previous errors - diff --git a/src/test/ui/asm/x86_64/type-check-3.rs b/src/test/ui/asm/x86_64/type-check-3.rs deleted file mode 100644 index 89c849c75..000000000 --- a/src/test/ui/asm/x86_64/type-check-3.rs +++ /dev/null @@ -1,73 +0,0 @@ -// only-x86_64 -// compile-flags: -C target-feature=+avx512f - -#![feature(asm_const)] - -use std::arch::{asm, global_asm}; - -use std::arch::x86_64::{_mm256_setzero_ps, _mm_setzero_ps}; - -fn main() { - unsafe { - // Types must be listed in the register class. - - asm!("{}", in(reg) 0i128); - //~^ ERROR type `i128` cannot be used with this register class - asm!("{}", in(reg) _mm_setzero_ps()); - //~^ ERROR type `__m128` cannot be used with this register class - asm!("{}", in(reg) _mm256_setzero_ps()); - //~^ ERROR type `__m256` cannot be used with this register class - asm!("{}", in(xmm_reg) 0u8); - //~^ ERROR type `u8` cannot be used with this register class - asm!("{:e}", in(reg) 0i32); - asm!("{}", in(xmm_reg) 0i32); - asm!("{:e}", in(reg) 0f32); - asm!("{}", in(xmm_reg) 0f32); - asm!("{}", in(xmm_reg) _mm_setzero_ps()); - asm!("{:x}", in(ymm_reg) _mm_setzero_ps()); - asm!("{}", in(kreg) 0u16); - asm!("{}", in(kreg) 0u64); - //~^ ERROR `avx512bw` target feature is not enabled - - // Template modifier suggestions for sub-registers - - asm!("{0} {0}", in(reg) 0i16); - //~^ WARN formatting may not be suitable for sub-register argument - asm!("{0} {0:x}", in(reg) 0i16); - //~^ WARN formatting may not be suitable for sub-register argument - asm!("{}", in(reg) 0i32); - //~^ WARN formatting may not be suitable for sub-register argument - asm!("{}", in(reg) 0i64); - asm!("{}", in(ymm_reg) 0i64); - //~^ WARN formatting may not be suitable for sub-register argument - asm!("{}", in(ymm_reg) _mm256_setzero_ps()); - asm!("{:l}", in(reg) 0i16); - asm!("{:l}", in(reg) 0i32); - asm!("{:l}", in(reg) 0i64); - asm!("{:x}", in(ymm_reg) 0i64); - asm!("{:x}", in(ymm_reg) _mm256_setzero_ps()); - - // Suggest different register class for type - - asm!("{}", in(reg) 0i8); - //~^ ERROR type `i8` cannot be used with this register class - asm!("{}", in(reg_byte) 0i8); - - // Split inout operands must have compatible types - - let mut val_i16: i16; - let mut val_f32: f32; - let mut val_u32: u32; - let mut val_u64: u64; - let mut val_ptr: *mut u8; - asm!("{:r}", inout(reg) 0u16 => val_i16); - asm!("{:r}", inout(reg) 0u32 => val_f32); - //~^ ERROR incompatible types for asm inout argument - asm!("{:r}", inout(reg) 0u32 => val_ptr); - //~^ ERROR incompatible types for asm inout argument - asm!("{:r}", inout(reg) main => val_u32); - //~^ ERROR incompatible types for asm inout argument - asm!("{:r}", inout(reg) 0u64 => val_ptr); - asm!("{:r}", inout(reg) main => val_u64); - } -} diff --git a/src/test/ui/asm/x86_64/type-check-3.stderr b/src/test/ui/asm/x86_64/type-check-3.stderr deleted file mode 100644 index 1baf50ff6..000000000 --- a/src/test/ui/asm/x86_64/type-check-3.stderr +++ /dev/null @@ -1,118 +0,0 @@ -error: type `i128` cannot be used with this register class - --> $DIR/type-check-3.rs:14:28 - | -LL | asm!("{}", in(reg) 0i128); - | ^^^^^ - | - = note: register class `reg` supports these types: i16, i32, i64, f32, f64 - -error: type `__m128` cannot be used with this register class - --> $DIR/type-check-3.rs:16:28 - | -LL | asm!("{}", in(reg) _mm_setzero_ps()); - | ^^^^^^^^^^^^^^^^ - | - = note: register class `reg` supports these types: i16, i32, i64, f32, f64 - -error: type `__m256` cannot be used with this register class - --> $DIR/type-check-3.rs:18:28 - | -LL | asm!("{}", in(reg) _mm256_setzero_ps()); - | ^^^^^^^^^^^^^^^^^^^ - | - = note: register class `reg` supports these types: i16, i32, i64, f32, f64 - -error: type `u8` cannot be used with this register class - --> $DIR/type-check-3.rs:20:32 - | -LL | asm!("{}", in(xmm_reg) 0u8); - | ^^^ - | - = note: register class `xmm_reg` supports these types: i32, i64, f32, f64, i8x16, i16x8, i32x4, i64x2, f32x4, f64x2 - -error: `avx512bw` target feature is not enabled - --> $DIR/type-check-3.rs:29:29 - | -LL | asm!("{}", in(kreg) 0u64); - | ^^^^ - | - = note: this is required to use type `u64` with register class `kreg` - -warning: formatting may not be suitable for sub-register argument - --> $DIR/type-check-3.rs:34:15 - | -LL | asm!("{0} {0}", in(reg) 0i16); - | ^^^ ^^^ ---- for this argument - | - = help: use `{0:x}` to have the register formatted as `ax` - = help: or use `{0:r}` to keep the default formatting of `rax` - = note: `#[warn(asm_sub_register)]` on by default - -warning: formatting may not be suitable for sub-register argument - --> $DIR/type-check-3.rs:36:15 - | -LL | asm!("{0} {0:x}", in(reg) 0i16); - | ^^^ ---- for this argument - | - = help: use `{0:x}` to have the register formatted as `ax` - = help: or use `{0:r}` to keep the default formatting of `rax` - -warning: formatting may not be suitable for sub-register argument - --> $DIR/type-check-3.rs:38:15 - | -LL | asm!("{}", in(reg) 0i32); - | ^^ ---- for this argument - | - = help: use `{0:e}` to have the register formatted as `eax` - = help: or use `{0:r}` to keep the default formatting of `rax` - -warning: formatting may not be suitable for sub-register argument - --> $DIR/type-check-3.rs:41:15 - | -LL | asm!("{}", in(ymm_reg) 0i64); - | ^^ ---- for this argument - | - = help: use `{0:x}` to have the register formatted as `xmm0` - = help: or use `{0:y}` to keep the default formatting of `ymm0` - -error: type `i8` cannot be used with this register class - --> $DIR/type-check-3.rs:52:28 - | -LL | asm!("{}", in(reg) 0i8); - | ^^^ - | - = note: register class `reg` supports these types: i16, i32, i64, f32, f64 - = help: consider using the `reg_byte` register class instead - -error: incompatible types for asm inout argument - --> $DIR/type-check-3.rs:64:33 - | -LL | asm!("{:r}", inout(reg) 0u32 => val_f32); - | ^^^^ ^^^^^^^ type `f32` - | | - | type `u32` - | - = note: asm inout arguments must have the same type, unless they are both pointers or integers of the same size - -error: incompatible types for asm inout argument - --> $DIR/type-check-3.rs:66:33 - | -LL | asm!("{:r}", inout(reg) 0u32 => val_ptr); - | ^^^^ ^^^^^^^ type `*mut u8` - | | - | type `u32` - | - = note: asm inout arguments must have the same type, unless they are both pointers or integers of the same size - -error: incompatible types for asm inout argument - --> $DIR/type-check-3.rs:68:33 - | -LL | asm!("{:r}", inout(reg) main => val_u32); - | ^^^^ ^^^^^^^ type `u32` - | | - | type `fn()` - | - = note: asm inout arguments must have the same type, unless they are both pointers or integers of the same size - -error: aborting due to 9 previous errors; 4 warnings emitted - diff --git a/src/test/ui/asm/x86_64/type-check-4.rs b/src/test/ui/asm/x86_64/type-check-4.rs deleted file mode 100644 index 3d5d3807c..000000000 --- a/src/test/ui/asm/x86_64/type-check-4.rs +++ /dev/null @@ -1,28 +0,0 @@ -// only-x86_64 -// compile-flags: -C target-feature=+avx512f - -#![feature(asm_const)] - -use std::arch::{asm, global_asm}; - -use std::arch::x86_64::{_mm256_setzero_ps, _mm_setzero_ps}; - -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/x86_64/type-check-4.stderr b/src/test/ui/asm/x86_64/type-check-4.stderr deleted file mode 100644 index 3875bcc21..000000000 --- a/src/test/ui/asm/x86_64/type-check-4.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0013]: constants cannot refer to statics - --> $DIR/type-check-4.rs:21: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:24: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:27: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`. diff --git a/src/test/ui/asm/x86_64/type-check-5.rs b/src/test/ui/asm/x86_64/type-check-5.rs deleted file mode 100644 index 8198df910..000000000 --- a/src/test/ui/asm/x86_64/type-check-5.rs +++ /dev/null @@ -1,63 +0,0 @@ -// only-x86_64 - -#![feature(repr_simd, never_type)] - -use std::arch::asm; - -#[repr(simd)] -struct SimdNonCopy(f32, f32, f32, f32); - -fn main() { - unsafe { - // Inputs must be initialized - - let x: u64; - asm!("{}", in(reg) x); - //~^ ERROR E0381 - let mut y: u64; - asm!("{}", inout(reg) y); - //~^ ERROR E0381 - 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; - static S: i32 = 0; - asm!("{}", sym S); - asm!("{}", sym main); - - // Register operands must be Copy - - // Register operands must be integers, floats, SIMD vectors, pointers or - // function pointers. - - asm!("{}", in(reg) 0i64); - asm!("{}", in(reg) 0f64); - asm!("{}", in(xmm_reg) std::arch::x86_64::_mm_setzero_ps()); - asm!("{}", in(reg) 0 as *const u8); - asm!("{}", in(reg) 0 as *mut u8); - asm!("{}", in(reg) main as fn()); - - // Register inputs (but not outputs) allow references and function types - - let mut f = main; - let mut r = &mut 0; - asm!("{}", in(reg) f); - asm!("{}", in(reg) r); - let _ = (f, r); - - // Type checks ignore never type - - let u: ! = unreachable!(); - asm!("{}", in(reg) u); - } -} diff --git a/src/test/ui/asm/x86_64/type-check-5.stderr b/src/test/ui/asm/x86_64/type-check-5.stderr deleted file mode 100644 index bd90461e5..000000000 --- a/src/test/ui/asm/x86_64/type-check-5.stderr +++ /dev/null @@ -1,48 +0,0 @@ -error[E0381]: used binding `x` isn't initialized - --> $DIR/type-check-5.rs:15:28 - | -LL | let x: u64; - | - binding declared here but left uninitialized -LL | asm!("{}", in(reg) x); - | ^ `x` used here but it isn't initialized - | -help: consider assigning a value - | -LL | let x: u64 = 0; - | +++ - -error[E0381]: used binding `y` isn't initialized - --> $DIR/type-check-5.rs:18:9 - | -LL | let mut y: u64; - | ----- binding declared here but left uninitialized -LL | asm!("{}", inout(reg) y); - | ^^^^^^^^^^^^^^^^^^^^^^^^ `y` used here but it isn't initialized - | -help: consider assigning a value - | -LL | let mut y: u64 = 0; - | +++ - -error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable - --> $DIR/type-check-5.rs:26: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-5.rs:28: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`. |