about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/asm/aarch64/bad-options.rs39
-rw-r--r--src/test/ui/asm/aarch64/bad-options.stderr84
-rw-r--r--src/test/ui/asm/aarch64/bad-reg.rs59
-rw-r--r--src/test/ui/asm/aarch64/bad-reg.stderr152
-rw-r--r--src/test/ui/asm/aarch64/const.rs42
-rw-r--r--src/test/ui/asm/aarch64/duplicate-options.fixed26
-rw-r--r--src/test/ui/asm/aarch64/duplicate-options.rs26
-rw-r--r--src/test/ui/asm/aarch64/duplicate-options.stderr56
-rw-r--r--src/test/ui/asm/aarch64/interpolated-idents.rs24
-rw-r--r--src/test/ui/asm/aarch64/interpolated-idents.stderr51
-rw-r--r--src/test/ui/asm/aarch64/parse-error.rs129
-rw-r--r--src/test/ui/asm/aarch64/parse-error.stderr444
-rw-r--r--src/test/ui/asm/aarch64/srcloc.rs121
-rw-r--r--src/test/ui/asm/aarch64/srcloc.stderr278
-rw-r--r--src/test/ui/asm/aarch64/sym.rs80
-rw-r--r--src/test/ui/asm/aarch64/type-check-2.rs84
-rw-r--r--src/test/ui/asm/aarch64/type-check-2.stderr103
-rw-r--r--src/test/ui/asm/aarch64/type-check-3.rs115
-rw-r--r--src/test/ui/asm/aarch64/type-check-3.stderr172
-rw-r--r--src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr187
-rw-r--r--src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr187
-rw-r--r--src/test/ui/asm/bad-template.rs35
-rw-r--r--src/test/ui/asm/bad-template.x86_64_mirunsafeck.stderr (renamed from src/test/ui/asm/bad-template.mirunsafeck.stderr)48
-rw-r--r--src/test/ui/asm/bad-template.x86_64_thirunsafeck.stderr (renamed from src/test/ui/asm/bad-template.thirunsafeck.stderr)48
-rw-r--r--src/test/ui/asm/issue-72570.rs2
-rw-r--r--src/test/ui/asm/naked-functions.rs2
-rw-r--r--src/test/ui/asm/noreturn.rs2
-rw-r--r--src/test/ui/asm/rustfix-asm.fixed2
-rw-r--r--src/test/ui/asm/rustfix-asm.rs2
-rw-r--r--src/test/ui/asm/type-check-1.rs4
-rw-r--r--src/test/ui/asm/type-check-1.stderr16
-rw-r--r--src/test/ui/asm/type-check-4.rs2
-rw-r--r--src/test/ui/asm/x86_64/bad-options.rs (renamed from src/test/ui/asm/bad-options.rs)0
-rw-r--r--src/test/ui/asm/x86_64/bad-options.stderr (renamed from src/test/ui/asm/bad-options.stderr)0
-rw-r--r--src/test/ui/asm/x86_64/bad-reg.rs (renamed from src/test/ui/asm/bad-reg.rs)0
-rw-r--r--src/test/ui/asm/x86_64/bad-reg.stderr (renamed from src/test/ui/asm/bad-reg.stderr)0
-rw-r--r--src/test/ui/asm/x86_64/const.rs (renamed from src/test/ui/asm/const.rs)0
-rw-r--r--src/test/ui/asm/x86_64/duplicate-options.fixed (renamed from src/test/ui/asm/duplicate-options.fixed)0
-rw-r--r--src/test/ui/asm/x86_64/duplicate-options.rs (renamed from src/test/ui/asm/duplicate-options.rs)0
-rw-r--r--src/test/ui/asm/x86_64/duplicate-options.stderr (renamed from src/test/ui/asm/duplicate-options.stderr)0
-rw-r--r--src/test/ui/asm/x86_64/interpolated-idents.rs (renamed from src/test/ui/asm/interpolated-idents.rs)0
-rw-r--r--src/test/ui/asm/x86_64/interpolated-idents.stderr (renamed from src/test/ui/asm/interpolated-idents.stderr)0
-rw-r--r--src/test/ui/asm/x86_64/issue-82869.rs (renamed from src/test/ui/asm/issue-82869.rs)0
-rw-r--r--src/test/ui/asm/x86_64/issue-82869.stderr (renamed from src/test/ui/asm/issue-82869.stderr)0
-rw-r--r--src/test/ui/asm/x86_64/parse-error.rs (renamed from src/test/ui/asm/parse-error.rs)0
-rw-r--r--src/test/ui/asm/x86_64/parse-error.stderr (renamed from src/test/ui/asm/parse-error.stderr)0
-rw-r--r--src/test/ui/asm/x86_64/srcloc.rs (renamed from src/test/ui/asm/srcloc.rs)0
-rw-r--r--src/test/ui/asm/x86_64/srcloc.stderr (renamed from src/test/ui/asm/srcloc.stderr)0
-rw-r--r--src/test/ui/asm/x86_64/sym.rs (renamed from src/test/ui/asm/sym.rs)0
-rw-r--r--src/test/ui/asm/x86_64/type-check-2.rs (renamed from src/test/ui/asm/type-check-2.rs)4
-rw-r--r--src/test/ui/asm/x86_64/type-check-2.stderr (renamed from src/test/ui/asm/type-check-2.stderr)20
-rw-r--r--src/test/ui/asm/x86_64/type-check-3.rs (renamed from src/test/ui/asm/type-check-3.rs)0
-rw-r--r--src/test/ui/asm/x86_64/type-check-3.stderr (renamed from src/test/ui/asm/type-check-3.stderr)0
53 files changed, 2570 insertions, 76 deletions
diff --git a/src/test/ui/asm/aarch64/bad-options.rs b/src/test/ui/asm/aarch64/bad-options.rs
new file mode 100644
index 00000000000..8775eba4a78
--- /dev/null
+++ b/src/test/ui/asm/aarch64/bad-options.rs
@@ -0,0 +1,39 @@
+// only-aarch64
+
+#![feature(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("x0") 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/aarch64/bad-options.stderr b/src/test/ui/asm/aarch64/bad-options.stderr
new file mode 100644
index 00000000000..21bcc4a9c7b
--- /dev/null
+++ b/src/test/ui/asm/aarch64/bad-options.stderr
@@ -0,0 +1,84 @@
+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: expected one of `)`, `att_syntax`, or `raw`, found `nomem`
+  --> $DIR/bad-options.rs:28: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:30: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:32: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:34: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:36: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:38: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`
+
+error: aborting due to 13 previous errors
+
diff --git a/src/test/ui/asm/aarch64/bad-reg.rs b/src/test/ui/asm/aarch64/bad-reg.rs
new file mode 100644
index 00000000000..22d0499a1cc
--- /dev/null
+++ b/src/test/ui/asm/aarch64/bad-reg.rs
@@ -0,0 +1,59 @@
+// only-aarch64
+// compile-flags: -C target-feature=+fp
+
+#![feature(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(vreg) foo);
+        //~^ ERROR invalid asm template modifier for this register class
+        asm!("{:r}", in(vreg_low16) 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("x29") foo);
+        //~^ ERROR invalid register `x29`: the frame pointer cannot be used as an operand
+        asm!("", in("sp") foo);
+        //~^ ERROR invalid register `sp`: the stack pointer cannot be used as an operand
+        asm!("", in("xzr") foo);
+        //~^ ERROR invalid register `xzr`: the zero register cannot be used as an operand
+        asm!("", in("x18") foo);
+        //~^ ERROR invalid register `x18`: x18 is used as a reserved register on some targets and cannot be used as an operand for inline asm
+        asm!("", in("x19") foo);
+        //~^ ERROR invalid register `x19`: x19 is used internally by LLVM and cannot be used as an operand for inline asm
+
+        asm!("", in("p0") foo);
+        //~^ ERROR register class `preg` can only be used as a clobber, not as an input or output
+        asm!("", out("p0") _);
+        asm!("{}", in(preg) foo);
+        //~^ ERROR register class `preg` can only be used as a clobber, not as an input or output
+        asm!("{}", out(preg) _);
+        //~^ ERROR register class `preg` 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("x0") foo, in("w0") bar);
+        //~^ ERROR register `x0` conflicts with register `x0`
+        asm!("", in("x0") foo, out("x0") bar);
+        //~^ ERROR register `x0` conflicts with register `x0`
+        asm!("", in("w0") foo, lateout("w0") bar);
+        asm!("", in("v0") foo, in("q0") bar);
+        //~^ ERROR register `v0` conflicts with register `v0`
+        asm!("", in("v0") foo, out("q0") bar);
+        //~^ ERROR register `v0` conflicts with register `v0`
+        asm!("", in("v0") foo, lateout("q0") bar);
+    }
+}
diff --git a/src/test/ui/asm/aarch64/bad-reg.stderr b/src/test/ui/asm/aarch64/bad-reg.stderr
new file mode 100644
index 00000000000..091e6077ef4
--- /dev/null
+++ b/src/test/ui/asm/aarch64/bad-reg.stderr
@@ -0,0 +1,152 @@
+error: invalid register class `foo`: unknown register class
+  --> $DIR/bad-reg.rs:12:20
+   |
+LL |         asm!("{}", in(foo) foo);
+   |                    ^^^^^^^^^^^
+
+error: invalid register `foo`: unknown register
+  --> $DIR/bad-reg.rs:14:18
+   |
+LL |         asm!("", in("foo") foo);
+   |                  ^^^^^^^^^^^^^
+
+error: invalid asm template modifier for this register class
+  --> $DIR/bad-reg.rs:16:15
+   |
+LL |         asm!("{:z}", in(reg) foo);
+   |               ^^^^   ----------- argument
+   |               |
+   |               template modifier
+   |
+   = note: the `reg` register class supports the following template modifiers: `w`, `x`
+
+error: invalid asm template modifier for this register class
+  --> $DIR/bad-reg.rs:18:15
+   |
+LL |         asm!("{:r}", in(vreg) foo);
+   |               ^^^^   ------------ argument
+   |               |
+   |               template modifier
+   |
+   = note: the `vreg` register class supports the following template modifiers: `b`, `h`, `s`, `d`, `q`, `v`
+
+error: invalid asm template modifier for this register class
+  --> $DIR/bad-reg.rs:20:15
+   |
+LL |         asm!("{:r}", in(vreg_low16) foo);
+   |               ^^^^   ------------------ argument
+   |               |
+   |               template modifier
+   |
+   = note: the `vreg_low16` register class supports the following template modifiers: `b`, `h`, `s`, `d`, `q`, `v`
+
+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 `x29`: the frame pointer cannot be used as an operand for inline asm
+  --> $DIR/bad-reg.rs:26:18
+   |
+LL |         asm!("", in("x29") foo);
+   |                  ^^^^^^^^^^^^^
+
+error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm
+  --> $DIR/bad-reg.rs:28:18
+   |
+LL |         asm!("", in("sp") foo);
+   |                  ^^^^^^^^^^^^
+
+error: invalid register `xzr`: the zero register cannot be used as an operand for inline asm
+  --> $DIR/bad-reg.rs:30:18
+   |
+LL |         asm!("", in("xzr") foo);
+   |                  ^^^^^^^^^^^^^
+
+error: invalid register `x18`: x18 is used as a reserved register on some targets and cannot be used as an operand for inline asm
+  --> $DIR/bad-reg.rs:32:18
+   |
+LL |         asm!("", in("x18") foo);
+   |                  ^^^^^^^^^^^^^
+
+error: invalid register `x19`: x19 is used internally by LLVM and cannot be used as an operand for inline asm
+  --> $DIR/bad-reg.rs:34:18
+   |
+LL |         asm!("", in("x19") foo);
+   |                  ^^^^^^^^^^^^^
+
+error: register class `preg` can only be used as a clobber, not as an input or output
+  --> $DIR/bad-reg.rs:37:18
+   |
+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
+   |
+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
+   |
+LL |         asm!("{}", out(preg) _);
+   |                    ^^^^^^^^^^^
+
+error: register `x0` conflicts with register `x0`
+  --> $DIR/bad-reg.rs:48:32
+   |
+LL |         asm!("", in("x0") foo, in("w0") bar);
+   |                  ------------  ^^^^^^^^^^^^ register `x0`
+   |                  |
+   |                  register `x0`
+
+error: register `x0` conflicts with register `x0`
+  --> $DIR/bad-reg.rs:50:32
+   |
+LL |         asm!("", in("x0") foo, out("x0") bar);
+   |                  ------------  ^^^^^^^^^^^^^ register `x0`
+   |                  |
+   |                  register `x0`
+   |
+help: use `lateout` instead of `out` to avoid conflict
+  --> $DIR/bad-reg.rs:50:18
+   |
+LL |         asm!("", in("x0") foo, out("x0") bar);
+   |                  ^^^^^^^^^^^^
+
+error: register `v0` conflicts with register `v0`
+  --> $DIR/bad-reg.rs:53:32
+   |
+LL |         asm!("", in("v0") foo, in("q0") bar);
+   |                  ------------  ^^^^^^^^^^^^ register `v0`
+   |                  |
+   |                  register `v0`
+
+error: register `v0` conflicts with register `v0`
+  --> $DIR/bad-reg.rs:55:32
+   |
+LL |         asm!("", in("v0") foo, out("q0") bar);
+   |                  ------------  ^^^^^^^^^^^^^ register `v0`
+   |                  |
+   |                  register `v0`
+   |
+help: use `lateout` instead of `out` to avoid conflict
+  --> $DIR/bad-reg.rs:55:18
+   |
+LL |         asm!("", in("v0") foo, out("q0") bar);
+   |                  ^^^^^^^^^^^^
+
+error: aborting due to 19 previous errors
+
diff --git a/src/test/ui/asm/aarch64/const.rs b/src/test/ui/asm/aarch64/const.rs
new file mode 100644
index 00000000000..906dcb0ebab
--- /dev/null
+++ b/src/test/ui/asm/aarch64/const.rs
@@ -0,0 +1,42 @@
+// min-llvm-version: 10.0.1
+// only-aarch64
+// run-pass
+// revisions: mirunsafeck thirunsafeck
+// [thirunsafeck]compile-flags: -Z thir-unsafeck
+
+#![feature(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 x0, {}", const 5);
+global_asm!("mov x0, {}", const constfn(5));
+global_asm!("mov x0, {}", const constfn(5) + constfn(5));
diff --git a/src/test/ui/asm/aarch64/duplicate-options.fixed b/src/test/ui/asm/aarch64/duplicate-options.fixed
new file mode 100644
index 00000000000..d95c646e9f9
--- /dev/null
+++ b/src/test/ui/asm/aarch64/duplicate-options.fixed
@@ -0,0 +1,26 @@
+// only-aarch64
+// run-rustfix
+
+#![feature(asm, global_asm)]
+
+fn main() {
+    unsafe {
+        asm!("", options(nomem, ));
+        //~^ ERROR the `nomem` option was already provided
+        asm!("", options(preserves_flags, ));
+        //~^ ERROR the `preserves_flags` option was already provided
+        asm!("", options(nostack, preserves_flags), 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(preserves_flags, ), //~ ERROR the `noreturn` option was already provided
+            options( nostack), //~ ERROR the `nomem` option was already provided
+            options(), //~ ERROR the `noreturn` option was already provided
+        );
+    }
+}
diff --git a/src/test/ui/asm/aarch64/duplicate-options.rs b/src/test/ui/asm/aarch64/duplicate-options.rs
new file mode 100644
index 00000000000..eec356463d4
--- /dev/null
+++ b/src/test/ui/asm/aarch64/duplicate-options.rs
@@ -0,0 +1,26 @@
+// only-aarch64
+// run-rustfix
+
+#![feature(asm, global_asm)]
+
+fn main() {
+    unsafe {
+        asm!("", options(nomem, nomem));
+        //~^ ERROR the `nomem` option was already provided
+        asm!("", options(preserves_flags, preserves_flags));
+        //~^ ERROR the `preserves_flags` option was already provided
+        asm!("", options(nostack, preserves_flags), 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(preserves_flags, 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
+        );
+    }
+}
diff --git a/src/test/ui/asm/aarch64/duplicate-options.stderr b/src/test/ui/asm/aarch64/duplicate-options.stderr
new file mode 100644
index 00000000000..5063b0c1235
--- /dev/null
+++ b/src/test/ui/asm/aarch64/duplicate-options.stderr
@@ -0,0 +1,56 @@
+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 `preserves_flags` option was already provided
+  --> $DIR/duplicate-options.rs:10:43
+   |
+LL |         asm!("", options(preserves_flags, preserves_flags));
+   |                                           ^^^^^^^^^^^^^^^ this option was already provided
+
+error: the `nostack` option was already provided
+  --> $DIR/duplicate-options.rs:12:61
+   |
+LL |         asm!("", options(nostack, preserves_flags), 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:38
+   |
+LL |             options(preserves_flags, 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: aborting due to 9 previous errors
+
diff --git a/src/test/ui/asm/aarch64/interpolated-idents.rs b/src/test/ui/asm/aarch64/interpolated-idents.rs
new file mode 100644
index 00000000000..1cdf0965667
--- /dev/null
+++ b/src/test/ui/asm/aarch64/interpolated-idents.rs
@@ -0,0 +1,24 @@
+// only-aarch64
+
+#![feature(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 $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));
+            //~^ 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 options);
+}
diff --git a/src/test/ui/asm/aarch64/interpolated-idents.stderr b/src/test/ui/asm/aarch64/interpolated-idents.stderr
new file mode 100644
index 00000000000..d1ab13af84e
--- /dev/null
+++ b/src/test/ui/asm/aarch64/interpolated-idents.stderr
@@ -0,0 +1,51 @@
+error: the `nomem` and `readonly` options are mutually exclusive
+  --> $DIR/interpolated-idents.rs:13:13
+   |
+LL |               $options($pure, $nomem, $readonly, $preserves_flags, $noreturn, $nostack));
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | /     m!(in out lateout inout inlateout const sym
+LL | |        pure nomem readonly preserves_flags
+LL | |        noreturn nostack 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));
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | /     m!(in out lateout inout inlateout const sym
+LL | |        pure nomem readonly preserves_flags
+LL | |        noreturn nostack 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 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/aarch64/parse-error.rs b/src/test/ui/asm/aarch64/parse-error.rs
new file mode 100644
index 00000000000..705f6976743
--- /dev/null
+++ b/src/test/ui/asm/aarch64/parse-error.rs
@@ -0,0 +1,129 @@
+// only-aarch64
+
+#![feature(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 argument to `sym` must be a path expression
+        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(foo));
+        //~^ ERROR expected string literal
+        asm!("", clobber_abi("C" foo));
+        //~^ ERROR expected `)`, found `foo`
+        asm!("", clobber_abi("C", foo));
+        //~^ ERROR expected `)`, found `,`
+        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!("", clobber_abi("C"), clobber_abi("C"));
+        //~^ ERROR clobber_abi specified multiple times
+        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("x0") foo);
+        //~^ ERROR explicit register arguments cannot have names
+        asm!("{a}", in("x0") 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("x0") 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("x0") 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
+    }
+}
+
+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 `)`, found `FOO`
+global_asm!("", clobber_abi("C", FOO));
+//~^ ERROR expected `)`, found `,`
+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 specified multiple times
+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/aarch64/parse-error.stderr b/src/test/ui/asm/aarch64/parse-error.stderr
new file mode 100644
index 00000000000..c6aeef5ac9e
--- /dev/null
+++ b/src/test/ui/asm/aarch64/parse-error.stderr
@@ -0,0 +1,444 @@
+error: requires at least a template string argument
+  --> $DIR/parse-error.rs:9:9
+   |
+LL |         asm!();
+   |         ^^^^^^^
+
+error: asm template must be a string literal
+  --> $DIR/parse-error.rs:11:14
+   |
+LL |         asm!(foo);
+   |              ^^^
+
+error: expected token: `,`
+  --> $DIR/parse-error.rs:13:19
+   |
+LL |         asm!("{}" foo);
+   |                   ^^^ expected `,`
+
+error: expected operand, clobber_abi, options, or additional template string
+  --> $DIR/parse-error.rs:15:20
+   |
+LL |         asm!("{}", foo);
+   |                    ^^^ expected operand, clobber_abi, options, or additional template string
+
+error: expected `(`, found `foo`
+  --> $DIR/parse-error.rs:17:23
+   |
+LL |         asm!("{}", in foo);
+   |                       ^^^ expected `(`
+
+error: expected `)`, found `foo`
+  --> $DIR/parse-error.rs:19:27
+   |
+LL |         asm!("{}", in(reg foo));
+   |                           ^^^ expected `)`
+
+error: expected expression, found end of macro arguments
+  --> $DIR/parse-error.rs:21:27
+   |
+LL |         asm!("{}", in(reg));
+   |                           ^ expected expression
+
+error: expected register class or explicit register
+  --> $DIR/parse-error.rs:23:26
+   |
+LL |         asm!("{}", inout(=) foo => bar);
+   |                          ^
+
+error: expected expression, found end of macro arguments
+  --> $DIR/parse-error.rs:25:37
+   |
+LL |         asm!("{}", inout(reg) foo =>);
+   |                                     ^ expected expression
+
+error: expected one of `!`, `,`, `.`, `::`, `?`, `{`, or an operator, found `=>`
+  --> $DIR/parse-error.rs:27:32
+   |
+LL |         asm!("{}", in(reg) foo => bar);
+   |                                ^^ expected one of 7 possible tokens
+
+error: argument to `sym` must be a path expression
+  --> $DIR/parse-error.rs:29:24
+   |
+LL |         asm!("{}", sym foo + bar);
+   |                        ^^^^^^^^^
+
+error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo`
+  --> $DIR/parse-error.rs:31:26
+   |
+LL |         asm!("", options(foo));
+   |                          ^^^ expected one of 9 possible tokens
+
+error: expected one of `)` or `,`, found `foo`
+  --> $DIR/parse-error.rs:33:32
+   |
+LL |         asm!("", options(nomem foo));
+   |                                ^^^ expected one of `)` or `,`
+
+error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo`
+  --> $DIR/parse-error.rs:35:33
+   |
+LL |         asm!("", options(nomem, foo));
+   |                                 ^^^ expected one of 9 possible tokens
+
+error: arguments are not allowed after options
+  --> $DIR/parse-error.rs:37:31
+   |
+LL |         asm!("{}", options(), const foo);
+   |                    ---------  ^^^^^^^^^ argument
+   |                    |
+   |                    previous options
+
+error: expected string literal
+  --> $DIR/parse-error.rs:40:30
+   |
+LL |         asm!("", clobber_abi(foo));
+   |                              ^^^ not a string literal
+
+error: expected `)`, found `foo`
+  --> $DIR/parse-error.rs:42:34
+   |
+LL |         asm!("", clobber_abi("C" foo));
+   |                                  ^^^ expected `)`
+
+error: expected `)`, found `,`
+  --> $DIR/parse-error.rs:44:33
+   |
+LL |         asm!("", clobber_abi("C", foo));
+   |                                 ^ expected `)`
+
+error: arguments are not allowed after clobber_abi
+  --> $DIR/parse-error.rs:46:38
+   |
+LL |         asm!("{}", clobber_abi("C"), const foo);
+   |                    ----------------  ^^^^^^^^^ argument
+   |                    |
+   |                    clobber_abi
+
+error: clobber_abi is not allowed after options
+  --> $DIR/parse-error.rs:49:29
+   |
+LL |         asm!("", options(), clobber_abi("C"));
+   |                  ---------  ^^^^^^^^^^^^^^^^
+   |                  |
+   |                  options
+
+error: clobber_abi is not allowed after options
+  --> $DIR/parse-error.rs:51:31
+   |
+LL |         asm!("{}", options(), clobber_abi("C"), const foo);
+   |                    ---------  ^^^^^^^^^^^^^^^^
+   |                    |
+   |                    options
+
+error: clobber_abi specified multiple times
+  --> $DIR/parse-error.rs:53:36
+   |
+LL |         asm!("", clobber_abi("C"), clobber_abi("C"));
+   |                  ----------------  ^^^^^^^^^^^^^^^^
+   |                  |
+   |                  clobber_abi previously specified here
+
+error: duplicate argument named `a`
+  --> $DIR/parse-error.rs:55:36
+   |
+LL |         asm!("{a}", a = const foo, a = const bar);
+   |                     -------------  ^^^^^^^^^^^^^ duplicate argument
+   |                     |
+   |                     previously here
+
+error: argument never used
+  --> $DIR/parse-error.rs:55: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:60:18
+   |
+LL |         asm!("", a = in("x0") foo);
+   |                  ^^^^^^^^^^^^^^^^
+
+error: named arguments cannot follow explicit register arguments
+  --> $DIR/parse-error.rs:62:35
+   |
+LL |         asm!("{a}", in("x0") foo, a = const bar);
+   |                     ------------  ^^^^^^^^^^^^^ named argument
+   |                     |
+   |                     explicit register argument
+
+error: named arguments cannot follow explicit register arguments
+  --> $DIR/parse-error.rs:65:35
+   |
+LL |         asm!("{a}", in("x0") foo, a = const bar);
+   |                     ------------  ^^^^^^^^^^^^^ named argument
+   |                     |
+   |                     explicit register argument
+
+error: positional arguments cannot follow named arguments or explicit register arguments
+  --> $DIR/parse-error.rs:68:35
+   |
+LL |         asm!("{1}", in("x0") 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:71: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:73: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:75: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:77: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: requires at least a template string argument
+  --> $DIR/parse-error.rs:84:1
+   |
+LL | global_asm!();
+   | ^^^^^^^^^^^^^^
+
+error: asm template must be a string literal
+  --> $DIR/parse-error.rs:86:13
+   |
+LL | global_asm!(FOO);
+   |             ^^^
+
+error: expected token: `,`
+  --> $DIR/parse-error.rs:88:18
+   |
+LL | global_asm!("{}" FOO);
+   |                  ^^^ expected `,`
+
+error: expected operand, options, or additional template string
+  --> $DIR/parse-error.rs:90:19
+   |
+LL | global_asm!("{}", FOO);
+   |                   ^^^ expected operand, options, or additional template string
+
+error: expected expression, found end of macro arguments
+  --> $DIR/parse-error.rs:92:24
+   |
+LL | global_asm!("{}", const);
+   |                        ^ expected expression
+
+error: expected one of `,`, `.`, `?`, or an operator, found `FOO`
+  --> $DIR/parse-error.rs:94: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:96: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:98: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:100: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:102:30
+   |
+LL | global_asm!("{}", options(), const FOO);
+   |                   ---------  ^^^^^^^^^ argument
+   |                   |
+   |                   previous options
+
+error: expected string literal
+  --> $DIR/parse-error.rs:104:29
+   |
+LL | global_asm!("", clobber_abi(FOO));
+   |                             ^^^ not a string literal
+
+error: expected `)`, found `FOO`
+  --> $DIR/parse-error.rs:106:33
+   |
+LL | global_asm!("", clobber_abi("C" FOO));
+   |                                 ^^^ expected `)`
+
+error: expected `)`, found `,`
+  --> $DIR/parse-error.rs:108:32
+   |
+LL | global_asm!("", clobber_abi("C", FOO));
+   |                                ^ expected `)`
+
+error: arguments are not allowed after clobber_abi
+  --> $DIR/parse-error.rs:110: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:110:19
+   |
+LL | global_asm!("{}", clobber_abi("C"), const FOO);
+   |                   ^^^^^^^^^^^^^^^^
+
+error: clobber_abi is not allowed after options
+  --> $DIR/parse-error.rs:113:28
+   |
+LL | global_asm!("", options(), clobber_abi("C"));
+   |                 ---------  ^^^^^^^^^^^^^^^^
+   |                 |
+   |                 options
+
+error: clobber_abi is not allowed after options
+  --> $DIR/parse-error.rs:115:30
+   |
+LL | global_asm!("{}", options(), clobber_abi("C"), const FOO);
+   |                   ---------  ^^^^^^^^^^^^^^^^
+   |                   |
+   |                   options
+
+error: clobber_abi specified multiple times
+  --> $DIR/parse-error.rs:117:35
+   |
+LL | global_asm!("", clobber_abi("C"), clobber_abi("C"));
+   |                 ----------------  ^^^^^^^^^^^^^^^^
+   |                 |
+   |                 clobber_abi previously specified here
+
+error: duplicate argument named `a`
+  --> $DIR/parse-error.rs:119:35
+   |
+LL | global_asm!("{a}", a = const FOO, a = const BAR);
+   |                    -------------  ^^^^^^^^^^^^^ duplicate argument
+   |                    |
+   |                    previously here
+
+error: argument never used
+  --> $DIR/parse-error.rs:119: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`, or `options`, found `""`
+  --> $DIR/parse-error.rs:122:28
+   |
+LL | global_asm!("", options(), "");
+   |                            ^^ expected one of `clobber_abi`, `const`, or `options`
+
+error: expected one of `clobber_abi`, `const`, or `options`, found `"{}"`
+  --> $DIR/parse-error.rs:124:30
+   |
+LL | global_asm!("{}", const FOO, "{}", const FOO);
+   |                              ^^^^ expected one of `clobber_abi`, `const`, or `options`
+
+error: asm template must be a string literal
+  --> $DIR/parse-error.rs:126: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:128: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:37: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:46: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:55: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:55: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:62:45
+   |
+LL |     let mut bar = 0;
+   |      ---------- help: consider using `const` instead of `let`: `const bar`
+...
+LL |         asm!("{a}", in("x0") foo, a = const bar);
+   |                                             ^^^ non-constant value
+
+error[E0435]: attempt to use a non-constant value in a constant
+  --> $DIR/parse-error.rs:65:45
+   |
+LL |     let mut bar = 0;
+   |      ---------- help: consider using `const` instead of `let`: `const bar`
+...
+LL |         asm!("{a}", in("x0") foo, a = const bar);
+   |                                             ^^^ non-constant value
+
+error[E0435]: attempt to use a non-constant value in a constant
+  --> $DIR/parse-error.rs:68:41
+   |
+LL |     let mut bar = 0;
+   |      ---------- help: consider using `const` instead of `let`: `const bar`
+...
+LL |         asm!("{1}", in("x0") foo, const bar);
+   |                                         ^^^ non-constant value
+
+error: aborting due to 63 previous errors
+
+For more information about this error, try `rustc --explain E0435`.
diff --git a/src/test/ui/asm/aarch64/srcloc.rs b/src/test/ui/asm/aarch64/srcloc.rs
new file mode 100644
index 00000000000..58feb526537
--- /dev/null
+++ b/src/test/ui/asm/aarch64/srcloc.rs
@@ -0,0 +1,121 @@
+// min-llvm-version: 10.0.1
+// only-aarch64
+// build-fail
+// compile-flags: -Ccodegen-units=1
+#![feature(asm)]
+
+// Checks that inline asm errors are mapped to the correct line in the source code.
+
+fn main() {
+    unsafe {
+        asm!("invalid_instruction");
+        //~^ ERROR: unrecognized instruction mnemonic
+
+        asm!("
+            invalid_instruction
+        ");
+        //~^^ ERROR: unrecognized instruction mnemonic
+
+        asm!(r#"
+            invalid_instruction
+        "#);
+        //~^^ ERROR: unrecognized instruction mnemonic
+
+        asm!("
+            mov x0, x0
+            invalid_instruction
+            mov x0, x0
+        ");
+        //~^^^ ERROR: unrecognized instruction mnemonic
+
+        asm!(r#"
+            mov x0, x0
+            invalid_instruction
+            mov x0, x0
+        "#);
+        //~^^^ ERROR: unrecognized instruction mnemonic
+
+        asm!(concat!("invalid", "_", "instruction"));
+        //~^ ERROR: unrecognized instruction mnemonic
+
+        asm!(
+            "invalid_instruction",
+        );
+        //~^^ ERROR: unrecognized instruction mnemonic
+
+        asm!(
+            "mov x0, x0",
+            "invalid_instruction",
+            "mov x0, x0",
+        );
+        //~^^^ ERROR: unrecognized instruction mnemonic
+
+        asm!(
+            "mov x0, x0\n",
+            "invalid_instruction",
+            "mov x0, x0",
+        );
+        //~^^^ ERROR: unrecognized instruction mnemonic
+
+        asm!(
+            "mov x0, x0",
+            concat!("invalid", "_", "instruction"),
+            "mov x0, x0",
+        );
+        //~^^^ ERROR: unrecognized instruction mnemonic
+
+        asm!(
+            concat!("mov x0", ", ", "x0"),
+            concat!("invalid", "_", "instruction"),
+            concat!("mov x0", ", ", "x0"),
+        );
+        //~^^^ ERROR: unrecognized instruction mnemonic
+
+        // Make sure template strings get separated
+        asm!(
+            "invalid_instruction1",
+            "invalid_instruction2",
+        );
+        //~^^^ ERROR: unrecognized instruction mnemonic
+        //~^^^ ERROR: unrecognized instruction mnemonic
+
+        asm!(
+            concat!(
+                "invalid", "_", "instruction1", "\n",
+                "invalid", "_", "instruction2",
+            ),
+        );
+        //~^^^^^ ERROR: unrecognized instruction mnemonic
+        //~^^^^^^ ERROR: unrecognized instruction mnemonic
+
+        asm!(
+            concat!(
+                "invalid", "_", "instruction1", "\n",
+                "invalid", "_", "instruction2",
+            ),
+            concat!(
+                "invalid", "_", "instruction3", "\n",
+                "invalid", "_", "instruction4",
+            ),
+        );
+        //~^^^^^^^^^ ERROR: unrecognized instruction mnemonic
+        //~^^^^^^^^^^ ERROR: unrecognized instruction mnemonic
+        //~^^^^^^^ ERROR: unrecognized instruction mnemonic
+        //~^^^^^^^^ ERROR: unrecognized instruction mnemonic
+
+        asm!(
+            concat!(
+                "invalid", "_", "instruction1", "\n",
+                "invalid", "_", "instruction2", "\n",
+            ),
+            concat!(
+                "invalid", "_", "instruction3", "\n",
+                "invalid", "_", "instruction4", "\n",
+            ),
+        );
+        //~^^^^^^^^^ ERROR: unrecognized instruction mnemonic
+        //~^^^^^^^^^^ ERROR: unrecognized instruction mnemonic
+        //~^^^^^^^ ERROR: unrecognized instruction mnemonic
+        //~^^^^^^^^ ERROR: unrecognized instruction mnemonic
+    }
+}
diff --git a/src/test/ui/asm/aarch64/srcloc.stderr b/src/test/ui/asm/aarch64/srcloc.stderr
new file mode 100644
index 00000000000..96dab1bce0b
--- /dev/null
+++ b/src/test/ui/asm/aarch64/srcloc.stderr
@@ -0,0 +1,278 @@
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:11:15
+   |
+LL |         asm!("invalid_instruction");
+   |               ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:1:2
+   |
+LL |     invalid_instruction
+   |     ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:15:13
+   |
+LL |             invalid_instruction
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:2:13
+   |
+LL |             invalid_instruction
+   |             ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:20:13
+   |
+LL |             invalid_instruction
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:2:13
+   |
+LL |             invalid_instruction
+   |             ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:26:13
+   |
+LL |             invalid_instruction
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:3:13
+   |
+LL |             invalid_instruction
+   |             ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:33:13
+   |
+LL |             invalid_instruction
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:3:13
+   |
+LL |             invalid_instruction
+   |             ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:38:14
+   |
+LL |         asm!(concat!("invalid", "_", "instruction"));
+   |              ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:1:2
+   |
+LL |     invalid_instruction
+   |     ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:42:14
+   |
+LL |             "invalid_instruction",
+   |              ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:1:2
+   |
+LL |     invalid_instruction
+   |     ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:48:14
+   |
+LL |             "invalid_instruction",
+   |              ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:2:1
+   |
+LL | invalid_instruction
+   | ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:55:14
+   |
+LL |             "invalid_instruction",
+   |              ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:3:1
+   |
+LL | invalid_instruction
+   | ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:62:13
+   |
+LL |             concat!("invalid", "_", "instruction"),
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:2:1
+   |
+LL | invalid_instruction
+   | ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:69:13
+   |
+LL |             concat!("invalid", "_", "instruction"),
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:2:1
+   |
+LL | invalid_instruction
+   | ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:76:14
+   |
+LL |             "invalid_instruction1",
+   |              ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:1:2
+   |
+LL |     invalid_instruction1
+   |     ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:77:14
+   |
+LL |             "invalid_instruction2",
+   |              ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:2:1
+   |
+LL | invalid_instruction2
+   | ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:83:13
+   |
+LL |             concat!(
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:1:2
+   |
+LL |     invalid_instruction1
+   |     ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:83:13
+   |
+LL |             concat!(
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:2:1
+   |
+LL | invalid_instruction2
+   | ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:92:13
+   |
+LL |             concat!(
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:1:2
+   |
+LL |     invalid_instruction1
+   |     ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:92:13
+   |
+LL |             concat!(
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:2:1
+   |
+LL | invalid_instruction2
+   | ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:96:13
+   |
+LL |             concat!(
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:3:1
+   |
+LL | invalid_instruction3
+   | ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:96:13
+   |
+LL |             concat!(
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:4:1
+   |
+LL | invalid_instruction4
+   | ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:107:13
+   |
+LL |             concat!(
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:1:2
+   |
+LL |     invalid_instruction1
+   |     ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:107:13
+   |
+LL |             concat!(
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:2:1
+   |
+LL | invalid_instruction2
+   | ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:111:13
+   |
+LL |             concat!(
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:4:1
+   |
+LL | invalid_instruction3
+   | ^
+
+error: unrecognized instruction mnemonic
+  --> $DIR/srcloc.rs:111:13
+   |
+LL |             concat!(
+   |             ^
+   |
+note: instantiated into assembly here
+  --> <inline asm>:5:1
+   |
+LL | invalid_instruction4
+   | ^
+
+error: aborting due to 23 previous errors
+
diff --git a/src/test/ui/asm/aarch64/sym.rs b/src/test/ui/asm/aarch64/sym.rs
new file mode 100644
index 00000000000..db732e96b80
--- /dev/null
+++ b/src/test/ui/asm/aarch64/sym.rs
@@ -0,0 +1,80 @@
+// min-llvm-version: 10.0.1
+// only-aarch64
+// only-linux
+// run-pass
+
+#![feature(asm, thread_local)]
+
+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!("bl {}", sym $func,
+                out("w0") result,
+                out("x20") _, out("x21") _, out("x22") _,
+                out("x23") _, out("x24") _, out("x25") _,
+                out("x26") _, out("x27") _, out("x28") _,
+            );
+            result
+        }
+    }
+}
+
+macro_rules! static_addr {
+    ($s:expr) => {
+        unsafe {
+            let result: *const u32;
+            asm!(
+                // ADRP gives the address of a 4KB page from a PC-relative address
+                "adrp {out}, {sym}",
+                // We then add the remaining lower 12 bits
+                "add {out}, {out}, #:lo12:{sym}",
+                out = out(reg) result,
+                sym = sym $s);
+            result
+        }
+    }
+}
+macro_rules! static_tls_addr {
+    ($s:expr) => {
+        unsafe {
+            let result: *const u32;
+            asm!(
+                // Load the thread pointer register
+                "mrs {out}, TPIDR_EL0",
+                // Add the top 12 bits of the symbol's offset
+                "add {out}, {out}, :tprel_hi12:{sym}",
+                // And the bottom 12 bits
+                "add {out}, {out}, :tprel_lo12:{sym}",
+                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/aarch64/type-check-2.rs b/src/test/ui/asm/aarch64/type-check-2.rs
new file mode 100644
index 00000000000..cf25dcb930c
--- /dev/null
+++ b/src/test/ui/asm/aarch64/type-check-2.rs
@@ -0,0 +1,84 @@
+// only-aarch64
+
+#![feature(asm, repr_simd, never_type)]
+
+#[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
+
+        const C: i32 = 0;
+        static S: i32 = 0;
+        asm!("{}", sym S);
+        asm!("{}", sym main);
+        asm!("{}", sym C);
+        //~^ ERROR asm `sym` operand must point to a fn or static
+        asm!("{}", sym x);
+        //~^ ERROR asm `sym` operand must point to a fn or static
+
+        // Register operands must be Copy
+
+        asm!("{:v}", in(vreg) 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!("{:v}", in(vreg) SimdType(0.0, 0.0, 0.0, 0.0));
+        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);
+    }
+}
diff --git a/src/test/ui/asm/aarch64/type-check-2.stderr b/src/test/ui/asm/aarch64/type-check-2.stderr
new file mode 100644
index 00000000000..e8209064d2d
--- /dev/null
+++ b/src/test/ui/asm/aarch64/type-check-2.stderr
@@ -0,0 +1,103 @@
+error: arguments for inline assembly must be copyable
+  --> $DIR/type-check-2.rs:46: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
+   |
+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
+   |
+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:62: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:64: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:72: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:75: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: asm `sym` operand must point to a fn or static
+  --> $DIR/type-check-2.rs:39:24
+   |
+LL |         asm!("{}", sym C);
+   |                        ^
+
+error: asm `sym` operand must point to a fn or static
+  --> $DIR/type-check-2.rs:41:24
+   |
+LL |         asm!("{}", sym x);
+   |                        ^
+
+error[E0381]: use of possibly-uninitialized variable: `x`
+  --> $DIR/type-check-2.rs:17:28
+   |
+LL |         asm!("{}", in(reg) x);
+   |                            ^ use of possibly-uninitialized `x`
+
+error[E0381]: use of possibly-uninitialized variable: `y`
+  --> $DIR/type-check-2.rs:20: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:28: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:30:31
+   |
+LL |         let v: Vec<u64> = vec![0, 1, 2];
+   |             - help: consider changing this to be mutable: `mut v`
+...
+LL |         asm!("{}", inout(reg) v[0]);
+   |                               ^ cannot borrow as mutable
+
+error: aborting due to 13 previous errors
+
+Some errors have detailed explanations: E0381, E0596.
+For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/asm/aarch64/type-check-3.rs b/src/test/ui/asm/aarch64/type-check-3.rs
new file mode 100644
index 00000000000..d0d5954ca4a
--- /dev/null
+++ b/src/test/ui/asm/aarch64/type-check-3.rs
@@ -0,0 +1,115 @@
+// only-aarch64
+// compile-flags: -C target-feature=+neon
+
+#![feature(asm, global_asm, repr_simd, stdsimd)]
+
+use std::arch::aarch64::float64x2_t;
+
+#[repr(simd)]
+#[derive(Copy, Clone)]
+struct Simd256bit(f64, f64,f64, f64);
+
+fn main() {
+    let f64x2: float64x2_t = unsafe { std::mem::transmute(0i128) };
+    let f64x4 = Simd256bit(0.0, 0.0, 0.0, 0.0);
+
+    unsafe {
+        // Types must be listed in the register class.
+
+        // Success cases
+        asm!("{:w}", in(reg) 0u8);
+        asm!("{:w}", in(reg) 0u16);
+        asm!("{:w}", in(reg) 0u32);
+        asm!("{:w}", in(reg) 0f32);
+        asm!("{}", in(reg) 0i64);
+        asm!("{}", in(reg) 0f64);
+
+        asm!("{:b}", in(vreg) 0u8);
+        asm!("{:h}", in(vreg) 0u16);
+        asm!("{:s}", in(vreg) 0u32);
+        asm!("{:s}", in(vreg) 0f32);
+        asm!("{:d}", in(vreg) 0u64);
+        asm!("{:d}", in(vreg) 0f64);
+        asm!("{:q}", in(vreg) f64x2);
+        asm!("{:v}", in(vreg) f64x2);
+
+        // Should be the same as vreg
+        asm!("{:q}", in(vreg_low16) f64x2);
+
+        // Template modifiers of a different size to the argument are fine
+        asm!("{:w}", in(reg) 0u64);
+        asm!("{:x}", in(reg) 0u32);
+        asm!("{:b}", in(vreg) 0u64);
+        asm!("{:d}", in(vreg_low16) f64x2);
+
+
+        // Template modifier suggestions for sub-registers
+
+        asm!("{}", in(reg) 0u8);
+        //~^ WARN formatting may not be suitable for sub-register argument
+        asm!("{}", in(reg) 0u16);
+        //~^ 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) 0f32);
+        //~^ WARN formatting may not be suitable for sub-register argument
+
+        asm!("{}", in(vreg) 0i16);
+        //~^ WARN formatting may not be suitable for sub-register argument
+        asm!("{}", in(vreg) 0f32);
+        //~^ WARN formatting may not be suitable for sub-register argument
+        asm!("{}", in(vreg) 0f64);
+        //~^ WARN formatting may not be suitable for sub-register argument
+        asm!("{}", in(vreg_low16) 0f64);
+        //~^ WARN formatting may not be suitable for sub-register argument
+
+        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
+
+        // Invalid registers
+
+        asm!("{}", in(reg) 0i128);
+        //~^ ERROR type `i128` cannot be used with this register class
+        asm!("{}", in(reg) f64x2);
+        //~^ ERROR type `float64x2_t` cannot be used with this register class
+        asm!("{}", in(vreg) f64x4);
+        //~^ ERROR type `Simd256bit` cannot be used with this register class
+
+        // 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!("{:x}", inout(reg) 0u16 => val_i16);
+        asm!("{:x}", inout(reg) 0u32 => val_f32);
+        //~^ ERROR incompatible types for asm inout argument
+        asm!("{:x}", inout(reg) 0u32 => val_ptr);
+        //~^ ERROR incompatible types for asm inout argument
+        asm!("{:x}", inout(reg) main => val_u32);
+        //~^ ERROR incompatible types for asm inout argument
+        asm!("{:x}", inout(reg) 0u64 => val_ptr);
+        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
new file mode 100644
index 00000000000..c31a62ae791
--- /dev/null
+++ b/src/test/ui/asm/aarch64/type-check-3.stderr
@@ -0,0 +1,172 @@
+warning: formatting may not be suitable for sub-register argument
+  --> $DIR/type-check-3.rs:48:15
+   |
+LL |         asm!("{}", in(reg) 0u8);
+   |               ^^           --- for this argument
+   |
+   = note: `#[warn(asm_sub_register)]` on by default
+   = help: use the `w` modifier to have the register formatted as `w0`
+   = help: or use the `x` modifier to keep the default formatting of `x0`
+
+warning: formatting may not be suitable for sub-register argument
+  --> $DIR/type-check-3.rs:50:15
+   |
+LL |         asm!("{}", in(reg) 0u16);
+   |               ^^           ---- for this argument
+   |
+   = help: use the `w` modifier to have the register formatted as `w0`
+   = help: or use the `x` modifier to keep the default formatting of `x0`
+
+warning: formatting may not be suitable for sub-register argument
+  --> $DIR/type-check-3.rs:52:15
+   |
+LL |         asm!("{}", in(reg) 0i32);
+   |               ^^           ---- for this argument
+   |
+   = help: use the `w` modifier to have the register formatted as `w0`
+   = help: or use the `x` modifier to keep the default formatting of `x0`
+
+warning: formatting may not be suitable for sub-register argument
+  --> $DIR/type-check-3.rs:54:15
+   |
+LL |         asm!("{}", in(reg) 0f32);
+   |               ^^           ---- for this argument
+   |
+   = help: use the `w` modifier to have the register formatted as `w0`
+   = help: or use the `x` modifier to keep the default formatting of `x0`
+
+warning: formatting may not be suitable for sub-register argument
+  --> $DIR/type-check-3.rs:57:15
+   |
+LL |         asm!("{}", in(vreg) 0i16);
+   |               ^^            ---- for this argument
+   |
+   = help: use the `h` modifier to have the register formatted as `h0`
+   = help: or use the `v` modifier to keep the default formatting of `v0`
+
+warning: formatting may not be suitable for sub-register argument
+  --> $DIR/type-check-3.rs:59:15
+   |
+LL |         asm!("{}", in(vreg) 0f32);
+   |               ^^            ---- for this argument
+   |
+   = help: use the `s` modifier to have the register formatted as `s0`
+   = help: or use the `v` modifier to keep the default formatting of `v0`
+
+warning: formatting may not be suitable for sub-register argument
+  --> $DIR/type-check-3.rs:61:15
+   |
+LL |         asm!("{}", in(vreg) 0f64);
+   |               ^^            ---- for this argument
+   |
+   = help: use the `d` modifier to have the register formatted as `d0`
+   = help: or use the `v` modifier to keep the default formatting of `v0`
+
+warning: formatting may not be suitable for sub-register argument
+  --> $DIR/type-check-3.rs:63:15
+   |
+LL |         asm!("{}", in(vreg_low16) 0f64);
+   |               ^^                  ---- for this argument
+   |
+   = help: use the `d` modifier to have the register formatted as `d0`
+   = help: or use the `v` modifier to keep the default formatting of `v0`
+
+warning: formatting may not be suitable for sub-register argument
+  --> $DIR/type-check-3.rs:66:15
+   |
+LL |         asm!("{0} {0}", in(reg) 0i16);
+   |               ^^^ ^^^           ---- for this argument
+   |
+   = help: use the `w` modifier to have the register formatted as `w0`
+   = help: or use the `x` modifier to keep the default formatting of `x0`
+
+warning: formatting may not be suitable for sub-register argument
+  --> $DIR/type-check-3.rs:68:15
+   |
+LL |         asm!("{0} {0:x}", in(reg) 0i16);
+   |               ^^^                 ---- for this argument
+   |
+   = help: use the `w` modifier to have the register formatted as `w0`
+   = help: or use the `x` modifier to keep the default formatting of `x0`
+
+error: type `i128` cannot be used with this register class
+  --> $DIR/type-check-3.rs:73:28
+   |
+LL |         asm!("{}", in(reg) 0i128);
+   |                            ^^^^^
+   |
+   = note: register class `reg` supports these types: i8, i16, i32, i64, f32, f64
+
+error: type `float64x2_t` cannot be used with this register class
+  --> $DIR/type-check-3.rs:75:28
+   |
+LL |         asm!("{}", in(reg) f64x2);
+   |                            ^^^^^
+   |
+   = note: register class `reg` supports these types: i8, i16, i32, i64, f32, f64
+
+error: type `Simd256bit` cannot be used with this register class
+  --> $DIR/type-check-3.rs:77:29
+   |
+LL |         asm!("{}", in(vreg) f64x4);
+   |                             ^^^^^
+   |
+   = note: register class `vreg` supports these types: i8, i16, i32, i64, f32, f64, i8x8, i16x4, i32x2, i64x1, f32x2, f64x1, i8x16, i16x8, i32x4, i64x2, f32x4, f64x2
+
+error: incompatible types for asm inout argument
+  --> $DIR/type-check-3.rs:88:33
+   |
+LL |         asm!("{:x}", 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:90:33
+   |
+LL |         asm!("{:x}", 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:92:33
+   |
+LL |         asm!("{:x}", 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[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
+
+For more information about this error, try `rustc --explain E0013`.
diff --git a/src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr b/src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr
new file mode 100644
index 00000000000..3b1d922a7f7
--- /dev/null
+++ b/src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr
@@ -0,0 +1,187 @@
+error: invalid reference to argument at index 0
+  --> $DIR/bad-template.rs:31:15
+   |
+LL |         asm!("{}");
+   |               ^^ from here
+   |
+   = note: no arguments were given
+
+error: invalid reference to argument at index 1
+  --> $DIR/bad-template.rs:33:15
+   |
+LL |         asm!("{1}", in(reg) foo);
+   |               ^^^ from here
+   |
+   = note: there is 1 argument
+
+error: argument never used
+  --> $DIR/bad-template.rs:33:21
+   |
+LL |         asm!("{1}", in(reg) foo);
+   |                     ^^^^^^^^^^^ argument never used
+   |
+   = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
+
+error: there is no argument named `a`
+  --> $DIR/bad-template.rs:36:15
+   |
+LL |         asm!("{a}");
+   |               ^^^
+
+error: invalid reference to argument at index 0
+  --> $DIR/bad-template.rs:38:15
+   |
+LL |         asm!("{}", a = in(reg) foo);
+   |               ^^   --------------- named argument
+   |               |
+   |               from here
+   |
+   = note: no positional arguments were given
+note: named arguments cannot be referenced by position
+  --> $DIR/bad-template.rs:38:20
+   |
+LL |         asm!("{}", a = in(reg) foo);
+   |                    ^^^^^^^^^^^^^^^
+
+error: named argument never used
+  --> $DIR/bad-template.rs:38:20
+   |
+LL |         asm!("{}", a = in(reg) foo);
+   |                    ^^^^^^^^^^^^^^^ named argument never used
+   |
+   = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
+
+error: invalid reference to argument at index 1
+  --> $DIR/bad-template.rs:41:15
+   |
+LL |         asm!("{1}", a = in(reg) foo);
+   |               ^^^ from here
+   |
+   = note: no positional arguments were given
+
+error: named argument never used
+  --> $DIR/bad-template.rs:41:21
+   |
+LL |         asm!("{1}", a = in(reg) foo);
+   |                     ^^^^^^^^^^^^^^^ named argument never used
+   |
+   = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
+
+error: invalid reference to argument at index 0
+  --> $DIR/bad-template.rs:48:15
+   |
+LL |         asm!("{}", in("x0") foo);
+   |               ^^   ------------ explicit register argument
+   |               |
+   |               from here
+   |
+   = note: no positional arguments were given
+note: explicit register arguments cannot be used in the asm template
+  --> $DIR/bad-template.rs:48:20
+   |
+LL |         asm!("{}", in("x0") foo);
+   |                    ^^^^^^^^^^^^
+
+error: asm template modifier must be a single character
+  --> $DIR/bad-template.rs:50:17
+   |
+LL |         asm!("{:foo}", in(reg) foo);
+   |                 ^^^
+
+error: multiple unused asm arguments
+  --> $DIR/bad-template.rs:52:18
+   |
+LL |         asm!("", in(reg) 0, in(reg) 1);
+   |                  ^^^^^^^^^  ^^^^^^^^^ argument never used
+   |                  |
+   |                  argument never used
+   |
+   = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
+
+error: invalid reference to argument at index 0
+  --> $DIR/bad-template.rs:58:14
+   |
+LL | global_asm!("{}");
+   |              ^^ from here
+   |
+   = note: no arguments were given
+
+error: invalid reference to argument at index 1
+  --> $DIR/bad-template.rs:60:14
+   |
+LL | global_asm!("{1}", const FOO);
+   |              ^^^ from here
+   |
+   = note: there is 1 argument
+
+error: argument never used
+  --> $DIR/bad-template.rs:60:20
+   |
+LL | global_asm!("{1}", const FOO);
+   |                    ^^^^^^^^^ argument never used
+   |
+   = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
+
+error: there is no argument named `a`
+  --> $DIR/bad-template.rs:63:14
+   |
+LL | global_asm!("{a}");
+   |              ^^^
+
+error: invalid reference to argument at index 0
+  --> $DIR/bad-template.rs:65:14
+   |
+LL | global_asm!("{}", a = const FOO);
+   |              ^^   ------------- named argument
+   |              |
+   |              from here
+   |
+   = note: no positional arguments were given
+note: named arguments cannot be referenced by position
+  --> $DIR/bad-template.rs:65:19
+   |
+LL | global_asm!("{}", a = const FOO);
+   |                   ^^^^^^^^^^^^^
+
+error: named argument never used
+  --> $DIR/bad-template.rs:65:19
+   |
+LL | global_asm!("{}", a = const FOO);
+   |                   ^^^^^^^^^^^^^ named argument never used
+   |
+   = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
+
+error: invalid reference to argument at index 1
+  --> $DIR/bad-template.rs:68:14
+   |
+LL | global_asm!("{1}", a = const FOO);
+   |              ^^^ from here
+   |
+   = note: no positional arguments were given
+
+error: named argument never used
+  --> $DIR/bad-template.rs:68:20
+   |
+LL | global_asm!("{1}", a = const FOO);
+   |                    ^^^^^^^^^^^^^ named argument never used
+   |
+   = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
+
+error: asm template modifier must be a single character
+  --> $DIR/bad-template.rs:71:16
+   |
+LL | global_asm!("{:foo}", const FOO);
+   |                ^^^
+
+error: multiple unused asm arguments
+  --> $DIR/bad-template.rs:73:17
+   |
+LL | global_asm!("", const FOO, const FOO);
+   |                 ^^^^^^^^^  ^^^^^^^^^ argument never used
+   |                 |
+   |                 argument never used
+   |
+   = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
+
+error: aborting due to 21 previous errors
+
diff --git a/src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr b/src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr
new file mode 100644
index 00000000000..3b1d922a7f7
--- /dev/null
+++ b/src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr
@@ -0,0 +1,187 @@
+error: invalid reference to argument at index 0
+  --> $DIR/bad-template.rs:31:15
+   |
+LL |         asm!("{}");
+   |               ^^ from here
+   |
+   = note: no arguments were given
+
+error: invalid reference to argument at index 1
+  --> $DIR/bad-template.rs:33:15
+   |
+LL |         asm!("{1}", in(reg) foo);
+   |               ^^^ from here
+   |
+   = note: there is 1 argument
+
+error: argument never used
+  --> $DIR/bad-template.rs:33:21
+   |
+LL |         asm!("{1}", in(reg) foo);
+   |                     ^^^^^^^^^^^ argument never used
+   |
+   = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
+
+error: there is no argument named `a`
+  --> $DIR/bad-template.rs:36:15
+   |
+LL |         asm!("{a}");
+   |               ^^^
+
+error: invalid reference to argument at index 0
+  --> $DIR/bad-template.rs:38:15
+   |
+LL |         asm!("{}", a = in(reg) foo);
+   |               ^^   --------------- named argument
+   |               |
+   |               from here
+   |
+   = note: no positional arguments were given
+note: named arguments cannot be referenced by position
+  --> $DIR/bad-template.rs:38:20
+   |
+LL |         asm!("{}", a = in(reg) foo);
+   |                    ^^^^^^^^^^^^^^^
+
+error: named argument never used
+  --> $DIR/bad-template.rs:38:20
+   |
+LL |         asm!("{}", a = in(reg) foo);
+   |                    ^^^^^^^^^^^^^^^ named argument never used
+   |
+   = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
+
+error: invalid reference to argument at index 1
+  --> $DIR/bad-template.rs:41:15
+   |
+LL |         asm!("{1}", a = in(reg) foo);
+   |               ^^^ from here
+   |
+   = note: no positional arguments were given
+
+error: named argument never used
+  --> $DIR/bad-template.rs:41:21
+   |
+LL |         asm!("{1}", a = in(reg) foo);
+   |                     ^^^^^^^^^^^^^^^ named argument never used
+   |
+   = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
+
+error: invalid reference to argument at index 0
+  --> $DIR/bad-template.rs:48:15
+   |
+LL |         asm!("{}", in("x0") foo);
+   |               ^^   ------------ explicit register argument
+   |               |
+   |               from here
+   |
+   = note: no positional arguments were given
+note: explicit register arguments cannot be used in the asm template
+  --> $DIR/bad-template.rs:48:20
+   |
+LL |         asm!("{}", in("x0") foo);
+   |                    ^^^^^^^^^^^^
+
+error: asm template modifier must be a single character
+  --> $DIR/bad-template.rs:50:17
+   |
+LL |         asm!("{:foo}", in(reg) foo);
+   |                 ^^^
+
+error: multiple unused asm arguments
+  --> $DIR/bad-template.rs:52:18
+   |
+LL |         asm!("", in(reg) 0, in(reg) 1);
+   |                  ^^^^^^^^^  ^^^^^^^^^ argument never used
+   |                  |
+   |                  argument never used
+   |
+   = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
+
+error: invalid reference to argument at index 0
+  --> $DIR/bad-template.rs:58:14
+   |
+LL | global_asm!("{}");
+   |              ^^ from here
+   |
+   = note: no arguments were given
+
+error: invalid reference to argument at index 1
+  --> $DIR/bad-template.rs:60:14
+   |
+LL | global_asm!("{1}", const FOO);
+   |              ^^^ from here
+   |
+   = note: there is 1 argument
+
+error: argument never used
+  --> $DIR/bad-template.rs:60:20
+   |
+LL | global_asm!("{1}", const FOO);
+   |                    ^^^^^^^^^ argument never used
+   |
+   = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
+
+error: there is no argument named `a`
+  --> $DIR/bad-template.rs:63:14
+   |
+LL | global_asm!("{a}");
+   |              ^^^
+
+error: invalid reference to argument at index 0
+  --> $DIR/bad-template.rs:65:14
+   |
+LL | global_asm!("{}", a = const FOO);
+   |              ^^   ------------- named argument
+   |              |
+   |              from here
+   |
+   = note: no positional arguments were given
+note: named arguments cannot be referenced by position
+  --> $DIR/bad-template.rs:65:19
+   |
+LL | global_asm!("{}", a = const FOO);
+   |                   ^^^^^^^^^^^^^
+
+error: named argument never used
+  --> $DIR/bad-template.rs:65:19
+   |
+LL | global_asm!("{}", a = const FOO);
+   |                   ^^^^^^^^^^^^^ named argument never used
+   |
+   = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
+
+error: invalid reference to argument at index 1
+  --> $DIR/bad-template.rs:68:14
+   |
+LL | global_asm!("{1}", a = const FOO);
+   |              ^^^ from here
+   |
+   = note: no positional arguments were given
+
+error: named argument never used
+  --> $DIR/bad-template.rs:68:20
+   |
+LL | global_asm!("{1}", a = const FOO);
+   |                    ^^^^^^^^^^^^^ named argument never used
+   |
+   = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
+
+error: asm template modifier must be a single character
+  --> $DIR/bad-template.rs:71:16
+   |
+LL | global_asm!("{:foo}", const FOO);
+   |                ^^^
+
+error: multiple unused asm arguments
+  --> $DIR/bad-template.rs:73:17
+   |
+LL | global_asm!("", const FOO, const FOO);
+   |                 ^^^^^^^^^  ^^^^^^^^^ argument never used
+   |                 |
+   |                 argument never used
+   |
+   = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
+
+error: aborting due to 21 previous errors
+
diff --git a/src/test/ui/asm/bad-template.rs b/src/test/ui/asm/bad-template.rs
index 5aed2c62f0b..fca77e7aa71 100644
--- a/src/test/ui/asm/bad-template.rs
+++ b/src/test/ui/asm/bad-template.rs
@@ -1,8 +1,29 @@
-// only-x86_64
-// revisions: mirunsafeck thirunsafeck
-// [thirunsafeck]compile-flags: -Z thir-unsafeck
+// revisions: x86_64_mirunsafeck aarch64_mirunsafeck x86_64_thirunsafeck aarch64_thirunsafeck
 
-#![feature(asm, global_asm)]
+// [x86_64_thirunsafeck] compile-flags: -Z thir-unsafeck --target x86_64-unknown-linux-gnu
+// [aarch64_thirunsafeck] compile-flags: -Z thir-unsafeck --target aarch64-unknown-linux-gnu
+// [x86_64_mirunsafeck] compile-flags: --target x86_64-unknown-linux-gnu
+// [aarch64_mirunsafeck] compile-flags: --target aarch64-unknown-linux-gnu
+
+// [x86_64_thirunsafeck] needs-llvm-components: x86
+// [x86_64_mirunsafeck] needs-llvm-components: x86
+// [aarch64_thirunsafeck] needs-llvm-components: aarch64
+// [aarch64_mirunsafeck] needs-llvm-components: aarch64
+
+#![feature(no_core, lang_items, rustc_attrs)]
+#![no_core]
+
+#[rustc_builtin_macro]
+macro_rules! asm {
+    () => {};
+}
+#[rustc_builtin_macro]
+macro_rules! global_asm {
+    () => {};
+}
+
+#[lang = "sized"]
+trait Sized {}
 
 fn main() {
     let mut foo = 0;
@@ -20,8 +41,12 @@ fn main() {
         asm!("{1}", a = in(reg) foo);
         //~^ ERROR invalid reference to argument at index 1
         //~^^ ERROR named argument never used
+        #[cfg(any(x86_64_thirunsafeck, x86_64_mirunsafeck))]
         asm!("{}", in("eax") foo);
-        //~^ ERROR invalid reference to argument at index 0
+        //[x86_64_thirunsafeck,x86_64_mirunsafeck]~^ ERROR invalid reference to argument at index 0
+        #[cfg(any(aarch64_thirunsafeck, aarch64_mirunsafeck))]
+        asm!("{}", in("x0") foo);
+        //[aarch64_thirunsafeck,aarch64_mirunsafeck]~^ ERROR invalid reference to argument at index 0
         asm!("{:foo}", in(reg) foo);
         //~^ ERROR asm template modifier must be a single character
         asm!("", in(reg) 0, in(reg) 1);
diff --git a/src/test/ui/asm/bad-template.mirunsafeck.stderr b/src/test/ui/asm/bad-template.x86_64_mirunsafeck.stderr
index 13ef032ab10..3b69186f1e1 100644
--- a/src/test/ui/asm/bad-template.mirunsafeck.stderr
+++ b/src/test/ui/asm/bad-template.x86_64_mirunsafeck.stderr
@@ -1,5 +1,5 @@
 error: invalid reference to argument at index 0
-  --> $DIR/bad-template.rs:10:15
+  --> $DIR/bad-template.rs:31:15
    |
 LL |         asm!("{}");
    |               ^^ from here
@@ -7,7 +7,7 @@ LL |         asm!("{}");
    = note: no arguments were given
 
 error: invalid reference to argument at index 1
-  --> $DIR/bad-template.rs:12:15
+  --> $DIR/bad-template.rs:33:15
    |
 LL |         asm!("{1}", in(reg) foo);
    |               ^^^ from here
@@ -15,7 +15,7 @@ LL |         asm!("{1}", in(reg) foo);
    = note: there is 1 argument
 
 error: argument never used
-  --> $DIR/bad-template.rs:12:21
+  --> $DIR/bad-template.rs:33:21
    |
 LL |         asm!("{1}", in(reg) foo);
    |                     ^^^^^^^^^^^ argument never used
@@ -23,13 +23,13 @@ LL |         asm!("{1}", in(reg) foo);
    = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
 
 error: there is no argument named `a`
-  --> $DIR/bad-template.rs:15:15
+  --> $DIR/bad-template.rs:36:15
    |
 LL |         asm!("{a}");
    |               ^^^
 
 error: invalid reference to argument at index 0
-  --> $DIR/bad-template.rs:17:15
+  --> $DIR/bad-template.rs:38:15
    |
 LL |         asm!("{}", a = in(reg) foo);
    |               ^^   --------------- named argument
@@ -38,13 +38,13 @@ LL |         asm!("{}", a = in(reg) foo);
    |
    = note: no positional arguments were given
 note: named arguments cannot be referenced by position
-  --> $DIR/bad-template.rs:17:20
+  --> $DIR/bad-template.rs:38:20
    |
 LL |         asm!("{}", a = in(reg) foo);
    |                    ^^^^^^^^^^^^^^^
 
 error: named argument never used
-  --> $DIR/bad-template.rs:17:20
+  --> $DIR/bad-template.rs:38:20
    |
 LL |         asm!("{}", a = in(reg) foo);
    |                    ^^^^^^^^^^^^^^^ named argument never used
@@ -52,7 +52,7 @@ LL |         asm!("{}", a = in(reg) foo);
    = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
 
 error: invalid reference to argument at index 1
-  --> $DIR/bad-template.rs:20:15
+  --> $DIR/bad-template.rs:41:15
    |
 LL |         asm!("{1}", a = in(reg) foo);
    |               ^^^ from here
@@ -60,7 +60,7 @@ LL |         asm!("{1}", a = in(reg) foo);
    = note: no positional arguments were given
 
 error: named argument never used
-  --> $DIR/bad-template.rs:20:21
+  --> $DIR/bad-template.rs:41:21
    |
 LL |         asm!("{1}", a = in(reg) foo);
    |                     ^^^^^^^^^^^^^^^ named argument never used
@@ -68,7 +68,7 @@ LL |         asm!("{1}", a = in(reg) foo);
    = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
 
 error: invalid reference to argument at index 0
-  --> $DIR/bad-template.rs:23:15
+  --> $DIR/bad-template.rs:45:15
    |
 LL |         asm!("{}", in("eax") foo);
    |               ^^   ------------- explicit register argument
@@ -77,19 +77,19 @@ LL |         asm!("{}", in("eax") foo);
    |
    = note: no positional arguments were given
 note: explicit register arguments cannot be used in the asm template
-  --> $DIR/bad-template.rs:23:20
+  --> $DIR/bad-template.rs:45:20
    |
 LL |         asm!("{}", in("eax") foo);
    |                    ^^^^^^^^^^^^^
 
 error: asm template modifier must be a single character
-  --> $DIR/bad-template.rs:25:17
+  --> $DIR/bad-template.rs:50:17
    |
 LL |         asm!("{:foo}", in(reg) foo);
    |                 ^^^
 
 error: multiple unused asm arguments
-  --> $DIR/bad-template.rs:27:18
+  --> $DIR/bad-template.rs:52:18
    |
 LL |         asm!("", in(reg) 0, in(reg) 1);
    |                  ^^^^^^^^^  ^^^^^^^^^ argument never used
@@ -99,7 +99,7 @@ LL |         asm!("", in(reg) 0, in(reg) 1);
    = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
 
 error: invalid reference to argument at index 0
-  --> $DIR/bad-template.rs:33:14
+  --> $DIR/bad-template.rs:58:14
    |
 LL | global_asm!("{}");
    |              ^^ from here
@@ -107,7 +107,7 @@ LL | global_asm!("{}");
    = note: no arguments were given
 
 error: invalid reference to argument at index 1
-  --> $DIR/bad-template.rs:35:14
+  --> $DIR/bad-template.rs:60:14
    |
 LL | global_asm!("{1}", const FOO);
    |              ^^^ from here
@@ -115,7 +115,7 @@ LL | global_asm!("{1}", const FOO);
    = note: there is 1 argument
 
 error: argument never used
-  --> $DIR/bad-template.rs:35:20
+  --> $DIR/bad-template.rs:60:20
    |
 LL | global_asm!("{1}", const FOO);
    |                    ^^^^^^^^^ argument never used
@@ -123,13 +123,13 @@ LL | global_asm!("{1}", const FOO);
    = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
 
 error: there is no argument named `a`
-  --> $DIR/bad-template.rs:38:14
+  --> $DIR/bad-template.rs:63:14
    |
 LL | global_asm!("{a}");
    |              ^^^
 
 error: invalid reference to argument at index 0
-  --> $DIR/bad-template.rs:40:14
+  --> $DIR/bad-template.rs:65:14
    |
 LL | global_asm!("{}", a = const FOO);
    |              ^^   ------------- named argument
@@ -138,13 +138,13 @@ LL | global_asm!("{}", a = const FOO);
    |
    = note: no positional arguments were given
 note: named arguments cannot be referenced by position
-  --> $DIR/bad-template.rs:40:19
+  --> $DIR/bad-template.rs:65:19
    |
 LL | global_asm!("{}", a = const FOO);
    |                   ^^^^^^^^^^^^^
 
 error: named argument never used
-  --> $DIR/bad-template.rs:40:19
+  --> $DIR/bad-template.rs:65:19
    |
 LL | global_asm!("{}", a = const FOO);
    |                   ^^^^^^^^^^^^^ named argument never used
@@ -152,7 +152,7 @@ LL | global_asm!("{}", a = const FOO);
    = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
 
 error: invalid reference to argument at index 1
-  --> $DIR/bad-template.rs:43:14
+  --> $DIR/bad-template.rs:68:14
    |
 LL | global_asm!("{1}", a = const FOO);
    |              ^^^ from here
@@ -160,7 +160,7 @@ LL | global_asm!("{1}", a = const FOO);
    = note: no positional arguments were given
 
 error: named argument never used
-  --> $DIR/bad-template.rs:43:20
+  --> $DIR/bad-template.rs:68:20
    |
 LL | global_asm!("{1}", a = const FOO);
    |                    ^^^^^^^^^^^^^ named argument never used
@@ -168,13 +168,13 @@ LL | global_asm!("{1}", a = const FOO);
    = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
 
 error: asm template modifier must be a single character
-  --> $DIR/bad-template.rs:46:16
+  --> $DIR/bad-template.rs:71:16
    |
 LL | global_asm!("{:foo}", const FOO);
    |                ^^^
 
 error: multiple unused asm arguments
-  --> $DIR/bad-template.rs:48:17
+  --> $DIR/bad-template.rs:73:17
    |
 LL | global_asm!("", const FOO, const FOO);
    |                 ^^^^^^^^^  ^^^^^^^^^ argument never used
diff --git a/src/test/ui/asm/bad-template.thirunsafeck.stderr b/src/test/ui/asm/bad-template.x86_64_thirunsafeck.stderr
index 13ef032ab10..3b69186f1e1 100644
--- a/src/test/ui/asm/bad-template.thirunsafeck.stderr
+++ b/src/test/ui/asm/bad-template.x86_64_thirunsafeck.stderr
@@ -1,5 +1,5 @@
 error: invalid reference to argument at index 0
-  --> $DIR/bad-template.rs:10:15
+  --> $DIR/bad-template.rs:31:15
    |
 LL |         asm!("{}");
    |               ^^ from here
@@ -7,7 +7,7 @@ LL |         asm!("{}");
    = note: no arguments were given
 
 error: invalid reference to argument at index 1
-  --> $DIR/bad-template.rs:12:15
+  --> $DIR/bad-template.rs:33:15
    |
 LL |         asm!("{1}", in(reg) foo);
    |               ^^^ from here
@@ -15,7 +15,7 @@ LL |         asm!("{1}", in(reg) foo);
    = note: there is 1 argument
 
 error: argument never used
-  --> $DIR/bad-template.rs:12:21
+  --> $DIR/bad-template.rs:33:21
    |
 LL |         asm!("{1}", in(reg) foo);
    |                     ^^^^^^^^^^^ argument never used
@@ -23,13 +23,13 @@ LL |         asm!("{1}", in(reg) foo);
    = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
 
 error: there is no argument named `a`
-  --> $DIR/bad-template.rs:15:15
+  --> $DIR/bad-template.rs:36:15
    |
 LL |         asm!("{a}");
    |               ^^^
 
 error: invalid reference to argument at index 0
-  --> $DIR/bad-template.rs:17:15
+  --> $DIR/bad-template.rs:38:15
    |
 LL |         asm!("{}", a = in(reg) foo);
    |               ^^   --------------- named argument
@@ -38,13 +38,13 @@ LL |         asm!("{}", a = in(reg) foo);
    |
    = note: no positional arguments were given
 note: named arguments cannot be referenced by position
-  --> $DIR/bad-template.rs:17:20
+  --> $DIR/bad-template.rs:38:20
    |
 LL |         asm!("{}", a = in(reg) foo);
    |                    ^^^^^^^^^^^^^^^
 
 error: named argument never used
-  --> $DIR/bad-template.rs:17:20
+  --> $DIR/bad-template.rs:38:20
    |
 LL |         asm!("{}", a = in(reg) foo);
    |                    ^^^^^^^^^^^^^^^ named argument never used
@@ -52,7 +52,7 @@ LL |         asm!("{}", a = in(reg) foo);
    = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
 
 error: invalid reference to argument at index 1
-  --> $DIR/bad-template.rs:20:15
+  --> $DIR/bad-template.rs:41:15
    |
 LL |         asm!("{1}", a = in(reg) foo);
    |               ^^^ from here
@@ -60,7 +60,7 @@ LL |         asm!("{1}", a = in(reg) foo);
    = note: no positional arguments were given
 
 error: named argument never used
-  --> $DIR/bad-template.rs:20:21
+  --> $DIR/bad-template.rs:41:21
    |
 LL |         asm!("{1}", a = in(reg) foo);
    |                     ^^^^^^^^^^^^^^^ named argument never used
@@ -68,7 +68,7 @@ LL |         asm!("{1}", a = in(reg) foo);
    = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
 
 error: invalid reference to argument at index 0
-  --> $DIR/bad-template.rs:23:15
+  --> $DIR/bad-template.rs:45:15
    |
 LL |         asm!("{}", in("eax") foo);
    |               ^^   ------------- explicit register argument
@@ -77,19 +77,19 @@ LL |         asm!("{}", in("eax") foo);
    |
    = note: no positional arguments were given
 note: explicit register arguments cannot be used in the asm template
-  --> $DIR/bad-template.rs:23:20
+  --> $DIR/bad-template.rs:45:20
    |
 LL |         asm!("{}", in("eax") foo);
    |                    ^^^^^^^^^^^^^
 
 error: asm template modifier must be a single character
-  --> $DIR/bad-template.rs:25:17
+  --> $DIR/bad-template.rs:50:17
    |
 LL |         asm!("{:foo}", in(reg) foo);
    |                 ^^^
 
 error: multiple unused asm arguments
-  --> $DIR/bad-template.rs:27:18
+  --> $DIR/bad-template.rs:52:18
    |
 LL |         asm!("", in(reg) 0, in(reg) 1);
    |                  ^^^^^^^^^  ^^^^^^^^^ argument never used
@@ -99,7 +99,7 @@ LL |         asm!("", in(reg) 0, in(reg) 1);
    = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
 
 error: invalid reference to argument at index 0
-  --> $DIR/bad-template.rs:33:14
+  --> $DIR/bad-template.rs:58:14
    |
 LL | global_asm!("{}");
    |              ^^ from here
@@ -107,7 +107,7 @@ LL | global_asm!("{}");
    = note: no arguments were given
 
 error: invalid reference to argument at index 1
-  --> $DIR/bad-template.rs:35:14
+  --> $DIR/bad-template.rs:60:14
    |
 LL | global_asm!("{1}", const FOO);
    |              ^^^ from here
@@ -115,7 +115,7 @@ LL | global_asm!("{1}", const FOO);
    = note: there is 1 argument
 
 error: argument never used
-  --> $DIR/bad-template.rs:35:20
+  --> $DIR/bad-template.rs:60:20
    |
 LL | global_asm!("{1}", const FOO);
    |                    ^^^^^^^^^ argument never used
@@ -123,13 +123,13 @@ LL | global_asm!("{1}", const FOO);
    = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
 
 error: there is no argument named `a`
-  --> $DIR/bad-template.rs:38:14
+  --> $DIR/bad-template.rs:63:14
    |
 LL | global_asm!("{a}");
    |              ^^^
 
 error: invalid reference to argument at index 0
-  --> $DIR/bad-template.rs:40:14
+  --> $DIR/bad-template.rs:65:14
    |
 LL | global_asm!("{}", a = const FOO);
    |              ^^   ------------- named argument
@@ -138,13 +138,13 @@ LL | global_asm!("{}", a = const FOO);
    |
    = note: no positional arguments were given
 note: named arguments cannot be referenced by position
-  --> $DIR/bad-template.rs:40:19
+  --> $DIR/bad-template.rs:65:19
    |
 LL | global_asm!("{}", a = const FOO);
    |                   ^^^^^^^^^^^^^
 
 error: named argument never used
-  --> $DIR/bad-template.rs:40:19
+  --> $DIR/bad-template.rs:65:19
    |
 LL | global_asm!("{}", a = const FOO);
    |                   ^^^^^^^^^^^^^ named argument never used
@@ -152,7 +152,7 @@ LL | global_asm!("{}", a = const FOO);
    = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
 
 error: invalid reference to argument at index 1
-  --> $DIR/bad-template.rs:43:14
+  --> $DIR/bad-template.rs:68:14
    |
 LL | global_asm!("{1}", a = const FOO);
    |              ^^^ from here
@@ -160,7 +160,7 @@ LL | global_asm!("{1}", a = const FOO);
    = note: no positional arguments were given
 
 error: named argument never used
-  --> $DIR/bad-template.rs:43:20
+  --> $DIR/bad-template.rs:68:20
    |
 LL | global_asm!("{1}", a = const FOO);
    |                    ^^^^^^^^^^^^^ named argument never used
@@ -168,13 +168,13 @@ LL | global_asm!("{1}", a = const FOO);
    = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
 
 error: asm template modifier must be a single character
-  --> $DIR/bad-template.rs:46:16
+  --> $DIR/bad-template.rs:71:16
    |
 LL | global_asm!("{:foo}", const FOO);
    |                ^^^
 
 error: multiple unused asm arguments
-  --> $DIR/bad-template.rs:48:17
+  --> $DIR/bad-template.rs:73:17
    |
 LL | global_asm!("", const FOO, const FOO);
    |                 ^^^^^^^^^  ^^^^^^^^^ argument never used
diff --git a/src/test/ui/asm/issue-72570.rs b/src/test/ui/asm/issue-72570.rs
index 678534657cb..960f7427e34 100644
--- a/src/test/ui/asm/issue-72570.rs
+++ b/src/test/ui/asm/issue-72570.rs
@@ -1,5 +1,5 @@
 // compile-flags: -Zsave-analysis
-// only-x86_64
+// needs-asm-support
 // Also test for #72960
 
 #![feature(asm)]
diff --git a/src/test/ui/asm/naked-functions.rs b/src/test/ui/asm/naked-functions.rs
index 72918a14117..2958574c9a3 100644
--- a/src/test/ui/asm/naked-functions.rs
+++ b/src/test/ui/asm/naked-functions.rs
@@ -1,4 +1,4 @@
-// only-x86_64
+// needs-asm-support
 #![feature(asm)]
 #![feature(llvm_asm)]
 #![feature(naked_functions)]
diff --git a/src/test/ui/asm/noreturn.rs b/src/test/ui/asm/noreturn.rs
index 5e1ee93bfb0..cb92ff0ad1d 100644
--- a/src/test/ui/asm/noreturn.rs
+++ b/src/test/ui/asm/noreturn.rs
@@ -1,4 +1,4 @@
-// only-x86_64
+// needs-asm-support
 // check-pass
 
 #![feature(asm, never_type)]
diff --git a/src/test/ui/asm/rustfix-asm.fixed b/src/test/ui/asm/rustfix-asm.fixed
index 9251afd3f05..1d5d2038aa8 100644
--- a/src/test/ui/asm/rustfix-asm.fixed
+++ b/src/test/ui/asm/rustfix-asm.fixed
@@ -1,5 +1,5 @@
 // run-rustfix
-// only-x86_64
+// needs-asm-support
 
 #![feature(asm, llvm_asm)]
 #![allow(deprecated)] // llvm_asm!
diff --git a/src/test/ui/asm/rustfix-asm.rs b/src/test/ui/asm/rustfix-asm.rs
index 1e3bfd07708..12be0e666ee 100644
--- a/src/test/ui/asm/rustfix-asm.rs
+++ b/src/test/ui/asm/rustfix-asm.rs
@@ -1,5 +1,5 @@
 // run-rustfix
-// only-x86_64
+// needs-asm-support
 
 #![feature(asm, llvm_asm)]
 #![allow(deprecated)] // llvm_asm!
diff --git a/src/test/ui/asm/type-check-1.rs b/src/test/ui/asm/type-check-1.rs
index 5e38fb70a4a..79887926bb1 100644
--- a/src/test/ui/asm/type-check-1.rs
+++ b/src/test/ui/asm/type-check-1.rs
@@ -1,4 +1,4 @@
-// only-x86_64
+// needs-asm-support
 
 #![feature(asm, global_asm)]
 
@@ -49,6 +49,8 @@ fn main() {
         //~^ ERROR mismatched types
         asm!("{}", const 0 as *mut u8);
         //~^ ERROR mismatched types
+        asm!("{}", const &0);
+        //~^ ERROR mismatched types
     }
 }
 
diff --git a/src/test/ui/asm/type-check-1.stderr b/src/test/ui/asm/type-check-1.stderr
index 5edbcf4a2a7..7f25e81af07 100644
--- a/src/test/ui/asm/type-check-1.stderr
+++ b/src/test/ui/asm/type-check-1.stderr
@@ -40,6 +40,18 @@ LL |         asm!("{}", const 0 as *mut u8);
    = note:     expected type `{integer}`
            found raw pointer `*mut u8`
 
+error[E0308]: mismatched types
+  --> $DIR/type-check-1.rs:54:26
+   |
+LL |         asm!("{}", const &0);
+   |                          ^^ expected integer, found `&{integer}`
+   |
+help: consider removing the borrow
+   |
+LL -         asm!("{}", const &0);
+LL +         asm!("{}", const 0);
+   | 
+
 error: invalid asm output
   --> $DIR/type-check-1.rs:10:29
    |
@@ -86,7 +98,7 @@ LL | global_asm!("{}", const 0f32);
    |                         ^^^^ expected integer, found `f32`
 
 error[E0308]: mismatched types
-  --> $DIR/type-check-1.rs:62:25
+  --> $DIR/type-check-1.rs:64:25
    |
 LL | global_asm!("{}", const 0 as *mut u8);
    |                         ^^^^^^^^^^^^ expected integer, found *-ptr
@@ -94,7 +106,7 @@ LL | global_asm!("{}", const 0 as *mut u8);
    = note:     expected type `{integer}`
            found raw pointer `*mut u8`
 
-error: aborting due to 12 previous errors
+error: aborting due to 13 previous errors
 
 Some errors have detailed explanations: E0277, E0308, E0435.
 For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/asm/type-check-4.rs b/src/test/ui/asm/type-check-4.rs
index 2be627c1165..0aa7cdde142 100644
--- a/src/test/ui/asm/type-check-4.rs
+++ b/src/test/ui/asm/type-check-4.rs
@@ -1,4 +1,4 @@
-// only-x86_64
+// needs-asm-support
 
 #![feature(asm)]
 
diff --git a/src/test/ui/asm/bad-options.rs b/src/test/ui/asm/x86_64/bad-options.rs
index dc61d1612e8..dc61d1612e8 100644
--- a/src/test/ui/asm/bad-options.rs
+++ b/src/test/ui/asm/x86_64/bad-options.rs
diff --git a/src/test/ui/asm/bad-options.stderr b/src/test/ui/asm/x86_64/bad-options.stderr
index 8cfd450ab02..8cfd450ab02 100644
--- a/src/test/ui/asm/bad-options.stderr
+++ b/src/test/ui/asm/x86_64/bad-options.stderr
diff --git a/src/test/ui/asm/bad-reg.rs b/src/test/ui/asm/x86_64/bad-reg.rs
index 06af08fab80..06af08fab80 100644
--- a/src/test/ui/asm/bad-reg.rs
+++ b/src/test/ui/asm/x86_64/bad-reg.rs
diff --git a/src/test/ui/asm/bad-reg.stderr b/src/test/ui/asm/x86_64/bad-reg.stderr
index 14740bf62f8..14740bf62f8 100644
--- a/src/test/ui/asm/bad-reg.stderr
+++ b/src/test/ui/asm/x86_64/bad-reg.stderr
diff --git a/src/test/ui/asm/const.rs b/src/test/ui/asm/x86_64/const.rs
index d4de9abb8ca..d4de9abb8ca 100644
--- a/src/test/ui/asm/const.rs
+++ b/src/test/ui/asm/x86_64/const.rs
diff --git a/src/test/ui/asm/duplicate-options.fixed b/src/test/ui/asm/x86_64/duplicate-options.fixed
index d4444e9c6cc..d4444e9c6cc 100644
--- a/src/test/ui/asm/duplicate-options.fixed
+++ b/src/test/ui/asm/x86_64/duplicate-options.fixed
diff --git a/src/test/ui/asm/duplicate-options.rs b/src/test/ui/asm/x86_64/duplicate-options.rs
index fd28311984b..fd28311984b 100644
--- a/src/test/ui/asm/duplicate-options.rs
+++ b/src/test/ui/asm/x86_64/duplicate-options.rs
diff --git a/src/test/ui/asm/duplicate-options.stderr b/src/test/ui/asm/x86_64/duplicate-options.stderr
index 53edf8fb91c..53edf8fb91c 100644
--- a/src/test/ui/asm/duplicate-options.stderr
+++ b/src/test/ui/asm/x86_64/duplicate-options.stderr
diff --git a/src/test/ui/asm/interpolated-idents.rs b/src/test/ui/asm/x86_64/interpolated-idents.rs
index f4cb749307d..f4cb749307d 100644
--- a/src/test/ui/asm/interpolated-idents.rs
+++ b/src/test/ui/asm/x86_64/interpolated-idents.rs
diff --git a/src/test/ui/asm/interpolated-idents.stderr b/src/test/ui/asm/x86_64/interpolated-idents.stderr
index 5de8d20547e..5de8d20547e 100644
--- a/src/test/ui/asm/interpolated-idents.stderr
+++ b/src/test/ui/asm/x86_64/interpolated-idents.stderr
diff --git a/src/test/ui/asm/issue-82869.rs b/src/test/ui/asm/x86_64/issue-82869.rs
index a8e688cbe1f..a8e688cbe1f 100644
--- a/src/test/ui/asm/issue-82869.rs
+++ b/src/test/ui/asm/x86_64/issue-82869.rs
diff --git a/src/test/ui/asm/issue-82869.stderr b/src/test/ui/asm/x86_64/issue-82869.stderr
index d05714ea6f2..d05714ea6f2 100644
--- a/src/test/ui/asm/issue-82869.stderr
+++ b/src/test/ui/asm/x86_64/issue-82869.stderr
diff --git a/src/test/ui/asm/parse-error.rs b/src/test/ui/asm/x86_64/parse-error.rs
index fa14c52cf0a..fa14c52cf0a 100644
--- a/src/test/ui/asm/parse-error.rs
+++ b/src/test/ui/asm/x86_64/parse-error.rs
diff --git a/src/test/ui/asm/parse-error.stderr b/src/test/ui/asm/x86_64/parse-error.stderr
index 78d342cc1da..78d342cc1da 100644
--- a/src/test/ui/asm/parse-error.stderr
+++ b/src/test/ui/asm/x86_64/parse-error.stderr
diff --git a/src/test/ui/asm/srcloc.rs b/src/test/ui/asm/x86_64/srcloc.rs
index ed8cefc58b7..ed8cefc58b7 100644
--- a/src/test/ui/asm/srcloc.rs
+++ b/src/test/ui/asm/x86_64/srcloc.rs
diff --git a/src/test/ui/asm/srcloc.stderr b/src/test/ui/asm/x86_64/srcloc.stderr
index b62c8948289..b62c8948289 100644
--- a/src/test/ui/asm/srcloc.stderr
+++ b/src/test/ui/asm/x86_64/srcloc.stderr
diff --git a/src/test/ui/asm/sym.rs b/src/test/ui/asm/x86_64/sym.rs
index 634ef010e6f..634ef010e6f 100644
--- a/src/test/ui/asm/sym.rs
+++ b/src/test/ui/asm/x86_64/sym.rs
diff --git a/src/test/ui/asm/type-check-2.rs b/src/test/ui/asm/x86_64/type-check-2.rs
index c70a8802814..2311f86d340 100644
--- a/src/test/ui/asm/type-check-2.rs
+++ b/src/test/ui/asm/x86_64/type-check-2.rs
@@ -26,10 +26,6 @@ fn main() {
         asm!("{}", inout(reg) v[0]);
         //~^ ERROR cannot borrow `v` as mutable, as it is not declared as mutable
 
-        // This currently causes an ICE: https://github.com/rust-lang/rust/issues/81857
-        // asm!("{}", const &0);
-        // ERROR asm `const` arguments must be integer or floating-point values
-
         // Sym operands must point to a function or static
 
         const C: i32 = 0;
diff --git a/src/test/ui/asm/type-check-2.stderr b/src/test/ui/asm/x86_64/type-check-2.stderr
index 1354a9dd849..b82a0b8e2ba 100644
--- a/src/test/ui/asm/type-check-2.stderr
+++ b/src/test/ui/asm/x86_64/type-check-2.stderr
@@ -1,13 +1,13 @@
 error: arguments for inline assembly must be copyable
-  --> $DIR/type-check-2.rs:46:32
+  --> $DIR/type-check-2.rs:42: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: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:54:28: 54:38]` for inline assembly
+  --> $DIR/type-check-2.rs:54:28
    |
 LL |         asm!("{}", in(reg) |x: i32| x);
    |                            ^^^^^^^^^^
@@ -15,7 +15,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:56:28
    |
 LL |         asm!("{}", in(reg) vec![0]);
    |                            ^^^^^^^
@@ -24,7 +24,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:58:28
    |
 LL |         asm!("{}", in(reg) (1, 2, 3));
    |                            ^^^^^^^^^
@@ -32,7 +32,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:60:28
    |
 LL |         asm!("{}", in(reg) [1, 2, 3]);
    |                            ^^^^^^^^^
@@ -40,7 +40,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:68:31
    |
 LL |         asm!("{}", inout(reg) f);
    |                               ^
@@ -48,7 +48,7 @@ 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:71:31
    |
 LL |         asm!("{}", inout(reg) r);
    |                               ^
@@ -56,13 +56,13 @@ LL |         asm!("{}", inout(reg) r);
    = note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
 
 error: asm `sym` operand must point to a fn or static
-  --> $DIR/type-check-2.rs:39:24
+  --> $DIR/type-check-2.rs:35:24
    |
 LL |         asm!("{}", sym C);
    |                        ^
 
 error: asm `sym` operand must point to a fn or static
-  --> $DIR/type-check-2.rs:41:24
+  --> $DIR/type-check-2.rs:37:24
    |
 LL |         asm!("{}", sym x);
    |                        ^
diff --git a/src/test/ui/asm/type-check-3.rs b/src/test/ui/asm/x86_64/type-check-3.rs
index c2c1885ff16..c2c1885ff16 100644
--- a/src/test/ui/asm/type-check-3.rs
+++ b/src/test/ui/asm/x86_64/type-check-3.rs
diff --git a/src/test/ui/asm/type-check-3.stderr b/src/test/ui/asm/x86_64/type-check-3.stderr
index 9f6989ca03d..9f6989ca03d 100644
--- a/src/test/ui/asm/type-check-3.stderr
+++ b/src/test/ui/asm/x86_64/type-check-3.stderr