[llvm-branch-commits] [llvm] [RISC-V][MC] Convert remaining diagnostic tests to llvm-mc --verify (PR #238223)

Alexander Richardson via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Nov 6 16:03:47 PST 2026


https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/238223

>From 0def27ea59ef3defd76c75b27df188d7a4fdf63f Mon Sep 17 00:00:00 2001
From: Alex Richardson <alexrichardson at google.com>
Date: Mon, 2 Nov 2026 22:37:22 -0800
Subject: [PATCH] [nspr] initial commit

---
 llvm/test/MC/RISCV/fixups-invalid.s      |  15 +-
 llvm/test/MC/RISCV/rv32c-only-valid.s    |  36 ++-
 llvm/test/MC/RISCV/rv32dc-valid.s        |  17 +-
 llvm/test/MC/RISCV/rv32fc-valid.s        |  28 +--
 llvm/test/MC/RISCV/rv32i-invalid.s       | 295 ++++++++++++-----------
 llvm/test/MC/RISCV/rv64c-invalid.s       |  50 ++--
 llvm/test/MC/RISCV/rv64c-valid.s         |  47 ++--
 llvm/test/MC/RISCV/rv64dc-valid.s        |  17 +-
 llvm/test/MC/RISCV/rv64zacas-valid.s     |  25 +-
 llvm/test/MC/RISCV/rv64zcb-valid.s       |  14 +-
 llvm/test/MC/RISCV/rvc-valid.s           |  80 +++---
 llvm/test/MC/RISCV/rvv/vsetvl.s          | 119 +++++----
 llvm/test/MC/RISCV/rvzabha-zacas-valid.s |  32 ++-
 llvm/test/MC/RISCV/rvzacas-valid.s       |  32 ++-
 llvm/test/MC/RISCV/rvzcb-valid.s         |  44 ++--
 llvm/test/MC/RISCV/xandesperf-invalid.s  |  66 ++---
 llvm/test/MC/RISCV/xandesvsinth-valid.s  |  25 +-
 llvm/test/MC/RISCV/xmips-invalid.s       |  61 +++--
 llvm/test/MC/RISCV/xqccmt-valid.s        |  18 +-
 llvm/test/MC/RISCV/xqcia-invalid.s       | 231 +++++++++---------
 llvm/test/MC/RISCV/xqciac-invalid.s      |  45 ++--
 llvm/test/MC/RISCV/xqcibi-invalid.s      | 198 ++++++++-------
 llvm/test/MC/RISCV/xqcicli-invalid.s     | 252 ++++++++++---------
 llvm/test/MC/RISCV/xqcicm-invalid.s      | 154 ++++++------
 llvm/test/MC/RISCV/xqcics-invalid.s      | 122 +++++-----
 llvm/test/MC/RISCV/xqcicsr-invalid.s     |  29 ++-
 llvm/test/MC/RISCV/xqciint-invalid.s     | 115 +++++----
 llvm/test/MC/RISCV/xqcilb-invalid.s      |  28 +--
 llvm/test/MC/RISCV/xqcili-invalid.s      |  36 +--
 llvm/test/MC/RISCV/xqcilia-invalid.s     | 110 +++++----
 llvm/test/MC/RISCV/xqcilo-invalid.s      | 110 +++++----
 llvm/test/MC/RISCV/xqcisim-invalid.s     | 107 ++++----
 llvm/test/MC/RISCV/xqcisync-invalid.s    | 123 +++++-----
 llvm/test/MC/RISCV/zibi-valid.s          |  24 +-
 llvm/test/MC/RISCV/zicfiss-valid.s       |  72 +++---
 35 files changed, 1441 insertions(+), 1336 deletions(-)

diff --git a/llvm/test/MC/RISCV/fixups-invalid.s b/llvm/test/MC/RISCV/fixups-invalid.s
index 90b2ce32394ff8..4e1a56ce1746c1 100644
--- a/llvm/test/MC/RISCV/fixups-invalid.s
+++ b/llvm/test/MC/RISCV/fixups-invalid.s
@@ -1,17 +1,14 @@
-# RUN: not llvm-mc -filetype=obj %s -triple=riscv32 -o /dev/null 2>&1 \
-# RUN:     | FileCheck %s
-# RUN: not llvm-mc -filetype=obj %s -triple=riscv64 -o /dev/null 2>&1 \
-# RUN:     | FileCheck %s
+# RUN: llvm-mc --verify -filetype=obj %s -triple=riscv32 -o /dev/null
+# RUN: llvm-mc --verify -filetype=obj %s -triple=riscv64 -o /dev/null
 
-.byte foo   # CHECK: [[@LINE]]:7: error: 1-byte data relocations not supported
-.2byte foo  # CHECK: [[@LINE]]:8: error: 2-byte data relocations not supported
+.byte foo   # expected-error:7 {{1-byte data relocations not supported}}
+.2byte foo  # expected-error:8 {{2-byte data relocations not supported}}
 
 # Test that using li with a symbol difference constant rejects values that
 # cannot fit in a signed 12-bit integer.
 .Lbuf: .skip (1 << 11)
 .Lbuf_end:
 .equ CONST, .Lbuf_end - .Lbuf
-# CHECK: error: operand must be a constant 12-bit integer
 li a0, CONST
-# CHECK: error: operand must be a constant 12-bit integer
-li a0, .Lbuf_end - .Lbuf
+# expected-error at -1 {{operand must be a constant 12-bit integer}}
+li a0, .Lbuf_end - .Lbuf # expected-error {{operand must be a constant 12-bit integer}}
diff --git a/llvm/test/MC/RISCV/rv32c-only-valid.s b/llvm/test/MC/RISCV/rv32c-only-valid.s
index c4fec69bd70121..a6bf570f57a86c 100644
--- a/llvm/test/MC/RISCV/rv32c-only-valid.s
+++ b/llvm/test/MC/RISCV/rv32c-only-valid.s
@@ -4,33 +4,33 @@
 # RUN:     | llvm-objdump --mattr=+c --no-print-imm-hex -M no-aliases -d -r - \
 # RUN:     | FileCheck --check-prefix=CHECK-OBJ %s
 #
-# RUN: not llvm-mc -triple riscv32 \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck --check-prefix=CHECK-NO-EXT %s
-# RUN: not llvm-mc -triple riscv64 -mattr=+c \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck --check-prefix=CHECK-NO-RV32 %s
-# RUN: not llvm-mc -triple riscv64 \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck --check-prefix=CHECK-NO-RV32-AND-EXT %s
+# RUN: llvm-mc --verify=no-ext -triple riscv32 -M no-aliases -show-encoding < %s
+# RUN: llvm-mc --verify=no-rv32 -triple riscv64 -mattr=+c -M no-aliases -show-encoding < %s
+# RUN: llvm-mc --verify=no-rv32-and-ext -triple riscv64 -M no-aliases -show-encoding < %s
 
 # CHECK-OBJ: c.jal 0x7fe
 # CHECK-ASM: c.jal 2046
 # CHECK-ASM: encoding: [0xfd,0x2f]
-# CHECK-NO-EXT: error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
-# CHECK-NO-RV32: error: instruction requires the following: RV32I Base Instruction Set{{$}}
-# CHECK-NO-RV32-AND-EXT: error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores), RV32I Base Instruction Set{{$}}
 c.jal 2046
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv32-error at -2 {{instruction requires the following: RV32I Base Instruction Set}}
+# no-rv32-and-ext-error at -3 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores), RV32I Base Instruction Set}}
 
 # CHECK-OBJ: c.addi a1, -1
 # CHECK-ASM: c.addi a1, -1
 # CHECK-ASM: encoding: [0xfd,0x15]
 c.addi a1, 0xffffffff
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv32-error at -2 {{immediate must be an integer in the range [-32, 31]}}
+# no-rv32-and-ext-error at -3 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 
 # CHECK-OBJ: c.addi16sp sp, -352
 # CHECK-ASM: c.addi16sp sp, -352
 # CHECK-ASM: encoding: [0x0d,0x71]
 c.addi16sp sp, 0xfffffea0
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv32-error at -2 {{immediate must be a multiple of 16 bytes and non-zero in the range [-512, 496]}}
+# no-rv32-and-ext-error at -3 {{invalid instruction}}
 
 ## Branch and Jump immediates are relative but printed as their absolute address
 ## when disassembling.
@@ -39,18 +39,30 @@ c.addi16sp sp, 0xfffffea0
 # CHECK-ASM: c.beqz a2, -256
 # CHECK-ASM: encoding: [0x01,0xd2]
 c.beqz a2, 0xffffff00
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv32-error at -2 {{immediate must be a multiple of 2 bytes in the range [-256, 254]}}
+# no-rv32-and-ext-error at -3 {{invalid instruction}}
 
 # CHECK-OBJ: c.beqz a0, 0xffffff16
 # CHECK-ASM: .insn cb 1, 6, a0, -242
 # CHECK-ASM: encoding: [0x19,0xd5]
 .insn cb 1, 6, a0, 0xffffff0e
+# no-ext-error at -1 {{invalid instruction format}}
+# no-rv32-error at -2 {{immediate must be a multiple of 2 bytes in the range [-256, 254]}}
+# no-rv32-and-ext-error at -3 {{invalid instruction format}}
 
 # CHECK-OBJ: c.jal 0xfffffab4
 # CHECK-ASM: c.jal -1366
 # CHECK-ASM: encoding: [0x6d,0x34]
 c.jal 0xfffffaaa
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv32-error at -2 {{invalid instruction}}
+# no-rv32-and-ext-error at -3 {{invalid instruction}}
 
 # CHECK-OBJ: c.j 0xfffffcd8
 # CHECK-ASM: .insn cj 1, 5, -820
 # CHECK-ASM: encoding: [0xf1,0xb1]
 .insn cj 1, 5, 0xfffffccc
+# no-ext-error at -1 {{invalid instruction format}}
+# no-rv32-error at -2 {{immediate must be a multiple of 2 bytes in the range [-2048, 2046]}}
+# no-rv32-and-ext-error at -3 {{invalid instruction format}}
diff --git a/llvm/test/MC/RISCV/rv32dc-valid.s b/llvm/test/MC/RISCV/rv32dc-valid.s
index 01e63fd7476838..27d2f6a47baa77 100644
--- a/llvm/test/MC/RISCV/rv32dc-valid.s
+++ b/llvm/test/MC/RISCV/rv32dc-valid.s
@@ -9,26 +9,21 @@
 # RUN:     | llvm-objdump --no-print-imm-hex --mattr=+zcd,+d -M no-aliases -d -r - \
 # RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
 #
-# RUN: not llvm-mc -triple riscv32 -mattr=+c \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
-# RUN: not llvm-mc -triple riscv32 -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
+# RUN: llvm-mc --verify -triple riscv32 -mattr=+c -M no-aliases -show-encoding < %s
+# RUN: llvm-mc --verify -triple riscv32 -M no-aliases -show-encoding < %s
 
 # CHECK-ASM-AND-OBJ: c.fldsp  fs0, 504(sp)
 # CHECK-ASM: encoding: [0x7e,0x34]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions)
+# expected-error at +1 {{instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions)}}
 c.fldsp  fs0, 504(sp)
 # CHECK-ASM-AND-OBJ: c.fsdsp  fa7, 504(sp)
 # CHECK-ASM: encoding: [0xc6,0xbf]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions)
-c.fsdsp  fa7, 504(sp)
+c.fsdsp  fa7, 504(sp) # expected-error {{instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions)}}
 
 # CHECK-ASM-AND-OBJ: c.fld  fa3, 248(a5)
 # CHECK-ASM: encoding: [0xf4,0x3f]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions)
+# expected-error at +1 {{instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions)}}
 c.fld  fa3, 248(a5)
 # CHECK-ASM-AND-OBJ: c.fsd  fa2, 248(a1)
 # CHECK-ASM: encoding: [0xf0,0xbd]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions)
-c.fsd  fa2, 248(a1)
+c.fsd  fa2, 248(a1) # expected-error {{instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions)}}
diff --git a/llvm/test/MC/RISCV/rv32fc-valid.s b/llvm/test/MC/RISCV/rv32fc-valid.s
index 21fbc084050b00..65d0af1c2f09a7 100644
--- a/llvm/test/MC/RISCV/rv32fc-valid.s
+++ b/llvm/test/MC/RISCV/rv32fc-valid.s
@@ -9,36 +9,30 @@
 # RUN:     | llvm-objdump --mattr=+zcf,+f --no-print-imm-hex -M no-aliases -d -r - \
 # RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
 #
-# RUN: not llvm-mc -triple riscv32 -mattr=+c \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
-# RUN: not llvm-mc -triple riscv32 \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
-# RUN: not llvm-mc -triple riscv64 -mattr=+c,+f \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-RV32 %s
+# RUN: llvm-mc --verify=no-ext -triple riscv32 -mattr=+c -M no-aliases -show-encoding < %s
+# RUN: llvm-mc --verify=no-ext -triple riscv32 -M no-aliases -show-encoding < %s
+# RUN: llvm-mc --verify=no-rv32 -triple riscv64 -mattr=+c,+f -M no-aliases -show-encoding < %s
 
 # FIXME: error messages for rv64fc are misleading
 
 # CHECK-ASM-AND-OBJ: c.flwsp  fs0, 252(sp)
 # CHECK-ASM: encoding: [0x7e,0x74]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions){{$}}
-# CHECK-NO-RV32:  error: instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions), RV32I Base Instruction Set{{$}}
 c.flwsp  fs0, 252(sp)
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions)}}
+# no-rv32-error at -2 {{instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions), RV32I Base Instruction Set}}
 # CHECK-ASM-AND-OBJ: c.fswsp  fa7, 252(sp)
 # CHECK-ASM: encoding: [0xc6,0xff]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions){{$}}
-# CHECK-NO-RV32:  error: instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions), RV32I Base Instruction Set{{$}}
 c.fswsp  fa7, 252(sp)
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions)}}
+# no-rv32-error at -2 {{instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions), RV32I Base Instruction Set}}
 
 # CHECK-ASM-AND-OBJ: c.flw  fa3, 124(a5)
 # CHECK-ASM: encoding: [0xf4,0x7f]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions){{$}}
-# CHECK-NO-RV32:  error: instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions), RV32I Base Instruction Set{{$}}
 c.flw  fa3, 124(a5)
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions)}}
+# no-rv32-error at -2 {{instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions), RV32I Base Instruction Set}}
 # CHECK-ASM-AND-OBJ: c.fsw  fa2, 124(a1)
 # CHECK-ASM: encoding: [0xf0,0xfd]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions){{$}}
-# CHECK-NO-RV32:  error: instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions), RV32I Base Instruction Set{{$}}
 c.fsw  fa2, 124(a1)
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions)}}
+# no-rv32-error at -2 {{instruction requires the following: 'C' (Compressed Instructions) and 'F' (Single-Precision Floating-Point) or 'Zcf' (Compressed Single-Precision Floating-Point Instructions), RV32I Base Instruction Set}}
diff --git a/llvm/test/MC/RISCV/rv32i-invalid.s b/llvm/test/MC/RISCV/rv32i-invalid.s
index 80af2c12d5287d..54cf201b4e39cd 100644
--- a/llvm/test/MC/RISCV/rv32i-invalid.s
+++ b/llvm/test/MC/RISCV/rv32i-invalid.s
@@ -1,228 +1,229 @@
-# RUN: not llvm-mc -triple riscv32 %s 2>&1 | FileCheck %s --implicit-check-not="note:"
+# RUN: llvm-mc --verify -triple riscv32 %s
 
 # Out of range immediates
 ## fencearg
-fence iorw, iore # CHECK: :[[@LINE]]:13: error: operand must be formed of letters selected in-order from 'iorw' or be 0
-fence wr, wr # CHECK: :[[@LINE]]:7: error: operand must be formed of letters selected in-order from 'iorw' or be 0
-fence rw, rr # CHECK: :[[@LINE]]:11: error: operand must be formed of letters selected in-order from 'iorw' or be 0
-fence 1, rw # CHECK: :[[@LINE]]:7: error: operand must be formed of letters selected in-order from 'iorw' or be 0
-fence unknown, unknown # CHECK: :[[@LINE]]:7: error: operand must be formed of letters selected in-order from 'iorw' or be 0
+fence iorw, iore # expected-error:13 {{operand must be formed of letters selected in-order from 'iorw' or be 0}}
+fence wr, wr # expected-error:7 {{operand must be formed of letters selected in-order from 'iorw' or be 0}}
+fence rw, rr # expected-error:11 {{operand must be formed of letters selected in-order from 'iorw' or be 0}}
+fence 1, rw # expected-error:7 {{operand must be formed of letters selected in-order from 'iorw' or be 0}}
+fence unknown, unknown # expected-error:7 {{operand must be formed of letters selected in-order from 'iorw' or be 0}}
 
 ## uimm5
-slli a0, a0, 32 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 31]
-srli a0, a0, -1 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 31]
-srai a0, a0, -19 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 31]
-csrrwi a1, 0x1, -1 # CHECK: :[[@LINE]]:17: error: immediate must be an integer in the range [0, 31]
-csrrsi t1, 999, 32 # CHECK: :[[@LINE]]:17: error: immediate must be an integer in the range [0, 31]
-csrrci x0, 43, -90 # CHECK: :[[@LINE]]:16: error: immediate must be an integer in the range [0, 31]
+slli a0, a0, 32 # expected-error:14 {{immediate must be an integer in the range [0, 31]}}
+srli a0, a0, -1 # expected-error:14 {{immediate must be an integer in the range [0, 31]}}
+srai a0, a0, -19 # expected-error:14 {{immediate must be an integer in the range [0, 31]}}
+csrrwi a1, 0x1, -1 # expected-error:17 {{immediate must be an integer in the range [0, 31]}}
+csrrsi t1, 999, 32 # expected-error:17 {{immediate must be an integer in the range [0, 31]}}
+csrrci x0, 43, -90 # expected-error:16 {{immediate must be an integer in the range [0, 31]}}
 
 ## simm12
-ori a0, a1, -2049 # CHECK: :[[@LINE]]:13: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]
-andi ra, sp, 2048 # CHECK: :[[@LINE]]:14: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]
+ori a0, a1, -2049 # expected-error:13 {{operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]}}
+andi ra, sp, 2048 # expected-error:14 {{operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]}}
 
 ## uimm12
-csrrw a0, -1, a0 # CHECK: :[[@LINE]]:11: error: immediate must be an integer in the range [0, 4095]
-csrrs a0, 4096, a0 # CHECK: :[[@LINE]]:11: error: immediate must be an integer in the range [0, 4095]
-csrrs a0, -0xf, a0 # CHECK: :[[@LINE]]:11: error: immediate must be an integer in the range [0, 4095]
-csrrc a0, 0x1000, a0 # CHECK: :[[@LINE]]:11: error: immediate must be an integer in the range [0, 4095]
-csrrwi a0, -50, 0 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [0, 4095]
-csrrsi a0, 4097, a0 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [0, 4095]
-csrrci a0, 0xffff, a0 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [0, 4095]
+csrrw a0, -1, a0 # expected-error:11 {{immediate must be an integer in the range [0, 4095]}}
+csrrs a0, 4096, a0 # expected-error:11 {{immediate must be an integer in the range [0, 4095]}}
+csrrs a0, -0xf, a0 # expected-error:11 {{immediate must be an integer in the range [0, 4095]}}
+csrrc a0, 0x1000, a0 # expected-error:11 {{immediate must be an integer in the range [0, 4095]}}
+csrrwi a0, -50, 0 # expected-error:12 {{immediate must be an integer in the range [0, 4095]}}
+csrrsi a0, 4097, a0 # expected-error:12 {{immediate must be an integer in the range [0, 4095]}}
+csrrci a0, 0xffff, a0 # expected-error:12 {{immediate must be an integer in the range [0, 4095]}}
 
 ## simm13_lsb0
-beq t0, t1, -4098 # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
-bne t0, t1, -4097 # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
-blt t0, t1, 4095 # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
-bge t0, t1, 4096 # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
-bltu t0, t1, 13 # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
-bgeu t0, t1, -13 # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
+beq t0, t1, -4098 # expected-error:13 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+bne t0, t1, -4097 # expected-error:13 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+blt t0, t1, 4095 # expected-error:13 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+bge t0, t1, 4096 # expected-error:13 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+bltu t0, t1, 13 # expected-error:14 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+bgeu t0, t1, -13 # expected-error:14 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
 
 ## uimm20
-lui a0, -1 # CHECK: :[[@LINE]]:9: error: operand must be a symbol with %hi/%tprel_hi specifier or an integer in the range [0, 1048575]
-lui s0, 1048576 # CHECK: :[[@LINE]]:9: error: operand must be a symbol with %hi/%tprel_hi specifier or an integer in the range [0, 1048575]
-auipc zero, -0xf # CHECK: :[[@LINE]]:13: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi specifier or an integer in the range [0, 1048575]
+lui a0, -1 # expected-error:9 {{operand must be a symbol with %hi/%tprel_hi specifier or an integer in the range [0, 1048575]}}
+lui s0, 1048576 # expected-error:9 {{operand must be a symbol with %hi/%tprel_hi specifier or an integer in the range [0, 1048575]}}
+auipc zero, -0xf # expected-error:13 {{operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi specifier or an integer in the range [0, 1048575]}}
 
 ## simm21_lsb0
-jal gp, -1048578 # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]
-jal gp, -1048577 # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]
-jal gp, 1048575 # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]
-jal gp, 1048576 # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]
-jal gp, 1 # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]
+jal gp, -1048578 # expected-error:9 {{immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]}}
+jal gp, -1048577 # expected-error:9 {{immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]}}
+jal gp, 1048575 # expected-error:9 {{immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]}}
+jal gp, 1048576 # expected-error:9 {{immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]}}
+jal gp, 1 # expected-error:9 {{immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]}}
 
 # Illegal operand modifier
 ## fencearg
-fence %hi(iorw), iorw # CHECK: :[[@LINE]]:7: error: operand must be formed of letters selected in-order from 'iorw'
-fence %lo(iorw), iorw # CHECK: :[[@LINE]]:7: error: operand must be formed of letters selected in-order from 'iorw'
-fence %pcrel_hi(iorw), iorw # CHECK: :[[@LINE]]:7: error: operand must be formed of letters selected in-order from 'iorw'
-fence %pcrel_lo(iorw), iorw # CHECK: :[[@LINE]]:7: error: operand must be formed of letters selected in-order from 'iorw'
+fence %hi(iorw), iorw # expected-error:7 {{operand must be formed of letters selected in-order from 'iorw'}}
+fence %lo(iorw), iorw # expected-error:7 {{operand must be formed of letters selected in-order from 'iorw'}}
+fence %pcrel_hi(iorw), iorw # expected-error:7 {{operand must be formed of letters selected in-order from 'iorw'}}
+fence %pcrel_lo(iorw), iorw # expected-error:7 {{operand must be formed of letters selected in-order from 'iorw'}}
 
 ## uimm5
-slli a0, a0, %lo(1) # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 31]
-srli a0, a0, %lo(a) # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 31]
-srai a0, a0, %hi(2) # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 31]
-csrrwi a1, 0x1, %hi(b) # CHECK: :[[@LINE]]:17: error: immediate must be an integer in the range [0, 31]
-csrrsi t1, 999, %pcrel_hi(3) # CHECK: :[[@LINE]]:17: error: immediate must be an integer in the range [0, 31]
-csrrci x0, 43, %pcrel_hi(c) # CHECK: :[[@LINE]]:16: error: immediate must be an integer in the range [0, 31]
-csrrsi t1, 999, %pcrel_lo(4) # CHECK: :[[@LINE]]:17: error: immediate must be an integer in the range [0, 31]
-csrrci x0, 43, %pcrel_lo(d) # CHECK: :[[@LINE]]:16: error: immediate must be an integer in the range [0, 31]
+slli a0, a0, %lo(1) # expected-error:14 {{immediate must be an integer in the range [0, 31]}}
+srli a0, a0, %lo(a) # expected-error:14 {{immediate must be an integer in the range [0, 31]}}
+srai a0, a0, %hi(2) # expected-error:14 {{immediate must be an integer in the range [0, 31]}}
+csrrwi a1, 0x1, %hi(b) # expected-error:17 {{immediate must be an integer in the range [0, 31]}}
+csrrsi t1, 999, %pcrel_hi(3) # expected-error:17 {{immediate must be an integer in the range [0, 31]}}
+csrrci x0, 43, %pcrel_hi(c) # expected-error:16 {{immediate must be an integer in the range [0, 31]}}
+csrrsi t1, 999, %pcrel_lo(4) # expected-error:17 {{immediate must be an integer in the range [0, 31]}}
+csrrci x0, 43, %pcrel_lo(d) # expected-error:16 {{immediate must be an integer in the range [0, 31]}}
 
 ## simm12
-ori a0, a1, %hi(foo) # CHECK: :[[@LINE]]:13: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]
-andi ra, sp, %pcrel_hi(123) # CHECK: :[[@LINE]]:14: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]
-xori a2, a3, %hi(345) # CHECK: :[[@LINE]]:14: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]
+ori a0, a1, %hi(foo) # expected-error:13 {{operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]}}
+andi ra, sp, %pcrel_hi(123) # expected-error:14 {{operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]}}
+xori a2, a3, %hi(345) # expected-error:14 {{operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]}}
 add a1, a2, (a3)
-# CHECK: :[[@LINE-1]]:1: error: invalid instruction, any one of the following would fix this:
-# CHECK: :[[@LINE-2]]:13: note: register must be a GPR
-# CHECK: :[[@LINE-3]]:13: note: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]
+# expected-error at -1:1 {{invalid instruction, any one of the following would fix this:}}
+# expected-note at -2:13 {{register must be a GPR}}
+# expected-note at -3:13 {{operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]}}
 lw a0, -2049(a3)
-# CHECK: :[[@LINE-1]]:8: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]
+# expected-error at -1:8 {{operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]}}
 lw a0, -2049(f0)
-# CHECK: :[[@LINE-1]]:1: error: invalid instruction, any one of the following would fix this:
-# CHECK: :[[@LINE-2]]:8: note: operand must be a bare symbol name
-# CHECK: :[[@LINE-3]]:8: note: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]
-# CHECK: :[[@LINE-4]]:8: note: immediate must be an integer in the range [-2048, 2047]
+# expected-error at -1:1 {{invalid instruction, any one of the following would fix this:}}
+# expected-note at -2:8 {{operand must be a bare symbol name}}
+# expected-note at -3:8 {{operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]}}
+# expected-note at -4:8 {{immediate must be an integer in the range [-2048, 2047]}}
 ld a0, (a3)
-# CHECK: :[[@LINE-1]]:1: error: instruction requires the following: 'Zilsd' (Load/Store pair instructions)
+# expected-error at -1:1 {{instruction requires the following: 'Zilsd' (Load/Store pair instructions)}}
 
 add a1, a2, foo
-# CHECK: :[[@LINE-1]]:1: error: invalid instruction, any one of the following would fix this:
-# CHECK: :[[@LINE-2]]:13: note: register must be a GPR
-# CHECK: :[[@LINE-3]]:13: note: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]
+# expected-error at -1:1 {{invalid instruction, any one of the following would fix this:}}
+# expected-note at -2:13 {{register must be a GPR}}
+# expected-note at -3:13 {{operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]}}
 
 ## uimm12
-csrrw a0, %lo(1), a0 # CHECK: :[[@LINE]]:11: error: immediate must be an integer in the range [0, 4095]
-csrrs a0, %lo(a), a0 # CHECK: :[[@LINE]]:11: error: immediate must be an integer in the range [0, 4095]
-csrrs a0, %hi(2), a0 # CHECK: :[[@LINE]]:11: error: immediate must be an integer in the range [0, 4095]
-csrrc a0, %hi(b), a0 # CHECK: :[[@LINE]]:11: error: immediate must be an integer in the range [0, 4095]
-csrrwi a0, %pcrel_hi(3), 0 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [0, 4095]
-csrrsi a0, %pcrel_hi(c), a0 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [0, 4095]
-csrrwi a0, %pcrel_lo(4), 0 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [0, 4095]
-csrrsi a0, %pcrel_lo(d), a0 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [0, 4095]
+csrrw a0, %lo(1), a0 # expected-error:11 {{immediate must be an integer in the range [0, 4095]}}
+csrrs a0, %lo(a), a0 # expected-error:11 {{immediate must be an integer in the range [0, 4095]}}
+csrrs a0, %hi(2), a0 # expected-error:11 {{immediate must be an integer in the range [0, 4095]}}
+csrrc a0, %hi(b), a0 # expected-error:11 {{immediate must be an integer in the range [0, 4095]}}
+csrrwi a0, %pcrel_hi(3), 0 # expected-error:12 {{immediate must be an integer in the range [0, 4095]}}
+csrrsi a0, %pcrel_hi(c), a0 # expected-error:12 {{immediate must be an integer in the range [0, 4095]}}
+csrrwi a0, %pcrel_lo(4), 0 # expected-error:12 {{immediate must be an integer in the range [0, 4095]}}
+csrrsi a0, %pcrel_lo(d), a0 # expected-error:12 {{immediate must be an integer in the range [0, 4095]}}
 
 ## named csr in place of uimm12
-csrrw a0, foos, a0 # CHECK: :[[@LINE]]:11: error: operand must be a valid system register name or an integer in the range [0, 4095]
-csrrs a0, mstatusx, a0 # CHECK: :[[@LINE]]:11: error: operand must be a valid system register name or an integer in the range [0, 4095]
-csrrs a0, xmstatus, a0 # CHECK: :[[@LINE]]:11: error: operand must be a valid system register name or an integer in the range [0, 4095]
-csrrc a0, m12status, a0 # CHECK: :[[@LINE]]:11: error: operand must be a valid system register name or an integer in the range [0, 4095]
-csrrwi a0, mstatus12, 0 # CHECK: :[[@LINE]]:12: error: operand must be a valid system register name or an integer in the range [0, 4095]
-csrrsi a0, mhpm12counter, a0 # CHECK: :[[@LINE]]:12: error: operand must be a valid system register name or an integer in the range [0, 4095]
-csrrwi a0, mhpmcounter32, 0 # CHECK: :[[@LINE]]:12: error: operand must be a valid system register name or an integer in the range [0, 4095]
-csrrsi a0, A, a0 # CHECK: :[[@LINE]]:12: error: operand must be a valid system register name or an integer in the range [0, 4095]
+csrrw a0, foos, a0 # expected-error:11 {{operand must be a valid system register name or an integer in the range [0, 4095]}}
+csrrs a0, mstatusx, a0 # expected-error:11 {{operand must be a valid system register name or an integer in the range [0, 4095]}}
+csrrs a0, xmstatus, a0 # expected-error:11 {{operand must be a valid system register name or an integer in the range [0, 4095]}}
+csrrc a0, m12status, a0 # expected-error:11 {{operand must be a valid system register name or an integer in the range [0, 4095]}}
+csrrwi a0, mstatus12, 0 # expected-error:12 {{operand must be a valid system register name or an integer in the range [0, 4095]}}
+csrrsi a0, mhpm12counter, a0 # expected-error:12 {{operand must be a valid system register name or an integer in the range [0, 4095]}}
+csrrwi a0, mhpmcounter32, 0 # expected-error:12 {{operand must be a valid system register name or an integer in the range [0, 4095]}}
+csrrsi a0, A, a0 # expected-error:12 {{operand must be a valid system register name or an integer in the range [0, 4095]}}
 
 ## symbol in place of uimm12
 .set out_of_range, 4096
-csrr a0, out_of_range # CHECK: [[#@LINE]]:10: error: operand must be a valid system register name or an integer in the range [0, 4095]
-csrr a0, undef_symbol # CHECK: [[#@LINE]]:10: error: operand must be a valid system register name or an integer in the range [0, 4095]
+csrr a0, out_of_range # expected-error:10 {{operand must be a valid system register name or an integer in the range [0, 4095]}}
+csrr a0, undef_symbol # expected-error:10 {{operand must be a valid system register name or an integer in the range [0, 4095]}}
 local_label:
-csrr a0, local_label # CHECK: [[#@LINE]]:10: error: operand must be a valid system register name or an integer in the range [0, 4095]
+csrr a0, local_label # expected-error:10 {{operand must be a valid system register name or an integer in the range [0, 4095]}}
 .Lstart:
 .space 10
 .Lend:
-csrr a0, .Lstart-.Lend # CHECK: [[#@LINE]]:10: error: operand must be a valid system register name or an integer in the range [0, 4095]
+csrr a0, .Lstart-.Lend # expected-error:10 {{operand must be a valid system register name or an integer in the range [0, 4095]}}
 .set dot_set_sym_diff, .Lstart-.Lend
-csrr a0, dot_set_sym_diff # CHECK: [[#@LINE]]:10: error: operand must be a valid system register name or an integer in the range [0, 4095]
+csrr a0, dot_set_sym_diff # expected-error:10 {{operand must be a valid system register name or an integer in the range [0, 4095]}}
 
 ## simm13_lsb0
-beq t0, t1, %lo(1) # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
-bne t0, t1, %lo(a) # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
-blt t0, t1, %hi(2) # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
-bge t0, t1, %hi(b) # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
-bltu t0, t1, %pcrel_hi(3) # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
-bgeu t0, t1, %pcrel_hi(c) # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
-bltu t0, t1, %pcrel_lo(4) # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
-bgeu t0, t1, %pcrel_lo(d) # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
+beq t0, t1, %lo(1) # expected-error:13 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+bne t0, t1, %lo(a) # expected-error:13 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+blt t0, t1, %hi(2) # expected-error:13 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+bge t0, t1, %hi(b) # expected-error:13 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+bltu t0, t1, %pcrel_hi(3) # expected-error:14 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+bgeu t0, t1, %pcrel_hi(c) # expected-error:14 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+bltu t0, t1, %pcrel_lo(4) # expected-error:14 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+bgeu t0, t1, %pcrel_lo(d) # expected-error:14 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
 
 ## uimm20
-lui a0, %lo(1) # CHECK: :[[@LINE]]:9: error: operand must be a symbol with %hi/%tprel_hi specifier or an integer in the range [0, 1048575]
-auipc a1, %lo(foo) # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi specifier or an integer in the range [0, 1048575]
+lui a0, %lo(1) # expected-error:9 {{operand must be a symbol with %hi/%tprel_hi specifier or an integer in the range [0, 1048575]}}
+auipc a1, %lo(foo) # expected-error:11 {{operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi specifier or an integer in the range [0, 1048575]}}
 
 ## simm21_lsb0
-jal gp, %lo(1) # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]
-jal gp, %lo(a) # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]
-jal gp, %hi(2) # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]
-jal gp, %hi(b) # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]
-jal gp, %pcrel_hi(3) # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]
-jal gp, %pcrel_hi(c) # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]
-jal gp, %pcrel_lo(4) # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]
-jal gp, %pcrel_lo(d) # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]
+jal gp, %lo(1) # expected-error:9 {{immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]}}
+jal gp, %lo(a) # expected-error:9 {{immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]}}
+jal gp, %hi(2) # expected-error:9 {{immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]}}
+jal gp, %hi(b) # expected-error:9 {{immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]}}
+jal gp, %pcrel_hi(3) # expected-error:9 {{immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]}}
+jal gp, %pcrel_hi(c) # expected-error:9 {{immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]}}
+jal gp, %pcrel_lo(4) # expected-error:9 {{immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]}}
+jal gp, %pcrel_lo(d) # expected-error:9 {{immediate must be a multiple of 2 bytes in the range [-1048576, 1048574]}}
 
 # Bare symbol names when an operand modifier is required and unsupported
 # operand modifiers.
 
-lui a0, foo # CHECK: :[[@LINE]]:9: error: operand must be a symbol with %hi/%tprel_hi specifier or an integer in the range [0, 1048575]
-lui a0, %lo(foo) # CHECK: :[[@LINE]]:9: error: operand must be a symbol with %hi/%tprel_hi specifier or an integer in the range [0, 1048575]
-lui a0, %pcrel_lo(foo) # CHECK: :[[@LINE]]:9: error: operand must be a symbol with %hi/%tprel_hi specifier or an integer in the range [0, 1048575]
-lui a0, %pcrel_hi(foo) # CHECK: :[[@LINE]]:9: error: operand must be a symbol with %hi/%tprel_hi specifier or an integer in the range [0, 1048575]
+lui a0, foo # expected-error:9 {{operand must be a symbol with %hi/%tprel_hi specifier or an integer in the range [0, 1048575]}}
+lui a0, %lo(foo) # expected-error:9 {{operand must be a symbol with %hi/%tprel_hi specifier or an integer in the range [0, 1048575]}}
+lui a0, %pcrel_lo(foo) # expected-error:9 {{operand must be a symbol with %hi/%tprel_hi specifier or an integer in the range [0, 1048575]}}
+lui a0, %pcrel_hi(foo) # expected-error:9 {{operand must be a symbol with %hi/%tprel_hi specifier or an integer in the range [0, 1048575]}}
 
-auipc a0, foo # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi specifier or an integer in the range [0, 1048575]
-auipc a0, %lo(foo) # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi specifier or an integer in the range [0, 1048575]
-auipc a0, %hi(foo) # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi specifier or an integer in the range [0, 1048575]
-auipc a0, %pcrel_lo(foo) # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi specifier or an integer in the range [0, 1048575]
+auipc a0, foo # expected-error:11 {{operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi specifier or an integer in the range [0, 1048575]}}
+auipc a0, %lo(foo) # expected-error:11 {{operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi specifier or an integer in the range [0, 1048575]}}
+auipc a0, %hi(foo) # expected-error:11 {{operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi specifier or an integer in the range [0, 1048575]}}
+auipc a0, %pcrel_lo(foo) # expected-error:11 {{operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi specifier or an integer in the range [0, 1048575]}}
 
 # TP-relative symbol names require a %tprel_add modifier.
-add a0, a0, tp, zero # CHECK: :[[@LINE]]:17: error: expected '%' relocation specifier
+add a0, a0, tp, zero # expected-error:17 {{expected '%' relocation specifier}}
 add a0, a0, tp, %hi(foo)
-# CHECK: :[[@LINE-1]]:1: error: invalid instruction, any one of the following would fix this:
-# CHECK: :[[@LINE-2]]:17: note: unexpected extra operand for instruction
-# CHECK: :[[@LINE-3]]:17: note: operand must be a symbol with %tprel_add specifier
+# expected-error at -1:1 {{invalid instruction, any one of the following would fix this:}}
+# expected-note at -2:17 {{unexpected extra operand for instruction}}
+# expected-note at -3:17 {{operand must be a symbol with %tprel_add specifier}}
 
-add a0, tp, a0, %tprel_add(foo) # CHECK: :[[@LINE]]:13: error: the second input operand must be tp/x4 when using %tprel_add specifier
+add a0, tp, a0, %tprel_add(foo) # expected-error:13 {{the second input operand must be tp/x4 when using %tprel_add specifier}}
 
 # Unrecognized operand modifier
-addi t0, sp, %modifer(255) # CHECK: :[[@LINE]]:15: error: invalid relocation specifier
-addi t0, sp, %pltpcrel(255) # CHECK: :[[@LINE]]:14: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]
+addi t0, sp, %modifer(255) # expected-error:15 {{invalid relocation specifier}}
+# expected-error at -1 {{unknown operand}}
+addi t0, sp, %pltpcrel(255) # expected-error:14 {{operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]}}
 
 # Use of operand modifier on register name
-addi t1, %lo(t2), 1 # CHECK: :[[@LINE]]:10: error: register must be a GPR
+addi t1, %lo(t2), 1 # expected-error:10 {{register must be a GPR}}
 
 # Invalid mnemonics
-subs t0, t2, t1 # CHECK: :[[@LINE]]:1: error: unrecognized instruction mnemonic
-nandi t0, zero, 0 # CHECK: :[[@LINE]]:1: error: unrecognized instruction mnemonic
+subs t0, t2, t1 # expected-error:1 {{unrecognized instruction mnemonic}}
+nandi t0, zero, 0 # expected-error:1 {{unrecognized instruction mnemonic}}
 
 # Invalid register names
-addi foo, sp, 10 # CHECK: :[[@LINE]]:6: error: register must be a GPR
-slti a10, a2, 0x20 # CHECK: :[[@LINE]]:6: error: register must be a GPR
-slt x32, s0, s0 # CHECK: :[[@LINE]]:5: error: register must be a GPR
+addi foo, sp, 10 # expected-error:6 {{register must be a GPR}}
+slti a10, a2, 0x20 # expected-error:6 {{register must be a GPR}}
+slt x32, s0, s0 # expected-error:5 {{register must be a GPR}}
 lw a0, 0(f0)
-# CHECK: :[[@LINE-1]]:10: error: register must be a GPR
+# expected-error at -1:10 {{register must be a GPR}}
 lw a0, (f0)
-# CHECK: :[[@LINE-1]]:9: error: register must be a GPR
+# expected-error at -1:9 {{register must be a GPR}}
 
 # RV64I mnemonics
-addiw a0, sp, 100 # CHECK: :[[@LINE]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
-sraw t0, s2, zero # CHECK: :[[@LINE]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
+addiw a0, sp, 100 # expected-error:1 {{instruction requires the following: RV64I Base Instruction Set}}
+sraw t0, s2, zero # expected-error:1 {{instruction requires the following: RV64I Base Instruction Set}}
 
 # Invalid operand types
-xori sp, 22, 220 # CHECK: :[[@LINE]]:10: error: register must be a GPR
-sub t0, t2, 1 # CHECK: :[[@LINE]]:13: error: register must be a GPR
+xori sp, 22, 220 # expected-error:10 {{register must be a GPR}}
+sub t0, t2, 1 # expected-error:13 {{register must be a GPR}}
 
 # Too many operands
-sltiu s2, s3, 0x50, 0x60 # CHECK: :[[@LINE]]:21: error: unexpected extra operand for instruction
+sltiu s2, s3, 0x50, 0x60 # expected-error:21 {{unexpected extra operand for instruction}}
 
 # Memory operand not formatted correctly
-lw a4, a5, 111 # CHECK: :[[@LINE]]:12: error: unexpected extra operand for instruction
+lw a4, a5, 111 # expected-error:12 {{unexpected extra operand for instruction}}
 
 # Too few operands
-ori a0, a1 # CHECK: :[[@LINE]]:11: error: too few operands for instruction
-xor s2, s2 # CHECK: :[[@LINE]]:11: error: too few operands for instruction
+ori a0, a1 # expected-error:11 {{too few operands for instruction}}
+xor s2, s2 # expected-error:11 {{too few operands for instruction}}
 
 # Instruction not in the base ISA
-div a4, ra, s0 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'M' (Integer Multiplication and Division){{$}}
-amomaxu.w s5, s4, (s3) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zaamo' (Atomic Memory Operations){{$}}
-lr.w t0, (t1) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zalrsc' (Load-Reserved/Store-Conditional){{$}}
-fadd.s ft0, ft1, ft2 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'F' (Single-Precision Floating-Point){{$}}
-fadd.h ft0, ft1, ft2 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zfh' (Half-Precision Floating-Point){{$}}
-fadd.s a0, a1, a2 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zfinx' (Float in Integer){{$}}
-fadd.d a0, a2, a4 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zdinx' (Double in Integer){{$}}
-fadd.h a0, a1, a2 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zhinx' (Half Float in Integer){{$}}
-flh ft0, (a0) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zfh' (Half-Precision Floating-Point) or 'Zfhmin' (Half-Precision Floating-Point Minimal) or 'Zfbfmin' (Scalar BF16 Converts){{$}}
-sh1add a0, a1, a2 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zba' (Address Generation Instructions){{$}}
-clz a0, a1 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zbb' (Basic Bit-Manipulation){{$}}
-clmul a0, a1, a2 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zbc' (Carry-Less Multiplication) or 'Zbkc' (Carry-less multiply instructions for Cryptography){{$}}
-bset a0, a1, a2 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zbs' (Single-Bit Instructions){{$}}
+div a4, ra, s0 # expected-error:1 {{instruction requires the following: 'M' (Integer Multiplication and Division)}}
+amomaxu.w s5, s4, (s3) # expected-error:1 {{instruction requires the following: 'Zaamo' (Atomic Memory Operations)}}
+lr.w t0, (t1) # expected-error:1 {{instruction requires the following: 'Zalrsc' (Load-Reserved/Store-Conditional)}}
+fadd.s ft0, ft1, ft2 # expected-error:1 {{instruction requires the following: 'F' (Single-Precision Floating-Point)}}
+fadd.h ft0, ft1, ft2 # expected-error:1 {{instruction requires the following: 'Zfh' (Half-Precision Floating-Point)}}
+fadd.s a0, a1, a2 # expected-error:1 {{instruction requires the following: 'Zfinx' (Float in Integer)}}
+fadd.d a0, a2, a4 # expected-error:1 {{instruction requires the following: 'Zdinx' (Double in Integer)}}
+fadd.h a0, a1, a2 # expected-error:1 {{instruction requires the following: 'Zhinx' (Half Float in Integer)}}
+flh ft0, (a0) # expected-error:1 {{instruction requires the following: 'Zfh' (Half-Precision Floating-Point) or 'Zfhmin' (Half-Precision Floating-Point Minimal) or 'Zfbfmin' (Scalar BF16 Converts)}}
+sh1add a0, a1, a2 # expected-error:1 {{instruction requires the following: 'Zba' (Address Generation Instructions)}}
+clz a0, a1 # expected-error:1 {{instruction requires the following: 'Zbb' (Basic Bit-Manipulation)}}
+clmul a0, a1, a2 # expected-error:1 {{instruction requires the following: 'Zbc' (Carry-Less Multiplication) or 'Zbkc' (Carry-less multiply instructions for Cryptography)}}
+bset a0, a1, a2 # expected-error:1 {{instruction requires the following: 'Zbs' (Single-Bit Instructions)}}
 
 # Using floating point registers when integer registers are expected
-addi a2, ft0, 24 # CHECK: :[[@LINE]]:10: error: register must be a GPR
+addi a2, ft0, 24 # expected-error:10 {{register must be a GPR}}
 
 # fence.tso accepts no operands
-fence.tso rw, rw # CHECK: :[[@LINE]]:11: error: unexpected extra operand for instruction
+fence.tso rw, rw # expected-error:11 {{unexpected extra operand for instruction}}
diff --git a/llvm/test/MC/RISCV/rv64c-invalid.s b/llvm/test/MC/RISCV/rv64c-invalid.s
index 225900ee440fbb..3f05e54440dca9 100644
--- a/llvm/test/MC/RISCV/rv64c-invalid.s
+++ b/llvm/test/MC/RISCV/rv64c-invalid.s
@@ -1,49 +1,61 @@
-# RUN: not llvm-mc -triple=riscv64 -mattr=+c < %s 2>&1 | FileCheck %s --implicit-check-not="error:"
-# RUN: not llvm-mc -triple=riscv64 -mattr=+zca < %s 2>&1 | FileCheck %s --implicit-check-not="error:"
+# RUN: llvm-mc --verify -triple=riscv64 -mattr=+c < %s
+# RUN: llvm-mc --verify -triple=riscv64 -mattr=+zca < %s
 
 ## GPRC
 c.ld ra, 4(sp)
-# CHECK: :[[#@LINE-1]]:1: error: invalid instruction
+# expected-error at -1:1 {{invalid instruction}}
+# expected-note at -2 {{register must be a GPR from x8 to x15}}
+# expected-note at -3 {{instruction requires the following: 'Zclsd' (Compressed Load/Store pair instructions), RV32I Base Instruction Set}}
 c.sd sp, 4(sp)
-# CHECK: :[[#@LINE-1]]:1: error: invalid instruction
+# expected-error at -1:1 {{invalid instruction}}
+# expected-note at -2 {{register must be a GPR from x8 to x15}}
+# expected-note at -3 {{instruction requires the following: 'Zclsd' (Compressed Load/Store pair instructions), RV32I Base Instruction Set}}
 c.addw   a0, a7
-# CHECK: :[[#@LINE-1]]:14: error: register must be a GPR from x8 to x15
+# expected-error at -1:14 {{register must be a GPR from x8 to x15}}
 c.subw   a0, a6
-# CHECK: :[[#@LINE-1]]:14: error: register must be a GPR from x8 to x15
+# expected-error at -1:14 {{register must be a GPR from x8 to x15}}
 
 ## GPRNoX0
 c.ldsp  x0, 4(sp)
-# CHECK: :[[#@LINE-1]]:1: error: invalid instruction
+# expected-error at -1:1 {{invalid instruction}}
+# expected-note at -2 {{register must be a GPR excluding zero (x0)}}
+# expected-note at -3 {{instruction requires the following: 'Zclsd' (Compressed Load/Store pair instructions), RV32I Base Instruction Set}}
 c.ldsp  zero, 4(sp)
-# CHECK: :[[#@LINE-1]]:1: error: invalid instruction
+# expected-error at -1:1 {{invalid instruction}}
+# expected-note at -2 {{register must be a GPR excluding zero (x0)}}
+# expected-note at -3 {{instruction requires the following: 'Zclsd' (Compressed Load/Store pair instructions), RV32I Base Instruction Set}}
 
 # Out of range immediates
 
 ## uimmlog2xlen
 c.slli t0, 64
-# CHECK: :[[#@LINE-1]]:12: error: immediate must be an integer in the range [0, 63]
+# expected-error at -1:12 {{immediate must be an integer in the range [0, 63]}}
 c.srli a0, -1
-# CHECK: :[[#@LINE-1]]:12: error: immediate must be an integer in the range [0, 63]
+# expected-error at -1:12 {{immediate must be an integer in the range [0, 63]}}
 
 ## simm6
 c.addiw t0, -33
-# CHECK: :[[#@LINE-1]]:13: error: immediate must be an integer in the range [-32, 31]
+# expected-error at -1:13 {{immediate must be an integer in the range [-32, 31]}}
 c.addiw t0, 32
-# CHECK: :[[#@LINE-1]]:13: error: immediate must be an integer in the range [-32, 31]
+# expected-error at -1:13 {{immediate must be an integer in the range [-32, 31]}}
 c.addiw t0, foo
-# CHECK: :[[#@LINE-1]]:13: error: immediate must be an integer in the range [-32, 31]
+# expected-error at -1:13 {{immediate must be an integer in the range [-32, 31]}}
 c.addiw t0, %lo(foo)
-# CHECK: :[[#@LINE-1]]:13: error: immediate must be an integer in the range [-32, 31]
+# expected-error at -1:13 {{immediate must be an integer in the range [-32, 31]}}
 c.addiw t0, %hi(foo)
-# CHECK: :[[#@LINE-1]]:13: error: immediate must be an integer in the range [-32, 31]
+# expected-error at -1:13 {{immediate must be an integer in the range [-32, 31]}}
 
 ## uimm9_lsb000
 c.ldsp  ra, 512(sp)
-# CHECK: :[[#@LINE-1]]:13: error: immediate must be a multiple of 8 bytes in the range [0, 504]
+# expected-error at -1:13 {{immediate must be a multiple of 8 bytes in the range [0, 504]}}
 c.sdsp  ra, -8(sp)
-# CHECK: :[[#@LINE-1]]:13: error: immediate must be a multiple of 8 bytes in the range [0, 504]
+# expected-error at -1:13 {{immediate must be a multiple of 8 bytes in the range [0, 504]}}
 ## uimm8_lsb000
 c.ld  s0, -8(sp)
-# CHECK: :[[#@LINE-1]]:1: error: invalid instruction
+# expected-error at -1:1 {{invalid instruction}}
+# expected-note at -2 {{immediate must be a multiple of 8 bytes in the range [0, 248]}}
+# expected-note at -3 {{instruction requires the following: 'Zclsd' (Compressed Load/Store pair instructions), RV32I Base Instruction Set}}
 c.sd  s0, 256(sp)
-# CHECK: :[[#@LINE-1]]:1: error: invalid instruction
+# expected-error at -1:1 {{invalid instruction}}
+# expected-note at -2 {{immediate must be a multiple of 8 bytes in the range [0, 248]}}
+# expected-note at -3 {{instruction requires the following: 'Zclsd' (Compressed Load/Store pair instructions), RV32I Base Instruction Set}}
diff --git a/llvm/test/MC/RISCV/rv64c-valid.s b/llvm/test/MC/RISCV/rv64c-valid.s
index 9f53c6a3b4b0ae..690b39b527a3cb 100644
--- a/llvm/test/MC/RISCV/rv64c-valid.s
+++ b/llvm/test/MC/RISCV/rv64c-valid.s
@@ -10,65 +10,66 @@
 # RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
 #
 #
-# RUN: not llvm-mc -triple riscv64 \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
-# RUN: not llvm-mc -triple riscv32 -mattr=+c \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-RV64 %s
+# RUN: llvm-mc --verify=no-ext -triple riscv64 -M no-aliases -show-encoding < %s
+# RUN: llvm-mc --verify=no-rv64 -triple riscv32 -mattr=+c -M no-aliases -show-encoding < %s
 
 # TODO: more exhaustive testing of immediate encoding.
 
 # CHECK-ASM-AND-OBJ: c.ldsp s0, 0(sp)
 # CHECK-ASM: encoding: [0x02,0x64]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
-# CHECK-NO-RV64:  error: instruction requires the following: 'Zclsd' (Compressed Load/Store pair instructions){{$}}
 c.ldsp s0, 0(sp)
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv64-error at -2 {{instruction requires the following: 'Zclsd' (Compressed Load/Store pair instructions)}}
 # CHECK-ASM-AND-OBJ: c.sdsp s2, 504(sp)
 # CHECK-ASM: encoding: [0xca,0xff]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
-# CHECK-NO-RV64:  error: instruction requires the following: 'Zclsd' (Compressed Load/Store pair instructions){{$}}
 c.sdsp s2, 504(sp)
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv64-error at -2 {{instruction requires the following: 'Zclsd' (Compressed Load/Store pair instructions)}}
 # CHECK-ASM-AND-OBJ: c.ld a4, 0(a3)
 # CHECK-ASM: encoding: [0x98,0x62]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
-# CHECK-NO-RV64:  error: instruction requires the following: 'Zclsd' (Compressed Load/Store pair instructions){{$}}
 c.ld a4, 0(a3)
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv64-error at -2 {{instruction requires the following: 'Zclsd' (Compressed Load/Store pair instructions)}}
 # CHECK-ASM-AND-OBJ: c.sd a2, 248(a3)
 # CHECK-ASM: encoding: [0xf0,0xfe]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
-# CHECK-NO-RV64:  error: instruction requires the following: 'Zclsd' (Compressed Load/Store pair instructions){{$}}
 c.sd a2, 248(a3)
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv64-error at -2 {{instruction requires the following: 'Zclsd' (Compressed Load/Store pair instructions)}}
 
 # CHECK-ASM-AND-OBJ: c.subw a3, a4
 # CHECK-ASM: encoding: [0x99,0x9e]
 c.subw a3, a4
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv64-error at -2 {{instruction requires the following: RV64I Base Instruction Set}}
 # CHECK-ASM-AND-OBJ: c.addw a0, a2
 # CHECK-ASM: encoding: [0x31,0x9d]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
-# CHECK-NO-RV64:  error: instruction requires the following: RV64I Base Instruction Set{{$}}
 c.addw a0, a2
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv64-error at -2 {{instruction requires the following: RV64I Base Instruction Set}}
 
 # CHECK-ASM-AND-OBJ: c.addiw a3, -32
 # CHECK-ASM: encoding: [0x81,0x36]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
-# CHECK-NO-RV64:  error: instruction requires the following: RV64I Base Instruction Set{{$}}
 c.addiw a3, -32
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv64-error at -2 {{instruction requires the following: RV64I Base Instruction Set}}
 # CHECK-ASM-AND-OBJ: c.addiw a3, 31
 # CHECK-ASM: encoding: [0xfd,0x26]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
-# CHECK-NO-RV64:  error: instruction requires the following: RV64I Base Instruction Set{{$}}
 c.addiw a3, 31
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv64-error at -2 {{instruction requires the following: RV64I Base Instruction Set}}
 
 # CHECK-ASM-AND-OBJ: c.slli s0, 63
 # CHECK-ASM: encoding: [0x7e,0x14]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.slli s0, 63
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv64-error at -2 {{immediate must be an integer in the range [0, 31]}}
 # CHECK-ASM-AND-OBJ: c.srli a3, 63
 # CHECK-ASM: encoding: [0xfd,0x92]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.srli a3, 63
+# no-rv64-error at -1 {{immediate must be an integer in the range [0, 31]}}
+# no-ext-error at -2 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.srai a2, 63
 # CHECK-ASM: encoding: [0x7d,0x96]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.srai a2, 63
+# no-ext-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
+# no-rv64-error at -2 {{immediate must be an integer in the range [0, 31]}}
diff --git a/llvm/test/MC/RISCV/rv64dc-valid.s b/llvm/test/MC/RISCV/rv64dc-valid.s
index 955b69ab8acc1e..33548869acb414 100644
--- a/llvm/test/MC/RISCV/rv64dc-valid.s
+++ b/llvm/test/MC/RISCV/rv64dc-valid.s
@@ -9,30 +9,25 @@
 # RUN:     | llvm-objdump --no-print-imm-hex --mattr=+zcd,+d -M no-aliases -d -r - \
 # RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
 #
-# RUN: not llvm-mc -triple riscv64 -mattr=+c \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
-# RUN: not llvm-mc -triple riscv64 -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
+# RUN: llvm-mc --verify -triple riscv64 -mattr=+c -M no-aliases -show-encoding < %s
+# RUN: llvm-mc --verify -triple riscv64 -M no-aliases -show-encoding < %s
 
 # CHECK-ASM-AND-OBJ: c.fldsp  fs0, 504(sp)
 # CHECK-ASM: encoding: [0x7e,0x34]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions){{$}}
+# expected-error at +2 {{instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions)}}
 # CHECK-NO-EXT-DC:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions), 'D' (Double-Precision Floating-Point){{$}}
 c.fldsp  fs0, 504(sp)
 # CHECK-ASM-AND-OBJ: c.fsdsp  fa7, 504(sp)
 # CHECK-ASM: encoding: [0xc6,0xbf]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions){{$}}
 # CHECK-NO-EXT-DC:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions), 'D' (Double-Precision Floating-Point){{$}}
-c.fsdsp  fa7, 504(sp)
+c.fsdsp  fa7, 504(sp) # expected-error {{instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions)}}
 
 # CHECK-ASM-AND-OBJ: c.fld  fa3, 248(a5)
 # CHECK-ASM: encoding: [0xf4,0x3f]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions){{$}}
+# expected-error at +2 {{instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions)}}
 # CHECK-NO-EXT-DC:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions), 'D' (Double-Precision Floating-Point){{$}}
 c.fld  fa3, 248(a5)
 # CHECK-ASM-AND-OBJ: c.fsd  fa2, 248(a1)
 # CHECK-ASM: encoding: [0xf0,0xbd]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions){{$}}
 # CHECK-NO-EXT-DC:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions), 'D' (Double-Precision Floating-Point){{$}}
-c.fsd  fa2, 248(a1)
+c.fsd  fa2, 248(a1) # expected-error {{instruction requires the following: 'C' (Compressed Instructions) and 'D' (Double-Precision Floating-Point) or 'Zcd' (Compressed Double-Precision Floating-Point Instructions)}}
diff --git a/llvm/test/MC/RISCV/rv64zacas-valid.s b/llvm/test/MC/RISCV/rv64zacas-valid.s
index d90e77859b6c16..90b8e00f20766c 100644
--- a/llvm/test/MC/RISCV/rv64zacas-valid.s
+++ b/llvm/test/MC/RISCV/rv64zacas-valid.s
@@ -3,49 +3,46 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+a,+zacas < %s \
 # RUN:     | llvm-objdump --mattr=+a,+zacas -M no-aliases -d -r - \
 # RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
-# RUN: not llvm-mc -triple=riscv64 -mattr=+a -show-encoding %s 2>&1 \
-# RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+# RUN: llvm-mc --verify -triple=riscv64 -mattr=+a -show-encoding %s
 
 # Odd register numbers for rd and rs2 are allowed for amocas.d on RV64.
 
 # CHECK-ASM-AND-OBJ: amocas.d a1, a3, (a5)
 # CHECK-ASM: encoding: [0xaf,0xb5,0xd7,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.d a1, a3, (a5)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.d.aq a1, a3, (a5)
 # CHECK-ASM: encoding: [0xaf,0xb5,0xd7,0x2c]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.d.aq a1, a3, (a5)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.d.rl a1, a3, (a5)
 # CHECK-ASM: encoding: [0xaf,0xb5,0xd7,0x2a]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.d.rl a1, a3, (a5)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.d.aqrl a1, a3, (a5)
 # CHECK-ASM: encoding: [0xaf,0xb5,0xd7,0x2e]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
-amocas.d.aqrl a1, a3, (a5)
+amocas.d.aqrl a1, a3, (a5) # expected-error {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 
 # CHECK-ASM-AND-OBJ: amocas.q a0, a2, (a1)
 # CHECK-ASM: encoding: [0x2f,0xc5,0xc5,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.q a0, a2, (a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.q a0, a2, (a1)
 # CHECK-ASM: encoding: [0x2f,0xc5,0xc5,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.q a0, a2, 0(a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.q zero, zero, (a1)
 # CHECK-ASM: encoding: [0x2f,0xc0,0x05,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.q zero, zero, (a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.q.aq zero, zero, (a1)
 # CHECK-ASM: encoding: [0x2f,0xc0,0x05,0x2c]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.q.aq zero, zero, (a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.q.rl zero, zero, (a1)
 # CHECK-ASM: encoding: [0x2f,0xc0,0x05,0x2a]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.q.rl zero, zero, (a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.q.aqrl zero, zero, (a1)
 # CHECK-ASM: encoding: [0x2f,0xc0,0x05,0x2e]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
-amocas.q.aqrl zero, zero, (a1)
+amocas.q.aqrl zero, zero, (a1) # expected-error {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
diff --git a/llvm/test/MC/RISCV/rv64zcb-valid.s b/llvm/test/MC/RISCV/rv64zcb-valid.s
index 83e7fd6c094f73..197d53359df37e 100644
--- a/llvm/test/MC/RISCV/rv64zcb-valid.s
+++ b/llvm/test/MC/RISCV/rv64zcb-valid.s
@@ -4,19 +4,17 @@
 # RUN:     | llvm-objdump --mattr=+m,+zbb,+zba,zcb -M no-aliases -d -r - \
 # RUN:     | FileCheck --check-prefixes=CHECK-ASM-AND-OBJ %s
 #
-# RUN: not llvm-mc -triple riscv64 \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
-# RUN: not llvm-mc -triple riscv32 -mattr=+m,+zbb,+zba,+zcb \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-RV64 %s
+# RUN: llvm-mc --verify=no-ext -triple riscv64 -M no-aliases -show-encoding < %s
+# RUN: llvm-mc --verify=no-rv64 -triple riscv32 -mattr=+m,+zbb,+zba,+zcb -M no-aliases -show-encoding < %s
 
 # CHECK-ASM-AND-OBJ: c.zext.w s0
 # CHECK-ASM: encoding: [0x71,0x9c]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zba' (Address Generation Instructions), 'Zcb' (Compressed basic bit manipulation instructions){{$}}
-# CHECK-NO-RV64: error: instruction requires the following: RV64I Base Instruction Set{{$}}
 c.zext.w s0
+# no-ext-error at -1 {{instruction requires the following: 'Zba' (Address Generation Instructions), 'Zcb' (Compressed basic bit manipulation instructions)}}
+# no-rv64-error at -2 {{instruction requires the following: RV64I Base Instruction Set}}
 
 # CHECK-ASM-AND-OBJ: c.zext.w s0
 # CHECK-ASM: encoding: [0x71,0x9c]
 add.uw s0, s0, zero
+# no-ext-error at -1 {{instruction requires the following: 'Zba' (Address Generation Instructions)}}
+# no-rv64-error at -2 {{instruction requires the following: RV64I Base Instruction Set}}
diff --git a/llvm/test/MC/RISCV/rvc-valid.s b/llvm/test/MC/RISCV/rvc-valid.s
index 798bff8630cc4b..c0174c416208fb 100644
--- a/llvm/test/MC/RISCV/rvc-valid.s
+++ b/llvm/test/MC/RISCV/rvc-valid.s
@@ -19,159 +19,153 @@
 # RUN:     | llvm-objdump --mattr=+zca --no-print-imm-hex -M no-aliases -d -r - \
 # RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
 
-# RUN: not llvm-mc -triple riscv32 \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
+# RUN: llvm-mc --verify -triple riscv32 -M no-aliases -show-encoding < %s
 
 # TODO: more exhaustive testing of immediate encoding.
 
 # CHECK-ASM-AND-OBJ: c.lwsp ra, 0(sp)
 # CHECK-ASM: encoding: [0x82,0x40]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.lwsp ra, 0(sp)
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.swsp ra, 252(sp)
 # CHECK-ASM: encoding: [0x86,0xdf]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.swsp ra, 252(sp)
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.lw a2, 0(a0)
 # CHECK-ASM: encoding: [0x10,0x41]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.lw a2, 0(a0)
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.sw a5, 124(a3)
 # CHECK-ASM: encoding: [0xfc,0xde]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
-c.sw a5, 124(a3)
+c.sw a5, 124(a3) # expected-error {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 
 # CHECK-ASM-AND-OBJ: c.lwsp s0, 0(sp)
 # CHECK-ASM: encoding: [0x02,0x44]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.lwsp x8, (x2)
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.swsp s0, 0(sp)
 # CHECK-ASM: encoding: [0x22,0xc0]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.swsp x8, (x2)
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.lw s0, 0(s1)
 # CHECK-ASM: encoding: [0x80,0x40]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.lw x8, (x9)
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.sw s0, 0(s1)
 # CHECK-ASM: encoding: [0x80,0xc0]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
-c.sw x8, (x9)
+c.sw x8, (x9) # expected-error {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 
 # CHECK-OBJ: c.j 0xfffff810
 # CHECK-ASM: c.j -2048
 # CHECK-ASM: encoding: [0x01,0xb0]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.j -2048
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.jr a7
 # CHECK-ASM: encoding: [0x82,0x88]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.jr a7
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.jalr a1
 # CHECK-ASM: encoding: [0x82,0x95]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.jalr a1
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-OBJ: c.beqz a3, 0xffffff16
 # CHECK-ASM: c.beqz a3, -256
 # CHECK-ASM: encoding: [0x81,0xd2]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.beqz a3, -256
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-OBJ: c.bnez a5, 0x116
 # CHECK-ASM: c.bnez a5, 254
 # CHECK-ASM: encoding: [0xfd,0xef]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
-c.bnez a5,  254
+c.bnez a5,  254 # expected-error {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 
 # CHECK-ASM-AND-OBJ: c.li a7, 31
 # CHECK-ASM: encoding: [0xfd,0x48]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.li a7, 31
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.addi a3, -32
 # CHECK-ASM: encoding: [0x81,0x16]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.addi a3, -32
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.addi16sp sp, -512
 # CHECK-ASM: encoding: [0x01,0x71]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.addi16sp sp, -512
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.addi16sp sp, 496
 # CHECK-ASM: encoding: [0x7d,0x61]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.addi16sp sp, 496
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.addi4spn a3, sp, 1020
 # CHECK-ASM: encoding: [0xf4,0x1f]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.addi4spn a3, sp, 1020
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.addi4spn a3, sp, 4
 # CHECK-ASM: encoding: [0x54,0x00]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.addi4spn a3, sp, 4
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.slli a1, 1
 # CHECK-ASM: encoding: [0x86,0x05]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.slli a1, 1
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.srli a3, 31
 # CHECK-ASM: encoding: [0xfd,0x82]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.srli a3, 31
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.srai a4, 2
 # CHECK-ASM: encoding: [0x09,0x87]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.srai a4, 2
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.andi a5, 15
 # CHECK-ASM: encoding: [0xbd,0x8b]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.andi a5, 15
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.mv a7, s0
 # CHECK-ASM: encoding: [0xa2,0x88]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.mv a7, s0
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.and a1, a2
 # CHECK-ASM: encoding: [0xf1,0x8d]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.and a1, a2
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.or a2, a3
 # CHECK-ASM: encoding: [0x55,0x8e]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.or a2, a3
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.xor a3, a4
 # CHECK-ASM: encoding: [0xb9,0x8e]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.xor a3, a4
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.sub a4, a5
 # CHECK-ASM: encoding: [0x1d,0x8f]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.sub a4, a5
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.nop
 # CHECK-ASM: encoding: [0x01,0x00]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.nop
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.nop
 # CHECK-ASM: encoding: [0x01,0x00]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.addi x0, 0
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.ebreak
 # CHECK-ASM: encoding: [0x02,0x90]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.ebreak
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.lui s0, 1
 # CHECK-ASM: encoding: [0x05,0x64]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.lui s0, 1
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.lui s0, 31
 # CHECK-ASM: encoding: [0x7d,0x64]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.lui s0, 31
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.lui s0, 1048544
 # CHECK-ASM: encoding: [0x01,0x74]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.lui s0, 0xfffe0
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.lui s0, 1048575
 # CHECK-ASM: encoding: [0x7d,0x74]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
 c.lui s0, 0xfffff
+# expected-error at -1 {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
 # CHECK-ASM-AND-OBJ: c.unimp
 # CHECK-ASM: encoding: [0x00,0x00]
-# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}
-c.unimp
+c.unimp # expected-error {{instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores)}}
diff --git a/llvm/test/MC/RISCV/rvv/vsetvl.s b/llvm/test/MC/RISCV/rvv/vsetvl.s
index 8127570e61371d..ae44853ae7fc3b 100644
--- a/llvm/test/MC/RISCV/rvv/vsetvl.s
+++ b/llvm/test/MC/RISCV/rvv/vsetvl.s
@@ -2,8 +2,7 @@
 # RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
 # RUN: llvm-mc -triple=riscv64 -show-encoding --mattr=+zve32x %s 2>&1 \
 # RUN:        | FileCheck %s --check-prefix=CHECK-ZVE32X
-# RUN: not llvm-mc -triple=riscv64 -show-encoding %s 2>&1 \
-# RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+# RUN: llvm-mc --verify -triple=riscv64 -show-encoding %s
 # RUN: llvm-mc -triple=riscv64 -filetype=obj --mattr=+v %s \
 # RUN:        | llvm-objdump -d --mattr=+v --no-print-imm-hex - \
 # RUN:        | FileCheck %s --check-prefix=CHECK-INST
@@ -12,278 +11,278 @@
 vsetvli a2, a0, 0x224
 # CHECK-INST: vsetvli a2, a0, 548
 # CHECK-ENCODING: [0x57,0x76,0x45,0x22]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, 0xd0
 # CHECK-INST: vsetvli a2, a0, e32, m1, ta, ma
 # CHECK-ENCODING: [0x57,0x76,0x05,0x0d]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, 0xd1
 # CHECK-INST: vsetvli a2, a0, e32, m2, ta, ma
 # CHECK-ENCODING: [0x57,0x76,0x15,0x0d]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, 0x50
 # CHECK-INST: vsetvli a2, a0, e32, m1, ta, mu
 # CHECK-ENCODING: [0x57,0x76,0x05,0x05]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, 0x90
 # CHECK-INST: vsetvli a2, a0, e32, m1, tu, ma
 # CHECK-ENCODING: [0x57,0x76,0x05,0x09]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, 144
 # CHECK-INST: vsetvli a2, a0, e32, m1, tu, ma
 # CHECK-ENCODING: [0x57,0x76,0x05,0x09]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e32, m1, ta, ma
 # CHECK-INST:  vsetvli a2, a0, e32,  m1,  ta,  ma
 # CHECK-ENCODING: [0x57,0x76,0x05,0x0d]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e32, m2, ta, ma
 # CHECK-INST: vsetvli a2, a0, e32, m2, ta, ma
 # CHECK-ENCODING: [0x57,0x76,0x15,0x0d]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e32, m4, ta, ma
 # CHECK-INST: vsetvli a2, a0, e32, m4, ta, ma
 # CHECK-ENCODING: [0x57,0x76,0x25,0x0d]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e32, m8, ta, ma
 # CHECK-INST: vsetvli a2, a0, e32, m8, ta, ma
 # CHECK-ENCODING: [0x57,0x76,0x35,0x0d]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
-vsetvli a2, a0, e32, mf2, ta, ma
+vsetvli a2, a0, e32, mf2, ta, ma # expected-warning {{use of vtype encodings with SEW > 16 and LMUL == mf2 may not be compatible with all RVV implementations}}
 # CHECK-INST: vsetvli a2, a0, e32, mf2, ta, ma
 # CHECK-ZVE32X: :[[#@LINE-2]]:17: warning: use of vtype encodings with SEW > 16 and LMUL == mf2 may not be compatible with all RVV implementations{{$}}
 # CHECK-ENCODING: [0x57,0x76,0x75,0x0d]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -4 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
-vsetvli a2, a0, e32, mf4, ta, ma
+vsetvli a2, a0, e32, mf4, ta, ma # expected-warning {{use of vtype encodings with SEW > 8 and LMUL == mf4 may not be compatible with all RVV implementations}}
 # CHECK-INST: vsetvli a2, a0, e32, mf4, ta, ma
 # CHECK-ZVE32X: :[[#@LINE-2]]:17: warning: use of vtype encodings with SEW > 8 and LMUL == mf4 may not be compatible with all RVV implementations{{$}}
 # CHECK-ENCODING: [0x57,0x76,0x65,0x0d]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -4 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
-vsetvli a2, a0, e32, mf8, ta, ma
+vsetvli a2, a0, e32, mf8, ta, ma # expected-warning {{use of vtype encodings with LMUL < SEWMIN/ELEN == mf4 is reserved}}
 # CHECK-INST: vsetvli a2, a0, e32, mf8, ta, ma
 # CHECK-ZVE32X: :[[#@LINE-2]]:22: warning: use of vtype encodings with LMUL < SEWMIN/ELEN == mf4 is reserved{{$}}
 # CHECK-ENCODING: [0x57,0x76,0x55,0x0d]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -4 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e32, m1, ta, ma
 # CHECK-INST: vsetvli a2, a0, e32, m1, ta, ma
 # CHECK-ENCODING: [0x57,0x76,0x05,0x0d]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e32, m1, tu, ma
 # CHECK-INST: vsetvli a2, a0, e32, m1, tu, ma
 # CHECK-ENCODING: [0x57,0x76,0x05,0x09]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e32, m1, ta, mu
 # CHECK-INST: vsetvli a2, a0, e32, m1, ta, mu
 # CHECK-ENCODING: [0x57,0x76,0x05,0x05]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e32, m1, tu, mu
 # CHECK-INST: vsetvli a2, a0, e32, m1
 # CHECK-ENCODING: [0x57,0x76,0x05,0x01]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, 0
 # CHECK-INST: vsetvli a2, a0, e8, m1, tu, mu
 # CHECK-ENCODING: [0x57,0x76,0x05,0x00]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e16
 # CHECK-INST: vsetvli a2, a0, e16, m1, tu, mu
 # CHECK-ENCODING: [0x57,0x76,0x85,0x00]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, m2
 # CHECK-INST: vsetvli a2, a0, e8, m2, tu, mu
 # CHECK-ENCODING: [0x57,0x76,0x15,0x00]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, ta
 # CHECK-INST: vsetvli a2, a0, e8, m1, ta, mu
 # CHECK-ENCODING: [0x57,0x76,0x05,0x04]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, ma
 # CHECK-INST: vsetvli a2, a0, e8, m1, tu, ma
 # CHECK-ENCODING: [0x57,0x76,0x05,0x08]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, m2, ta, ma
 # CHECK-INST: vsetvli a2, a0, e8, m2, ta, ma
 # CHECK-ENCODING: [0x57,0x76,0x15,0x0c]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e32, ta, ma
 # CHECK-INST: vsetvli a2, a0, e32, m1, ta, ma
 # CHECK-ENCODING: [0x57,0x76,0x05,0x0d]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e32, m2, ma
 # CHECK-INST: vsetvli a2, a0, e32, m2, tu, ma
 # CHECK-ENCODING: [0x57,0x76,0x15,0x09]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e32, m2, ta
 # CHECK-INST: vsetvli a2, a0, e32, m2, ta, mu
 # CHECK-ENCODING: [0x57,0x76,0x15,0x05]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, ta, ma
 # CHECK-INST: vsetvli a2, a0, e8, m1, ta, ma
 # CHECK-ENCODING: [0x57,0x76,0x05,0x0c]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, m2, ma
 # CHECK-INST: vsetvli a2, a0, e8, m2, tu, ma
 # CHECK-ENCODING: [0x57,0x76,0x15,0x08]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, m2, ta
 # CHECK-INST: vsetvli a2, a0, e8, m2, ta, mu
 # CHECK-ENCODING: [0x57,0x76,0x15,0x04]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e32, ma
 # CHECK-INST: vsetvli a2, a0, e32, m1, tu, ma
 # CHECK-ENCODING: [0x57,0x76,0x05,0x09]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e32, ta
 # CHECK-INST: vsetvli a2, a0, e32, m1, ta, mu
 # CHECK-ENCODING: [0x57,0x76,0x05,0x05]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvli a2, a0, e32, m2
 # CHECK-INST: vsetvli a2, a0, e32, m2, tu, mu
 # CHECK-ENCODING: [0x57,0x76,0x15,0x01]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetvl a2, a0, a1
 # CHECK-INST: vsetvl a2, a0, a1
 # CHECK-ENCODING: [0x57,0x76,0xb5,0x80]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 # reserved filed: vlmul[2:0]=4, vsew[2:0]=0b1xx, non-zero bits 8/9/10.
 vsetivli a2, 0, 0x224
 # CHECK-INST: vsetivli a2, 0, 548
 # CHECK-ENCODING: [0x57,0x76,0x40,0xe2]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 0, 0xd0
 # CHECK-INST: vsetivli a2, 0, e32, m1, ta, ma
 # CHECK-ENCODING: [0x57,0x76,0x00,0xcd]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 15, 0xd0
 # CHECK-INST: vsetivli a2, 15, e32, m1, ta, ma
 # CHECK-ENCODING: [0x57,0xf6,0x07,0xcd]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 15, 208
 # CHECK-INST: vsetivli a2, 15, e32, m1, ta, ma
 # CHECK-ENCODING: [0x57,0xf6,0x07,0xcd]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 0, e32, m1, ta, ma
 # CHECK-INST: vsetivli a2, 0, e32, m1, ta, ma
 # CHECK-ENCODING: [0x57,0x76,0x00,0xcd]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 15, e32, m1, ta, ma
 # CHECK-INST: vsetivli a2, 15, e32, m1, ta, ma
 # CHECK-ENCODING: [0x57,0xf6,0x07,0xcd]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 31, e32, m1, ta, ma
 # CHECK-INST: vsetivli a2, 31, e32, m1, ta, ma
 # CHECK-ENCODING: [0x57,0xf6,0x0f,0xcd]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, 0
 # CHECK-INST: vsetivli a2, 1, e8, m1, tu, mu
 # CHECK-ENCODING: [0x57,0xf6,0x00,0xc0]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, e16
 # CHECK-INST: vsetivli a2, 1, e16, m1, tu, mu
 # CHECK-ENCODING: [0x57,0xf6,0x80,0xc0]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, m2
 # CHECK-INST:  vsetivli a2, 1, e8, m2, tu, mu
 # CHECK-ENCODING: [0x57,0xf6,0x10,0xc0]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, ta
 # CHECK-INST: vsetivli a2, 1, e8, m1, ta, mu
 # CHECK-ENCODING: [0x57,0xf6,0x00,0xc4]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, ma
 # CHECK-INST: vsetivli a2, 1, e8, m1, tu, ma
 # CHECK-ENCODING: [0x57,0xf6,0x00,0xc8]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, m2, ta, ma
 # CHECK-INST: vsetivli a2, 1, e8, m2, ta, ma
 # CHECK-ENCODING: [0x57,0xf6,0x10,0xcc]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, e32, ta, ma
 # CHECK-INST: vsetivli a2, 1, e32, m1, ta, ma
 # CHECK-ENCODING: [0x57,0xf6,0x00,0xcd]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, e32, m2, ma
 # CHECK-INST: vsetivli a2, 1, e32, m2, tu, ma
 # CHECK-ENCODING: [0x57,0xf6,0x10,0xc9]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, e32, m2, ta
 # CHECK-INST: vsetivli a2, 1, e32, m2, ta, mu
 # CHECK-ENCODING: [0x57,0xf6,0x10,0xc5]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, ta, ma
 # CHECK-INST: vsetivli a2, 1, e8, m1, ta, ma
 # CHECK-ENCODING: [0x57,0xf6,0x00,0xcc]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, m2, ma
 # CHECK-INST: vsetivli a2, 1, e8, m2, tu, ma
 # CHECK-ENCODING: [0x57,0xf6,0x10,0xc8]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, m2, ta
 # CHECK-INST: vsetivli a2, 1, e8, m2, ta, mu
 # CHECK-ENCODING: [0x57,0xf6,0x10,0xc4]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, e32, ma
 # CHECK-INST: vsetivli a2, 1, e32, m1, tu, ma
 # CHECK-ENCODING: [0x57,0xf6,0x00,0xc9]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, e32, ta
 # CHECK-INST: vsetivli a2, 1, e32, m1, ta, mu
 # CHECK-ENCODING: [0x57,0xf6,0x00,0xc5]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
 
 vsetivli a2, 1, e32, m2
 # CHECK-INST: vsetivli a2, 1, e32, m2, tu, mu
 # CHECK-ENCODING: [0x57,0xf6,0x10,0xc1]
-# CHECK-ERROR: instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors){{$}}
+# expected-error at -3 {{instruction requires the following: 'V' (Vector Extension for Application Processors), 'Zve32x' (Vector Extensions for Embedded Processors)}}
diff --git a/llvm/test/MC/RISCV/rvzabha-zacas-valid.s b/llvm/test/MC/RISCV/rvzabha-zacas-valid.s
index 4e271e4a233d0e..9ef956bf4f9d3f 100644
--- a/llvm/test/MC/RISCV/rvzabha-zacas-valid.s
+++ b/llvm/test/MC/RISCV/rvzabha-zacas-valid.s
@@ -8,57 +8,53 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+a,+zabha,+zacas < %s \
 # RUN:     | llvm-objdump --mattr=+a,+zabha,+zacas -M no-aliases -d -r - \
 # RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
-# RUN: not llvm-mc -triple=riscv32 -mattr=+a,+zabha -show-encoding %s 2>&1 \
-# RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
-# RUN: not llvm-mc -triple=riscv64 -mattr=+a,+zabha -show-encoding %s 2>&1 \
-# RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+# RUN: llvm-mc --verify -triple=riscv32 -mattr=+a,+zabha -show-encoding %s
+# RUN: llvm-mc --verify -triple=riscv64 -mattr=+a,+zabha -show-encoding %s
 
 # CHECK-ASM-AND-OBJ: amocas.b a1, a3, (a5)
 # CHECK-ASM: encoding: [0xaf,0x85,0xd7,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.b a1, a3, (a5)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.b a1, a3, (a5)
 # CHECK-ASM: encoding: [0xaf,0x85,0xd7,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.b a1, a3, 0(a5)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.b zero, zero, (a5)
 # CHECK-ASM: encoding: [0x2f,0x80,0x07,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.b zero, zero, (a5)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.b.aq zero, zero, (a5)
 # CHECK-ASM: encoding: [0x2f,0x80,0x07,0x2c]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.b.aq zero, zero, (a5)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.b.rl zero, zero, (a5)
 # CHECK-ASM: encoding: [0x2f,0x80,0x07,0x2a]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.b.rl zero, zero, (a5)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.b.aqrl zero, zero, (a5)
 # CHECK-ASM: encoding: [0x2f,0x80,0x07,0x2e]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
-amocas.b.aqrl zero, zero, (a5)
+amocas.b.aqrl zero, zero, (a5) # expected-error {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 
 # CHECK-ASM-AND-OBJ: amocas.h a0, a2, (a1)
 # CHECK-ASM: encoding: [0x2f,0x95,0xc5,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.h a0, a2, (a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.h a0, a2, (a1)
 # CHECK-ASM: encoding: [0x2f,0x95,0xc5,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.h a0, a2, 0(a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.h zero, zero, (a1)
 # CHECK-ASM: encoding: [0x2f,0x90,0x05,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.h zero, zero, (a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.h.aq zero, zero, (a1)
 # CHECK-ASM: encoding: [0x2f,0x90,0x05,0x2c]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.h.aq zero, zero, (a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.h.rl zero, zero, (a1)
 # CHECK-ASM: encoding: [0x2f,0x90,0x05,0x2a]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.h.rl zero, zero, (a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.h.aqrl zero, zero, (a1)
 # CHECK-ASM: encoding: [0x2f,0x90,0x05,0x2e]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
-amocas.h.aqrl zero, zero, (a1)
+amocas.h.aqrl zero, zero, (a1) # expected-error {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
diff --git a/llvm/test/MC/RISCV/rvzacas-valid.s b/llvm/test/MC/RISCV/rvzacas-valid.s
index 2524001740b7d9..510e4d83281974 100644
--- a/llvm/test/MC/RISCV/rvzacas-valid.s
+++ b/llvm/test/MC/RISCV/rvzacas-valid.s
@@ -8,57 +8,53 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+a,+zacas < %s \
 # RUN:     | llvm-objdump --mattr=+a,+zacas -M no-aliases -d -r - \
 # RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
-# RUN: not llvm-mc -triple=riscv32 -mattr=+a -show-encoding %s 2>&1 \
-# RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
-# RUN: not llvm-mc -triple=riscv64 -mattr=+a -show-encoding %s 2>&1 \
-# RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+# RUN: llvm-mc --verify -triple=riscv32 -mattr=+a -show-encoding %s
+# RUN: llvm-mc --verify -triple=riscv64 -mattr=+a -show-encoding %s
 
 # CHECK-ASM-AND-OBJ: amocas.w a1, a3, (a5)
 # CHECK-ASM: encoding: [0xaf,0xa5,0xd7,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.w a1, a3, (a5)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.w a1, a3, (a5)
 # CHECK-ASM: encoding: [0xaf,0xa5,0xd7,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.w a1, a3, 0(a5)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.w zero, zero, (a5)
 # CHECK-ASM: encoding: [0x2f,0xa0,0x07,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.w zero, zero, (a5)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.w.aq zero, zero, (a5)
 # CHECK-ASM: encoding: [0x2f,0xa0,0x07,0x2c]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.w.aq zero, zero, (a5)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.w.rl zero, zero, (a5)
 # CHECK-ASM: encoding: [0x2f,0xa0,0x07,0x2a]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.w.rl zero, zero, (a5)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.w.aqrl zero, zero, (a5)
 # CHECK-ASM: encoding: [0x2f,0xa0,0x07,0x2e]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
-amocas.w.aqrl zero, zero, (a5)
+amocas.w.aqrl zero, zero, (a5) # expected-error {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 
 # CHECK-ASM-AND-OBJ: amocas.d a0, a2, (a1)
 # CHECK-ASM: encoding: [0x2f,0xb5,0xc5,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.d a0, a2, (a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.d a0, a2, (a1)
 # CHECK-ASM: encoding: [0x2f,0xb5,0xc5,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.d a0, a2, 0(a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.d zero, zero, (a1)
 # CHECK-ASM: encoding: [0x2f,0xb0,0x05,0x28]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.d zero, zero, (a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.d.aq zero, zero, (a1)
 # CHECK-ASM: encoding: [0x2f,0xb0,0x05,0x2c]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.d.aq zero, zero, (a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.d.rl zero, zero, (a1)
 # CHECK-ASM: encoding: [0x2f,0xb0,0x05,0x2a]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
 amocas.d.rl zero, zero, (a1)
+# expected-error at -1 {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
 # CHECK-ASM-AND-OBJ: amocas.d.aqrl zero, zero, (a1)
 # CHECK-ASM: encoding: [0x2f,0xb0,0x05,0x2e]
-# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
-amocas.d.aqrl zero, zero, (a1)
+amocas.d.aqrl zero, zero, (a1) # expected-error {{instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions)}}
diff --git a/llvm/test/MC/RISCV/rvzcb-valid.s b/llvm/test/MC/RISCV/rvzcb-valid.s
index b78ecef3ea5a90..a2d247c720c3f6 100644
--- a/llvm/test/MC/RISCV/rvzcb-valid.s
+++ b/llvm/test/MC/RISCV/rvzcb-valid.s
@@ -9,75 +9,71 @@
 # RUN:     | llvm-objdump --mattr=+m,+zbb,+zba,zcb --no-print-imm-hex -M no-aliases -d -r - \
 # RUN:     | FileCheck --check-prefixes=CHECK-ASM-AND-OBJ %s
 #
-# RUN: not llvm-mc -triple riscv32 \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
-# RUN: not llvm-mc -triple riscv64 \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
+# RUN: llvm-mc --verify -triple riscv32 -M no-aliases -show-encoding < %s
+# RUN: llvm-mc --verify -triple riscv64 -M no-aliases -show-encoding < %s
 
 # CHECK-ASM-AND-OBJ: c.zext.b s0
 # CHECK-ASM: encoding: [0x61,0x9c]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions){{$}}
+# expected-error at +1 {{instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions)}}
 c.zext.b s0
 
 # CHECK-ASM-AND-OBJ: c.sext.b s0
 # CHECK-ASM: encoding: [0x65,0x9c]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zbb' (Basic Bit-Manipulation), 'Zcb' (Compressed basic bit manipulation instructions){{$}}
+# expected-error at +1 {{instruction requires the following: 'Zbb' (Basic Bit-Manipulation), 'Zcb' (Compressed basic bit manipulation instructions)}}
 c.sext.b s0
 
 # CHECK-ASM-AND-OBJ: c.zext.h s0
 # CHECK-ASM: encoding: [0x69,0x9c]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zbb' (Basic Bit-Manipulation), 'Zcb' (Compressed basic bit manipulation instructions){{$}}
+# expected-error at +1 {{instruction requires the following: 'Zbb' (Basic Bit-Manipulation), 'Zcb' (Compressed basic bit manipulation instructions)}}
 c.zext.h s0
 
 # CHECK-ASM-AND-OBJ: c.sext.h s0
 # CHECK-ASM: encoding: [0x6d,0x9c]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zbb' (Basic Bit-Manipulation), 'Zcb' (Compressed basic bit manipulation instructions){{$}}
+# expected-error at +1 {{instruction requires the following: 'Zbb' (Basic Bit-Manipulation), 'Zcb' (Compressed basic bit manipulation instructions)}}
 c.sext.h s0
 
 # CHECK-ASM-AND-OBJ: c.not s0
 # CHECK-ASM: encoding: [0x75,0x9c]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions){{$}}
+# expected-error at +1 {{instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions)}}
 c.not s0
 
 # CHECK-ASM-AND-OBJ: c.mul s0, s1
 # CHECK-ASM: encoding: [0x45,0x9c]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions), 'Zmmul' (Integer Multiplication)
+# expected-error at +1 {{instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions), 'Zmmul' (Integer Multiplication)}}
 c.mul s0, s1
 
 # CHECK-ASM-AND-OBJ: c.lbu a5, 2(a4)
 # CHECK-ASM: encoding: [0x3c,0x83]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions){{$}}
+# expected-error at +1 {{instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions)}}
 c.lbu a5, 2(a4)
 
 # CHECK-ASM-AND-OBJ: c.lhu a5, 2(a4)
 # CHECK-ASM: encoding: [0x3c,0x87]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions){{$}}
+# expected-error at +1 {{instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions)}}
 c.lhu a5, 2(a4)
 
 # CHECK-ASM-AND-OBJ: c.lh a5, 2(a4)
 # CHECK-ASM: encoding: [0x7c,0x87]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions){{$}}
+# expected-error at +1 {{instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions)}}
 c.lh a5, 2(a4)
 
 # CHECK-ASM-AND-OBJ: c.sb a5, 2(a4)
 # CHECK-ASM: encoding: [0x3c,0x8b]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions){{$}}
+# expected-error at +1 {{instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions)}}
 c.sb a5, 2(a4)
 
 # CHECK-ASM-AND-OBJ: c.sh a5, 2(a4)
 # CHECK-ASM: encoding: [0x3c,0x8f]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions){{$}}
+# expected-error at +1 {{instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions)}}
 c.sh a5, 2(a4)
 
 # CHECK-ASM-AND-OBJ: c.mul s0, s1
 # CHECK-ASM: encoding: [0x45,0x9c]
-mul s0, s1, s0
+mul s0, s1, s0 # expected-error {{instruction requires the following: 'Zmmul' (Integer Multiplication)}}
 
 # CHECK-ASM-AND-OBJ: c.mul s0, s1
 # CHECK-ASM: encoding: [0x45,0x9c]
-mul s0, s0, s1
+mul s0, s0, s1 # expected-error {{instruction requires the following: 'Zmmul' (Integer Multiplication)}}
 
 # CHECK-ASM-AND-OBJ: c.sext.b s0
 # CHECK-ASM: encoding: [0x65,0x9c]
@@ -121,20 +117,20 @@ sh a5, 2(a4)
 
 # CHECK-ASM-AND-OBJ: c.lbu s0, 0(s1)
 # CHECK-ASM: encoding: [0x80,0x80]
-c.lbu s0, (s1)
+c.lbu s0, (s1) # expected-error {{instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions)}}
 
 # CHECK-ASM-AND-OBJ: c.lhu s0, 0(s1)
 # CHECK-ASM: encoding: [0x80,0x84]
-c.lhu s0, (s1)
+c.lhu s0, (s1) # expected-error {{instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions)}}
 
 # CHECK-ASM-AND-OBJ: c.lh s0, 0(s1)
 # CHECK-ASM: encoding: [0xc0,0x84]
-c.lh s0, (s1)
+c.lh s0, (s1) # expected-error {{instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions)}}
 
 # CHECK-ASM-AND-OBJ: c.sb s0, 0(s1)
 # CHECK-ASM: encoding: [0x80,0x88]
-c.sb s0, (s1)
+c.sb s0, (s1) # expected-error {{instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions)}}
 
 # CHECK-ASM-AND-OBJ: c.sh s0, 0(s1)
 # CHECK-ASM: encoding: [0x80,0x8c]
-c.sh s0, (s1)
+c.sh s0, (s1) # expected-error {{instruction requires the following: 'Zcb' (Compressed basic bit manipulation instructions)}}
diff --git a/llvm/test/MC/RISCV/xandesperf-invalid.s b/llvm/test/MC/RISCV/xandesperf-invalid.s
index d095e7e24b99c1..4bc7ab45d30573 100644
--- a/llvm/test/MC/RISCV/xandesperf-invalid.s
+++ b/llvm/test/MC/RISCV/xandesperf-invalid.s
@@ -1,50 +1,50 @@
 # XAndesPerf - Andes Performance Extension
-# RUN: not llvm-mc -triple riscv32 -mattr=+xandesperf < %s 2>&1 \
-# RUN:     | FileCheck %s
+# RUN: llvm-mc --verify -triple riscv32 -mattr=+xandesperf < %s
 
 # Out of range immediates
 ## uimmlog2xlen/uimm5
-nds.bbc t0, 33, 256 # CHECK: :[[@LINE]]:13: error: immediate must be an integer in the range [0, 31]
-nds.bbs t1, 33, 256 # CHECK: :[[@LINE]]:13: error: immediate must be an integer in the range [0, 31]
+nds.bbc t0, 33, 256 # expected-error:13 {{immediate must be an integer in the range [0, 31]}}
+nds.bbs t1, 33, 256 # expected-error:13 {{immediate must be an integer in the range [0, 31]}}
 
 ## uimm7
-nds.beqc t0, 1024, 13 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 127]
-nds.bnec t1, -1, -13 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 127]
+nds.beqc t0, 1024, 13 # expected-error:14 {{immediate must be an integer in the range [0, 127]}}
+nds.bnec t1, -1, -13 # expected-error:14 {{immediate must be an integer in the range [0, 127]}}
 
 ## simm11_lsb0
-nds.bbc t0, 7, 1024 # CHECK: :[[@LINE]]:16: error: immediate must be a multiple of 2 bytes in the range [-1024, 1022]
-nds.bbs t1, 21, -1200 # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 2 bytes in the range [-1024, 1022]
-nds.beqc t0, 7, 13 # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 2 bytes in the range [-1024, 1022]
-nds.bnec t1, 21, -13 # CHECK: :[[@LINE]]:18: error: immediate must be a multiple of 2 bytes in the range [-1024, 1022]
+nds.bbc t0, 7, 1024 # expected-error:16 {{immediate must be a multiple of 2 bytes in the range [-1024, 1022]}}
+nds.bbs t1, 21, -1200 # expected-error:17 {{immediate must be a multiple of 2 bytes in the range [-1024, 1022]}}
+nds.beqc t0, 7, 13 # expected-error:17 {{immediate must be a multiple of 2 bytes in the range [-1024, 1022]}}
+nds.bnec t1, 21, -13 # expected-error:18 {{immediate must be a multiple of 2 bytes in the range [-1024, 1022]}}
 
 ## uimmlog2xlen/uimm5
-nds.bfos a0, a1, 35, 3 # CHECK: :[[@LINE]]:18: error: immediate must be an integer in the range [0, 31]
-nds.bfoz t0, t1, 6, 40 # CHECK: :[[@LINE]]:21: error: immediate must be an integer in the range [0, 31]
+nds.bfos a0, a1, 35, 3 # expected-error:18 {{immediate must be an integer in the range [0, 31]}}
+nds.bfoz t0, t1, 6, 40 # expected-error:21 {{immediate must be an integer in the range [0, 31]}}
 
 ## simm18
-nds.addigp t0, 0x20000 # CHECK: :[[@LINE]]:16: error: immediate must be an integer in the range [-131072, 131071]
-nds.addigp t0, -0x20001 # CHECK: :[[@LINE]]:16: error: immediate must be an integer in the range [-131072, 131071]
-nds.lbgp t0, 0x20000 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [-131072, 131071]
-nds.lbugp t0, -0x20001 # CHECK: :[[@LINE]]:15: error: immediate must be an integer in the range [-131072, 131071]
-nds.sbgp t0, 0x20000 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [-131072, 131071]
-nds.sbgp t0, -0x20001 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [-131072, 131071]
+nds.addigp t0, 0x20000 # expected-error:16 {{immediate must be an integer in the range [-131072, 131071]}}
+nds.addigp t0, -0x20001 # expected-error:16 {{immediate must be an integer in the range [-131072, 131071]}}
+nds.lbgp t0, 0x20000 # expected-error:14 {{immediate must be an integer in the range [-131072, 131071]}}
+nds.lbugp t0, -0x20001 # expected-error:15 {{immediate must be an integer in the range [-131072, 131071]}}
+nds.sbgp t0, 0x20000 # expected-error:14 {{immediate must be an integer in the range [-131072, 131071]}}
+nds.sbgp t0, -0x20001 # expected-error:14 {{immediate must be an integer in the range [-131072, 131071]}}
 
 ## simm18_lsb0
-nds.lhgp t0, 0x1ffff # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 2 bytes in the range [-131072, 131070]
-nds.lhgp t0, 0x3 # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 2 bytes in the range [-131072, 131070]
-nds.lhugp t0, -0x20001 # CHECK: :[[@LINE]]:15: error: immediate must be a multiple of 2 bytes in the range [-131072, 131070]
-nds.lhugp t0, -0x3 # CHECK: :[[@LINE]]:15: error: immediate must be a multiple of 2 bytes in the range [-131072, 131070]
-nds.shgp t0, 0x1ffff # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 2 bytes in the range [-131072, 131070]
-nds.shgp t0, 0x3 # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 2 bytes in the range [-131072, 131070]
+nds.lhgp t0, 0x1ffff # expected-error:14 {{immediate must be a multiple of 2 bytes in the range [-131072, 131070]}}
+nds.lhgp t0, 0x3 # expected-error:14 {{immediate must be a multiple of 2 bytes in the range [-131072, 131070]}}
+nds.lhugp t0, -0x20001 # expected-error:15 {{immediate must be a multiple of 2 bytes in the range [-131072, 131070]}}
+nds.lhugp t0, -0x3 # expected-error:15 {{immediate must be a multiple of 2 bytes in the range [-131072, 131070]}}
+nds.shgp t0, 0x1ffff # expected-error:14 {{immediate must be a multiple of 2 bytes in the range [-131072, 131070]}}
+nds.shgp t0, 0x3 # expected-error:14 {{immediate must be a multiple of 2 bytes in the range [-131072, 131070]}}
 nds.shgp t0, -0x20001 # CHECK, CHECK-64: :[[@LINE]]:14: error: immediate must be a multiple of 2 bytes in the range [-131072, 131070]
-nds.shgp t0, -0x3 # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 2 bytes in the range [-131072, 131070]
+# expected-error at -1 {{immediate must be a multiple of 2 bytes in the range [-131072, 131070]}}
+nds.shgp t0, -0x3 # expected-error:14 {{immediate must be a multiple of 2 bytes in the range [-131072, 131070]}}
 
 ## simm19_lsb00
-nds.lwgp t0, 0x3fffd # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 4 bytes in the range [-262144, 262140]
-nds.lwgp t0, 0x7 # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 4 bytes in the range [-262144, 262140]
-nds.lwgp t0, -0x40001 # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 4 bytes in the range [-262144, 262140]
-nds.lwgp t0, -0x7 # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 4 bytes in the range [-262144, 262140]
-nds.swgp t0, 0x3fffd # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 4 bytes in the range [-262144, 262140]
-nds.swgp t0, 0x7 # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 4 bytes in the range [-262144, 262140]
-nds.swgp t0, -0x40001 # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 4 bytes in the range [-262144, 262140]
-nds.swgp t0, -0x7 # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of 4 bytes in the range [-262144, 262140]
+nds.lwgp t0, 0x3fffd # expected-error:14 {{immediate must be a multiple of 4 bytes in the range [-262144, 262140]}}
+nds.lwgp t0, 0x7 # expected-error:14 {{immediate must be a multiple of 4 bytes in the range [-262144, 262140]}}
+nds.lwgp t0, -0x40001 # expected-error:14 {{immediate must be a multiple of 4 bytes in the range [-262144, 262140]}}
+nds.lwgp t0, -0x7 # expected-error:14 {{immediate must be a multiple of 4 bytes in the range [-262144, 262140]}}
+nds.swgp t0, 0x3fffd # expected-error:14 {{immediate must be a multiple of 4 bytes in the range [-262144, 262140]}}
+nds.swgp t0, 0x7 # expected-error:14 {{immediate must be a multiple of 4 bytes in the range [-262144, 262140]}}
+nds.swgp t0, -0x40001 # expected-error:14 {{immediate must be a multiple of 4 bytes in the range [-262144, 262140]}}
+nds.swgp t0, -0x7 # expected-error:14 {{immediate must be a multiple of 4 bytes in the range [-262144, 262140]}}
diff --git a/llvm/test/MC/RISCV/xandesvsinth-valid.s b/llvm/test/MC/RISCV/xandesvsinth-valid.s
index ab5868676905bd..407aa851f81cd7 100644
--- a/llvm/test/MC/RISCV/xandesvsinth-valid.s
+++ b/llvm/test/MC/RISCV/xandesvsinth-valid.s
@@ -4,57 +4,54 @@
 # RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+xandesvsinth,+zve32f < %s \
 # RUN:     | llvm-objdump --mattr=+xandesvsinth,+zve32f -M no-aliases -d -r - \
 # RUN:     | FileCheck -check-prefixes=CHECK-OBJ %s
-# RUN: not llvm-mc -triple=riscv32 -mattr=+zve32f -show-encoding %s 2>&1 \
-# RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+# RUN: llvm-mc --verify -triple=riscv32 -mattr=+zve32f -show-encoding %s
 # RUN: llvm-mc %s -triple=riscv64 -mattr=+xandesvsinth,+zve32f -show-encoding \
 # RUN:     | FileCheck -check-prefixes=CHECK-ASM %s
 # RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+xandesvsinth,+zve32f < %s \
 # RUN:     | llvm-objdump --mattr=+xandesvsinth,+zve32f -M no-aliases -d -r - \
 # RUN:     | FileCheck -check-prefixes=CHECK-OBJ %s
-# RUN: not llvm-mc -triple=riscv64 -mattr=+zve32f -show-encoding %s 2>&1 \
-# RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+# RUN: llvm-mc --verify -triple=riscv64 -mattr=+zve32f -show-encoding %s
 # CHECK-OBJ: nds.vfwcvt.f.n.v  v8, v10
 # CHECK-ASM: nds.vfwcvt.f.n.v  v8, v10
 # CHECK-ASM: encoding: [0x5b,0x44,0xa2,0x02]
-# CHECK-ERROR: instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension){{$}}
 nds.vfwcvt.f.n.v v8, v10
+# expected-error at -1 {{instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension)}}
 # CHECK-OBJ: nds.vfwcvt.f.n.v  v8, v10, v0.t
 # CHECK-ASM: nds.vfwcvt.f.n.v  v8, v10, v0.t
 # CHECK-ASM: encoding: [0x5b,0x44,0xa2,0x00]
-# CHECK-ERROR: instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension){{$}}
 nds.vfwcvt.f.n.v v8, v10, v0.t
+# expected-error at -1 {{instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension)}}
 # CHECK-OBJ: nds.vfwcvt.f.nu.v v8, v10
 # CHECK-ASM: nds.vfwcvt.f.nu.v v8, v10
 # CHECK-ASM: encoding: [0x5b,0xc4,0xa2,0x02]
-# CHECK-ERROR: instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension){{$}}
 nds.vfwcvt.f.nu.v v8, v10
+# expected-error at -1 {{instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension)}}
 # CHECK-OBJ: nds.vfwcvt.f.nu.v v8, v10, v0.t
 # CHECK-ASM: nds.vfwcvt.f.nu.v v8, v10, v0.t
 # CHECK-ASM: encoding: [0x5b,0xc4,0xa2,0x00]
-# CHECK-ERROR: instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension){{$}}
 nds.vfwcvt.f.nu.v v8, v10, v0.t
+# expected-error at -1 {{instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension)}}
 # CHECK-OBJ: nds.vfwcvt.f.b.v  v8, v10
 # CHECK-ASM: nds.vfwcvt.f.b.v  v8, v10
 # CHECK-ASM: encoding: [0x5b,0x44,0xa3,0x02]
-# CHECK-ERROR: instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension){{$}}
 nds.vfwcvt.f.b.v v8, v10
+# expected-error at -1 {{instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension)}}
 # CHECK-OBJ: nds.vfwcvt.f.b.v  v8, v10, v0.t
 # CHECK-ASM: nds.vfwcvt.f.b.v  v8, v10, v0.t
 # CHECK-ASM: encoding: [0x5b,0x44,0xa3,0x00]
-# CHECK-ERROR: instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension){{$}}
 nds.vfwcvt.f.b.v v8, v10, v0.t
+# expected-error at -1 {{instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension)}}
 # CHECK-OBJ: nds.vfwcvt.f.bu.v v8, v10
 # CHECK-ASM: nds.vfwcvt.f.bu.v v8, v10
 # CHECK-ASM: encoding: [0x5b,0xc4,0xa3,0x02]
-# CHECK-ERROR: instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension){{$}}
 nds.vfwcvt.f.bu.v v8, v10
+# expected-error at -1 {{instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension)}}
 # CHECK-OBJ: nds.vfwcvt.f.bu.v v8, v10, v0.t
 # CHECK-ASM: nds.vfwcvt.f.bu.v v8, v10, v0.t
 # CHECK-ASM: encoding: [0x5b,0xc4,0xa3,0x00]
-# CHECK-ERROR: instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension){{$}}
 nds.vfwcvt.f.bu.v v8, v10, v0.t
+# expected-error at -1 {{instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension)}}
 # CHECK-OBJ: nds.vle4.v      v8, (a0)
 # CHECK-ASM: nds.vle4.v      v8, (a0)
 # CHECK-ASM: encoding: [0x5b,0x44,0x05,0x06]
-# CHECK-ERROR: instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension){{$}}
-nds.vle4.v v8, (a0)
+nds.vle4.v v8, (a0) # expected-error {{instruction requires the following: 'XAndesVSIntH' (Andes Vector Small INT Handling Extension)}}
diff --git a/llvm/test/MC/RISCV/xmips-invalid.s b/llvm/test/MC/RISCV/xmips-invalid.s
index de1331c3db070b..0d54d6c50acb9d 100644
--- a/llvm/test/MC/RISCV/xmips-invalid.s
+++ b/llvm/test/MC/RISCV/xmips-invalid.s
@@ -1,52 +1,73 @@
-# RUN: not llvm-mc -triple=riscv64 < %s 2>&1 | FileCheck %s -check-prefixes=CHECK-FEATURE
-# RUN: not llvm-mc -triple=riscv64 -mattr=+xmipslsp,+xmipscmov,+xmipscbop,+xmipsexectl < %s 2>&1 | FileCheck %s
-# RUN: not llvm-mc -triple=riscv32 -mattr=+xmipslsp,+xmipscmov,+xmipscbop,+xmipsexectl < %s 2>&1 \
-# RUN:   | FileCheck %s -check-prefix=RV32
+# RUN: llvm-mc --verify=feature -triple=riscv64 < %s
+# RUN: llvm-mc --verify=check -triple=riscv64 -mattr=+xmipslsp,+xmipscmov,+xmipscbop,+xmipsexectl < %s
+# RUN: llvm-mc --verify=rv32 -triple=riscv32 -mattr=+xmipslsp,+xmipscmov,+xmipscbop,+xmipsexectl < %s
 
 mips.pause 10
-# CHECK: error: unexpected extra operand for instruction
+# check-error at -1 {{unexpected extra operand for instruction}}
+# feature-error at -2 {{invalid instruction}}
+# rv32-error at -3 {{unexpected extra operand for instruction}}
 
 mips.ehb 10
-# CHECK: error: unexpected extra operand for instruction
+# check-error at -1 {{unexpected extra operand for instruction}}
+# feature-error at -2 {{invalid instruction}}
+# rv32-error at -3 {{unexpected extra operand for instruction}}
 
 mips.ihb 10
-# CHECK: error: unexpected extra operand for instruction
+# check-error at -1 {{unexpected extra operand for instruction}}
+# feature-error at -2 {{invalid instruction}}
+# rv32-error at -3 {{unexpected extra operand for instruction}}
 
 mips.pref   8, 512(a0)
-# CHECK: error: immediate offset must be in the range [0, 511]
+# check-error at -1 {{immediate offset must be in the range [0, 511]}}
+# feature-error at -2 {{invalid instruction}}
+# rv32-error at -3 {{immediate offset must be in the range [0, 511]}}
 
 mips.pref	8
-# CHECK: error: too few operands for instruction
+# check-error at -1 {{too few operands for instruction}}
+# feature-error at -2 {{invalid instruction}}
+# rv32-error at -3 {{too few operands for instruction}}
 
 mips.pref	8, 511(a0)
-# CHECK-FEATURE: error: instruction requires the following: 'Xmipscbop' (MIPS hardware prefetch)
+# feature-error at -1 {{instruction requires the following: 'Xmipscbop' (MIPS hardware prefetch)}}
 
 mips.ccmov x0, x1, 0x10
-# CHECK: error: register must be a GPR
+# check-error at -1 {{register must be a GPR}}
+# feature-error at -2 {{instruction requires the following: 'Xmipscmov' ('mips.ccmov' instruction)}}
+# rv32-error at -3 {{register must be a GPR}}
 
 mips.ccmov x10
-# CHECK: error: too few operands for instruction
+# check-error at -1 {{too few operands for instruction}}
+# feature-error at -2 {{invalid instruction}}
+# rv32-error at -3 {{too few operands for instruction}}
 
 mips.ccmov	s0, s1, s2, s3
-# CHECK-FEATURE: error: instruction requires the following: 'Xmipscmov' ('mips.ccmov' instruction)
+# feature-error at -1 {{instruction requires the following: 'Xmipscmov' ('mips.ccmov' instruction)}}
 
 mips.lwp x10, x11
-# CHECK: error: too few operands for instruction
+# check-error at -1 {{too few operands for instruction}}
+# feature-error at -2 {{invalid instruction}}
+# rv32-error at -3 {{too few operands for instruction}}
 
 mips.ldp x9, 0x20
-# CHECK: error: register must be a GPR
+# check-error at -1 {{register must be a GPR}}
+# feature-error at -2 {{instruction requires the following: 'Xmipslsp' (load and store pair instructions)}}
+# rv32-error at -3 {{instruction requires the following: RV64I Base Instruction Set}}
 
 mips.lwp x11, x12, 0(x13)
-# CHECK-FEATURE: error: instruction requires the following: 'Xmipslsp' (load and store pair instructions)
+# feature-error at -1 {{instruction requires the following: 'Xmipslsp' (load and store pair instructions)}}
 
 mips.swp x18, x19, 8(x2)
-# CHECK-FEATURE: error: instruction requires the following: 'Xmipslsp' (load and store pair instructions)
+# feature-error at -1 {{instruction requires the following: 'Xmipslsp' (load and store pair instructions)}}
 
 mips.sdp 0x10, x3, 12(x4)
-# CHECK: error: register must be a GPR
+# check-error at -1 {{register must be a GPR}}
+# feature-error at -2 {{instruction requires the following: 'Xmipslsp' (load and store pair instructions)}}
+# rv32-error at -3 {{instruction requires the following: RV64I Base Instruction Set}}
 
 mips.ldp s1, s2, 8(sp)
-# RV32: :[[@LINE-1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
+# rv32-error at -1:1 {{instruction requires the following: RV64I Base Instruction Set}}
+# feature-error at -2 {{instruction requires the following: 'Xmipslsp' (load and store pair instructions)}}
 
 mips.sdp s5, s6, 16(s7)
-# RV32: :[[@LINE-1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
+# rv32-error at -1:1 {{instruction requires the following: RV64I Base Instruction Set}}
+# feature-error at -2 {{instruction requires the following: 'Xmipslsp' (load and store pair instructions)}}
diff --git a/llvm/test/MC/RISCV/xqccmt-valid.s b/llvm/test/MC/RISCV/xqccmt-valid.s
index 4d00ea78bae9c1..412a16111b9d90 100644
--- a/llvm/test/MC/RISCV/xqccmt-valid.s
+++ b/llvm/test/MC/RISCV/xqccmt-valid.s
@@ -13,33 +13,29 @@
 # RUN:   -M no-aliases -d -r - \
 # RUN:     | FileCheck --check-prefixes=CHECK-ASM-AND-OBJ %s
 #
-# RUN: not llvm-mc -triple riscv32 \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
-# RUN: not llvm-mc -triple riscv64 \
-# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
+# RUN: llvm-mc --verify -triple riscv32 -M no-aliases -show-encoding < %s
+# RUN: llvm-mc --verify -triple riscv64 -M no-aliases -show-encoding < %s
 
 # qc.cm.jt
 # CHECK-ASM-AND-OBJ: qc.cm.jt 1
 # CHECK-ASM: encoding: [0x06,0xa0]
-# CHECK-NO-EXT: error: instruction requires the following: 'Xqccmt' (Qualcomm 16-bit Table Jump){{$}}
+# expected-error at +1 {{instruction requires the following: 'Xqccmt' (Qualcomm 16-bit Table Jump)}}
 qc.cm.jt 1
 
 # CHECK-ASM-AND-OBJ: qc.cm.jt 0
 # CHECK-ASM: encoding: [0x02,0xa0]
-qc.cm.jt 0
+qc.cm.jt 0 # expected-error {{instruction requires the following: 'Xqccmt' (Qualcomm 16-bit Table Jump)}}
 
 # CHECK-ASM-AND-OBJ: qc.cm.jt 31
 # CHECK-ASM: encoding: [0x7e,0xa0]
-qc.cm.jt 31
+qc.cm.jt 31 # expected-error {{instruction requires the following: 'Xqccmt' (Qualcomm 16-bit Table Jump)}}
 
 # qc.cm.jalt
 # CHECK-ASM-AND-OBJ: qc.cm.jalt 32
 # CHECK-ASM: encoding: [0x82,0xa0]
-# CHECK-NO-EXT: error: instruction requires the following: 'Xqccmt' (Qualcomm 16-bit Table Jump){{$}}
+# expected-error at +1 {{instruction requires the following: 'Xqccmt' (Qualcomm 16-bit Table Jump)}}
 qc.cm.jalt 32
 
 # CHECK-ASM-AND-OBJ: qc.cm.jalt 255
 # CHECK-ASM: encoding: [0xfe,0xa3]
-qc.cm.jalt 255
+qc.cm.jalt 255 # expected-error {{instruction requires the following: 'Xqccmt' (Qualcomm 16-bit Table Jump)}}
diff --git a/llvm/test/MC/RISCV/xqcia-invalid.s b/llvm/test/MC/RISCV/xqcia-invalid.s
index c4a51a40a0011c..f78147e9813c68 100644
--- a/llvm/test/MC/RISCV/xqcia-invalid.s
+++ b/llvm/test/MC/RISCV/xqcia-invalid.s
@@ -1,251 +1,250 @@
 # Xqcia - Qualcomm uC Arithmetic Extension
-# RUN: not llvm-mc -triple riscv32 -mattr=+xqcia < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-PLUS %s
-# RUN: not llvm-mc -triple riscv32 -mattr=-xqcia < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-MINUS %s
+# RUN: llvm-mc --verify=plus -triple riscv32 -mattr=+xqcia < %s
+# RUN: llvm-mc --verify=minus -triple riscv32 -mattr=-xqcia < %s
 
-# CHECK-PLUS: :[[@LINE+2]]:20: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:20 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.shlsat x10, x3, 17
 
-# CHECK-PLUS: :[[@LINE+2]]:18: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:18 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.shlsat x10, x3
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.shlsat x0, x3, x17
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.shlsat x10, x0, x17
 
-# CHECK-PLUS: :[[@LINE+2]]:20: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:20 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.shlsat x10, x3, x0
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)}}
 qc.shlsat x10, x3, x17
 
 
-# CHECK-PLUS: :[[@LINE+2]]:22: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:22 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.shlusat x23, x25, 27
 
-# CHECK-PLUS: :[[@LINE+2]]:20: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:20 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.shlusat x23, x25
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.shlusat x0, x25, x27
 
-# CHECK-PLUS: :[[@LINE+2]]:17: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:17 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.shlusat x23, x0, x27
 
-# CHECK-PLUS: :[[@LINE+2]]:22: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:22 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.shlusat x23, x25, x0
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)}}
 qc.shlusat x23, x25, x27
 
 
-# CHECK-PLUS: :[[@LINE+2]]:21: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:21 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.addsat x17, x14, 7
 
-# CHECK-PLUS: :[[@LINE+2]]:19: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:19 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.addsat x17, x14
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.addsat x0, x14, x7
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.addsat x17, x0, x7
 
-# CHECK-PLUS: :[[@LINE+2]]:21: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:21 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.addsat x17, x14, x0
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)}}
 qc.addsat x17, x14, x7
 
 
-# CHECK-PLUS: :[[@LINE+2]]:21: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:21 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.addusat x8, x18, 28
 
-# CHECK-PLUS: :[[@LINE+2]]:19: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:19 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.addusat x8, x18
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.addusat x0, x18, x28
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.addusat x8, x0, x28
 
-# CHECK-PLUS: :[[@LINE+2]]:21: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:21 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.addusat x8, x18, x0
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)}}
 qc.addusat x8, x18, x28
 
 
-# CHECK-PLUS: :[[@LINE+2]]:20: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:20 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.subsat x22, x2, 12
 
-# CHECK-PLUS: :[[@LINE+2]]:18: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:18 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.subsat x22, x2
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.subsat x0, x2, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.subsat x22, x0, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:20: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:20 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.subsat x22, x2, x0
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)}}
 qc.subsat x22, x2, x12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:21: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:21 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.subusat x9, x14, 17
 
-# CHECK-PLUS: :[[@LINE+2]]:19: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:19 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.subusat x9, x14
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.subusat x0, x14, x17
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.subusat x9, x0, x17
 
-# CHECK-PLUS: :[[@LINE+2]]:21: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:21 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.subusat x9, x14, x0
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)}}
 qc.subusat x9, x14, x17
 
 
-# CHECK-PLUS: :[[@LINE+2]]:18: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:18 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.wrap x3, x30, 23
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.wrap x3, x30
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.wrap x0, x30, x23
 
-# CHECK-PLUS: :[[@LINE+2]]:18: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:18 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.wrap x3, x30, x0
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)}}
 qc.wrap x3, x30, x23
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)}}
 qc.wrapi x0, 12, 2047
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.wrapi x0, x12, 2047
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.wrapi x6, x0, 2047
 
-# CHECK-PLUS: :[[@LINE+2]]:17: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:17 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.wrapi x6, x12
 
-# CHECK-PLUS: :[[@LINE+1]]:19: error: immediate must be an integer in the range [0, 2047]
+# plus-error at +2:19 {{immediate must be an integer in the range [0, 2047]}}
+# minus-error at +1 {{invalid instruction}}
 qc.wrapi x6, x12, 2048
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)}}
 qc.wrapi x6, x12, 2047
 
 
-# CHECK-PLUS: :[[@LINE+2]]:13: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:13 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.norm x3, 7
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.norm x3
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.norm x0, x7
 
-# CHECK-PLUS: :[[@LINE+2]]:13: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:13 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.norm x3, x0
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)}}
 qc.norm x3, x7
 
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.normu x11, 17
 
-# CHECK-PLUS: :[[@LINE+2]]:13: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:13 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.normu x11
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.normu x0, x17
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.normu x11, x0
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)}}
 qc.normu x11, x17
 
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.normeu x26, 31
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.normeu x26
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.normeu x0, x31
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.normeu x26, x0
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcia' (Qualcomm uC Arithmetic Extension)}}
 qc.normeu x26, x31
diff --git a/llvm/test/MC/RISCV/xqciac-invalid.s b/llvm/test/MC/RISCV/xqciac-invalid.s
index 511ec5de0e8684..ea3dcb67b85a1b 100644
--- a/llvm/test/MC/RISCV/xqciac-invalid.s
+++ b/llvm/test/MC/RISCV/xqciac-invalid.s
@@ -1,49 +1,50 @@
 # Xqciac - Qualcomm uC Load-Store Address Calculation Extension
-# RUN: not llvm-mc -triple riscv32 -mattr=+xqciac < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-PLUS %s
-# RUN: not llvm-mc -triple riscv32 -mattr=-xqciac < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-MINUS %s
+# RUN: llvm-mc --verify=plus -triple riscv32 -mattr=+xqciac < %s
+# RUN: llvm-mc --verify=minus -triple riscv32 -mattr=-xqciac < %s
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: register must be a GPR from x8 to x15
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{register must be a GPR from x8 to x15}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.muliadd x5, x10, 4
 
-# CHECK-PLUS: :[[@LINE+2]]:17: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:17 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.muliadd x15
 
-# CHECK-PLUS: :[[@LINE+1]]:24: error: immediate must be an integer in the range [0, 31]
+# plus-error at +2:24 {{immediate must be an integer in the range [0, 31]}}
+# minus-error at +1 {{invalid instruction}}
 qc.c.muliadd x10, x15, 32
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)}}
 qc.c.muliadd x10, x15, 20
 
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)
+# plus-error at +2:12 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{instruction requires the following: 'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)}}
 qc.muliadd x0, x10, 1048577
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.muliadd x10
 
-# CHECK-PLUS: :[[@LINE+1]]:22: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]
+# plus-error at +2:22 {{operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]}}
+# minus-error at +1 {{invalid instruction}}
 qc.muliadd x10, x15, 8589934592
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)}}
 qc.muliadd x10, x15, 577
 
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)
+# plus-error at +2:11 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{instruction requires the following: 'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)}}
 qc.shladd 0, x10, 1048577
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.shladd x10
 
-# CHECK-PLUS: :[[@LINE+1]]:26: error: immediate must be an integer in the range [4, 31]
+# plus-error at +2:26 {{immediate must be an integer in the range [4, 31]}}
+# minus-error at +1 {{invalid instruction}}
 qc.shladd x10, x15, x11, 2
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)}}
 qc.shladd x10, x15, x11, 5
diff --git a/llvm/test/MC/RISCV/xqcibi-invalid.s b/llvm/test/MC/RISCV/xqcibi-invalid.s
index 2359965af71f66..1abd16bfac30c7 100644
--- a/llvm/test/MC/RISCV/xqcibi-invalid.s
+++ b/llvm/test/MC/RISCV/xqcibi-invalid.s
@@ -1,220 +1,242 @@
 # Xqcibi - Qualcomm uC Branch Immediate Extension
-# RUN: not llvm-mc -triple riscv32 -mattr=+xqcibi < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-PLUS %s
-# RUN: not llvm-mc -triple riscv32 -mattr=-xqcibi < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-MINUS %s
+# RUN: llvm-mc --verify=plus -triple riscv32 -mattr=+xqcibi < %s
+# RUN: llvm-mc --verify=minus -triple riscv32 -mattr=-xqcibi < %s
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.beqi x0, 12, 346
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.beqi x8, 12
 
-# CHECK-PLUS: :[[@LINE+1]]:13: error: immediate must be non-zero in the range [-16, 15]
+# plus-error at +2:13 {{immediate must be non-zero in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.beqi x8, 22, 346
 
-# CHECK-PLUS: :[[@LINE+1]]:17: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
+# plus-error at +2:17 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+# minus-error at +1 {{invalid instruction}}
 qc.beqi x8, 12, 1211
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)}}
 qc.beqi x8, 12, 346
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.bnei x0, 15, 4094
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.bnei x4, 15
 
-# CHECK-PLUS: :[[@LINE+1]]:13: error: immediate must be non-zero in the range [-16, 15]
+# plus-error at +2:13 {{immediate must be non-zero in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.bnei x4, -45, 4094
 
-# CHECK-PLUS: :[[@LINE+1]]:17: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
+# plus-error at +2:17 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+# minus-error at +1 {{invalid instruction}}
 qc.bnei x4, 15, 5000
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)}}
 qc.bnei x4, 15, 4094
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.bgei x0, 1, -4096
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.bgei x10, 1
 
-# CHECK-PLUS: :[[@LINE+1]]:14: error: immediate must be non-zero in the range [-16, 15]
+# plus-error at +2:14 {{immediate must be non-zero in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.bgei x10, 21, -4096
 
-# CHECK-PLUS: :[[@LINE+1]]:17: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
+# plus-error at +2:17 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+# minus-error at +1 {{invalid instruction}}
 qc.bgei x10, 1, -4098
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)}}
 qc.bgei x10, 1, -4096
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.blti x0, 6, 2000
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.blti x1, 6
 
-# CHECK-PLUS: :[[@LINE+1]]:13: error: immediate must be non-zero in the range [-16, 15]
+# plus-error at +2:13 {{immediate must be non-zero in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.blti x1, 56, 2000
 
-# CHECK-PLUS: :[[@LINE+1]]:16: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
+# plus-error at +2:16 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+# minus-error at +1 {{invalid instruction}}
 qc.blti x1, 6, 12000
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)}}
 qc.blti x1, 6, 2000
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.bgeui x0, 11, 128
 
-# CHECK-PLUS: :[[@LINE+2]]:17: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:17 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.bgeui x12, 11
 
-# CHECK-PLUS: :[[@LINE+1]]:15: error: immediate must be an integer in the range [1, 31]
+# plus-error at +2:15 {{immediate must be an integer in the range [1, 31]}}
+# minus-error at +1 {{invalid instruction}}
 qc.bgeui x12, 41, 128
 
-# CHECK-PLUS: :[[@LINE+1]]:19: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
+# plus-error at +2:19 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+# minus-error at +1 {{invalid instruction}}
 qc.bgeui x12, 11, 11128
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)}}
 qc.bgeui x12, 11, 128
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.bltui x0, 7, 666
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.bltui x2, 7
 
-# CHECK-PLUS: :[[@LINE+1]]:14: error: immediate must be an integer in the range [1, 31]
+# plus-error at +2:14 {{immediate must be an integer in the range [1, 31]}}
+# minus-error at +1 {{invalid instruction}}
 qc.bltui x2, -7, 666
 
-# CHECK-PLUS: :[[@LINE+1]]:17: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
+# plus-error at +2:17 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+# minus-error at +1 {{invalid instruction}}
 qc.bltui x2, 7, -6666
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)}}
 qc.bltui x2, 7, 666
 
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.beqi x0, 1, 2
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.beqi x1, 1
 
-# CHECK-PLUS: :[[@LINE+1]]:15: error: immediate must be non-zero in the range [-32768, 32767]
+# plus-error at +2:15 {{immediate must be non-zero in the range [-32768, 32767]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.beqi x1, 32768, 2
 
-# CHECK-PLUS: :[[@LINE+1]]:18: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
+# plus-error at +2:18 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.beqi x1, 1, 21
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)}}
 qc.e.beqi x1, 1, 2
 
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.bnei x0, 115, 4094
 
-# CHECK-PLUS: :[[@LINE+2]]:18: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:18 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.bnei x4, 115
 
-# CHECK-PLUS: :[[@LINE+1]]:15: error: immediate must be non-zero in the range [-32768, 32767]
+# plus-error at +2:15 {{immediate must be non-zero in the range [-32768, 32767]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.bnei x4, -33115, 4094
 
-# CHECK-PLUS: :[[@LINE+1]]:20: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
+# plus-error at +2:20 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.bnei x4, 115, 211
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)}}
 qc.e.bnei x4, 115, 4094
 
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.bgei x0, -32768, -4096
 
-# CHECK-PLUS: :[[@LINE+2]]:22: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:22 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.bgei x10, -32768
 
-# CHECK-PLUS: :[[@LINE+1]]:16: error: immediate must be non-zero in the range [-32768, 32767]
+# plus-error at +2:16 {{immediate must be non-zero in the range [-32768, 32767]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.bgei x10, -32769, -4096
 
-# CHECK-PLUS: :[[@LINE+1]]:24: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
+# plus-error at +2:24 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.bgei x10, -32768, -4097
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)}}
 qc.e.bgei x10, -32768, -4096
 
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.blti x0, 32767, 2000
 
-# CHECK-PLUS: :[[@LINE+2]]:20: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:20 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.blti x1, 32767
 
-# CHECK-PLUS: :[[@LINE+1]]:15: error: immediate must be non-zero in the range [-32768, 32767]
+# plus-error at +2:15 {{immediate must be non-zero in the range [-32768, 32767]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.blti x1, 42767, 2000
 
-# CHECK-PLUS: :[[@LINE+1]]:22: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
+# plus-error at +2:22 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.blti x1, 32767, 2001
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)}}
 qc.e.blti x1, 32767, 2000
 
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.bgeui x0, 711, 128
 
-# CHECK-PLUS: :[[@LINE+2]]:20: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:20 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.bgeui x12, 711
 
-# CHECK-PLUS: :[[@LINE+1]]:17: error: immediate must be an integer in the range [1, 65535]
+# plus-error at +2:17 {{immediate must be an integer in the range [1, 65535]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.bgeui x12, 0, 128
 
-# CHECK-PLUS: :[[@LINE+1]]:22: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
+# plus-error at +2:22 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.bgeui x12, 711, 129
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)}}
 qc.e.bgeui x12, 711, 128
 
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.bltui x0, 7, 666
 
-# CHECK-PLUS: :[[@LINE+2]]:17: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:17 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.bltui x2, 7
 
-# CHECK-PLUS: :[[@LINE+1]]:16: error: immediate must be an integer in the range [1, 65535]
+# plus-error at +2:16 {{immediate must be an integer in the range [1, 65535]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.bltui x2, -7, 666
 
-# CHECK-PLUS: :[[@LINE+1]]:19: error: immediate must be a multiple of 2 bytes in the range [-4096, 4094]
+# plus-error at +2:19 {{immediate must be a multiple of 2 bytes in the range [-4096, 4094]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.bltui x2, 7, 667
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcibi' (Qualcomm uC Branch Immediate Extension)}}
 qc.e.bltui x2, 7, 666
diff --git a/llvm/test/MC/RISCV/xqcicli-invalid.s b/llvm/test/MC/RISCV/xqcicli-invalid.s
index 368e5f0ec3e26e..e851f6486d6ec2 100644
--- a/llvm/test/MC/RISCV/xqcicli-invalid.s
+++ b/llvm/test/MC/RISCV/xqcicli-invalid.s
@@ -1,274 +1,290 @@
 # Xqcicli - Qualcomm uC Conditional Load Immediate Instructions
-# RUN: not llvm-mc -triple riscv32 -mattr=+xqcicli < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-PLUS %s
-# RUN: not llvm-mc -triple riscv32 -mattr=-xqcicli < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-MINUS %s
+# RUN: llvm-mc --verify=plus -triple riscv32 -mattr=+xqcicli < %s
+# RUN: llvm-mc --verify=minus -triple riscv32 -mattr=-xqcicli < %s
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lieq x0, x4, x6, 10
 
-# CHECK-PLUS: :[[@LINE+2]]:13: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:13 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lieq x2, x0, x6, 10
 
-# CHECK-PLUS: :[[@LINE+2]]:17: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:17 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lieq x2, x4, x0, 10
 
-# CHECK-PLUS: :[[@LINE+2]]:19: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:19 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lieq x2, x4, x6
 
-# CHECK-PLUS: :[[@LINE+1]]:21: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:21 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.lieq x2, x4, x6, 40
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)}}
 qc.lieq x2, x4, x6, 10
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lige x0, x8, x20, 2
 
-# CHECK-PLUS: :[[@LINE+2]]:13: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:13 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lige x4, x0, x20, 2
 
-# CHECK-PLUS: :[[@LINE+2]]:17: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:17 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lige x4, x8, x0, 2
 
-# CHECK-PLUS: :[[@LINE+2]]:20: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:20 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lige x4, x8, x20
 
-# CHECK-PLUS: :[[@LINE+1]]:22: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:22 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.lige x4, x8, x20, -18
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)}}
 qc.lige x4, x8, x20, 2
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lilt x0, x9, x10, 3
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lilt x19, x0, x10, 3
 
-# CHECK-PLUS: :[[@LINE+2]]:18: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:18 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lilt x19, x9, x0, 3
 
-# CHECK-PLUS: :[[@LINE+2]]:21: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:21 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lilt x19, x9, x10
 
-# CHECK-PLUS: :[[@LINE+1]]:23: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:23 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.lilt x19, x9, x10, 39
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)}}
 qc.lilt x19, x9, x10, 3
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.line x0, x14, x6, 10
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.line x18, x0, x6, 10
 
-# CHECK-PLUS: :[[@LINE+2]]:19: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:19 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.line x18, x14, x0, 10
 
-# CHECK-PLUS: :[[@LINE+2]]:21: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:21 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.line x18, x14, x6
 
-# CHECK-PLUS: :[[@LINE+1]]:23: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:23 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.line x18, x14, x6, 100
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)}}
 qc.line x18, x14, x6, 10
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.ligeu x0, x4, x6, 10
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.ligeu x2, x0, x6, 10
 
-# CHECK-PLUS: :[[@LINE+2]]:18: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:18 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.ligeu x2, x4, x0, 10
 
-# CHECK-PLUS: :[[@LINE+2]]:20: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:20 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.ligeu x2, x4, x6
 
-# CHECK-PLUS: :[[@LINE+1]]:22: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:22 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.ligeu x2, x4, x6, 70
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)}}
 qc.ligeu x2, x4, x6, 10
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.liltu x0, x19, x12, 13
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.liltu x1, x0, x12, 13
 
-# CHECK-PLUS: :[[@LINE+2]]:19: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:19 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.liltu x1, x19, x0, 13
 
-# CHECK-PLUS: :[[@LINE+2]]:22: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:22 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.liltu x1, x19, x12
 
-# CHECK-PLUS: :[[@LINE+1]]:24: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:24 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.liltu x1, x19, x12, 73
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)}}
 qc.liltu x1, x19, x12, 13
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lieqi x0, x1, 15, 12
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lieqi x7, x0, 15, 12
 
-# CHECK-PLUS: :[[@LINE+2]]:20: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:20 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lieqi x7, x1, 15
 
-# CHECK-PLUS: :[[@LINE+1]]:18: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:18 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.lieqi x7, x1, 25, 12
 
-# CHECK-PLUS: :[[@LINE+1]]:22: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:22 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.lieqi x7, x1, 15, -22
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)}}
 qc.lieqi x7, x1, 15, 12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.ligei x0, x11, -4, 9
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.ligei x17, x0, -4, 9
 
-# CHECK-PLUS: :[[@LINE+2]]:22: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:22 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.ligei x17, x11, -4
 
-# CHECK-PLUS: :[[@LINE+1]]:20: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:20 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.ligei x17, x11, -24, 9
 
-# CHECK-PLUS: :[[@LINE+1]]:24: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:24 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.ligei x17, x11, -4, 59
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)}}
 qc.ligei x17, x11, -4, 9
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lilti x0, x11, -14, 2
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lilti x9, x0, -14, 2
 
-# CHECK-PLUS: :[[@LINE+2]]:22: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:22 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.lilti x9, x11, -14
 
-# CHECK-PLUS: :[[@LINE+1]]:19: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:19 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.lilti x9, x11, -84, 2
 
-# CHECK-PLUS: :[[@LINE+1]]:24: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:24 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.lilti x9, x11, -14, 52
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)}}
 qc.lilti x9, x11, -14, 2
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.linei x0, x1, 10, 12
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.linei x5, x0, 10, 12
 
-# CHECK-PLUS: :[[@LINE+2]]:20: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:20 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.linei x5, x1, 10
 
-# CHECK-PLUS: :[[@LINE+1]]:18: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:18 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.linei x5, x1, 130, 12
 
-# CHECK-PLUS: :[[@LINE+1]]:22: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:22 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.linei x5, x1, 10, 124
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)}}
 qc.linei x5, x1, 10, 12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.ligeui x0, x12, 7, -12
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.ligeui x2, x0, 7, -12
 
-# CHECK-PLUS: :[[@LINE+2]]:21: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:21 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.ligeui x2, x12, 7
 
-# CHECK-PLUS: :[[@LINE+1]]:20: error: immediate must be an integer in the range [0, 31]
+# plus-error at +2:20 {{immediate must be an integer in the range [0, 31]}}
+# minus-error at +1 {{invalid instruction}}
 qc.ligeui x2, x12, -7, -12
 
-# CHECK-PLUS: :[[@LINE+1]]:23: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:23 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.ligeui x2, x12, 7, -17
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)}}
 qc.ligeui x2, x12, 7, -12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.liltui x0, x25, 31, 12
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.liltui x3, x0, 31, 12
 
-# CHECK-PLUS: :[[@LINE+2]]:22: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:22 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.liltui x3, x25, 31
 
-# CHECK-PLUS: :[[@LINE+1]]:20: error: immediate must be an integer in the range [0, 31]
+# plus-error at +2:20 {{immediate must be an integer in the range [0, 31]}}
+# minus-error at +1 {{invalid instruction}}
 qc.liltui x3, x25, 32, 12
 
-# CHECK-PLUS: :[[@LINE+1]]:24: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:24 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.liltui x3, x25, 31, 112
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)}}
 qc.liltui x3, x25, 31, 12
diff --git a/llvm/test/MC/RISCV/xqcicm-invalid.s b/llvm/test/MC/RISCV/xqcicm-invalid.s
index 0df0756c82a478..4bbace85916bc3 100644
--- a/llvm/test/MC/RISCV/xqcicm-invalid.s
+++ b/llvm/test/MC/RISCV/xqcicm-invalid.s
@@ -1,178 +1,182 @@
 # Xqcicm - Qualcomm uC Conditional Move Extension
-# RUN: not llvm-mc -triple riscv32 -mattr=+xqcicm < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-PLUS %s
-# RUN: not llvm-mc -triple riscv32 -mattr=-xqcicm < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-MINUS %s
+# RUN: llvm-mc --verify=plus -triple riscv32 -mattr=+xqcicm < %s
+# RUN: llvm-mc --verify=minus -triple riscv32 -mattr=-xqcicm < %s
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: register must be a GPR from x8 to x15
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{register must be a GPR from x8 to x15}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.mveqz 9, x10
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.mveqz x9
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)}}
 qc.c.mveqz x9, x10
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mveq 9, x10, x11, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mveq x9
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)}}
 qc.mveq x9, x10, x11, x12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvge 9, x10, x11, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvge x9
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)}}
 qc.mvge x9, x10, x11, x12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvgeu 9, x10, x11, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvgeu x9
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)}}
 qc.mvgeu x9, x10, x11, x12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvlt 9, x10, x11, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvlt x9
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)}}
 qc.mvlt x9, x10, x11, x12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvltu 9, x10, x11, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvltu x9
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)}}
 qc.mvltu x9, x10, x11, x12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvne 9, x10, x11, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvne x9
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)}}
 qc.mvne x9, x10, x11, x12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mveqi 9, x10, 5, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mveqi x9
 
-# CHECK-PLUS: :[[@LINE+1]]:19: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:19 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.mveqi x9, x10, 17, x12
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)}}
 qc.mveqi x9, x10, 5, x12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvgei 9, x10, 5, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvgei x9
 
-# CHECK-PLUS: :[[@LINE+1]]:19: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:19 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.mvgei x9, x10, 17, x12
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)}}
 qc.mvgei x9, x10, 5, x12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvlti 9, x10, 5, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvlti x9
 
-# CHECK-PLUS: :[[@LINE+1]]:19: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:19 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.mvlti x9, x10, 17, x12
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)}}
 qc.mvlti x9, x10, 5, x12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvnei 9, x10, 5, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvnei x9
 
-# CHECK-PLUS: :[[@LINE+1]]:19: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:19 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.mvnei x9, x10, 17, x12
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)}}
 qc.mvnei x9, x10, 5, x12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvltui 9, x10, 5, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:13: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:13 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvltui x9
 
-# CHECK-PLUS: :[[@LINE+1]]:20: error: immediate must be an integer in the range [0, 31]
+# plus-error at +2:20 {{immediate must be an integer in the range [0, 31]}}
+# minus-error at +1 {{invalid instruction}}
 qc.mvltui x9, x10, 37, x12
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)}}
 qc.mvltui x9, x10, 5, x12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvgeui 9, x10, 5, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:13: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:13 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.mvgeui x9
 
-# CHECK-PLUS: :[[@LINE+1]]:20: error: immediate must be an integer in the range [0, 31]
+# plus-error at +2:20 {{immediate must be an integer in the range [0, 31]}}
+# minus-error at +1 {{invalid instruction}}
 qc.mvgeui x9, x10, 37, x12
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicm' (Qualcomm uC Conditional Move Extension)}}
 qc.mvgeui x9, x10, 5, x12
diff --git a/llvm/test/MC/RISCV/xqcics-invalid.s b/llvm/test/MC/RISCV/xqcics-invalid.s
index 548ceb4cbf29cd..002a1d83ffcdbf 100644
--- a/llvm/test/MC/RISCV/xqcics-invalid.s
+++ b/llvm/test/MC/RISCV/xqcics-invalid.s
@@ -1,137 +1,147 @@
 # Xqcics - Qualcomm uC Conditional Select Extension
-# RUN: not llvm-mc -triple riscv32 -mattr=+xqcics < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-PLUS %s
-# RUN: not llvm-mc -triple riscv32 -mattr=-xqcics < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-MINUS %s
+# RUN: llvm-mc --verify=plus -triple riscv32 -mattr=+xqcics < %s
+# RUN: llvm-mc --verify=minus -triple riscv32 -mattr=-xqcics < %s
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selecteqi 9, 15, x4, x3
 
-# CHECK-PLUS: :[[@LINE+2]]:24: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:24 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selecteqi x9, 15, x4
 
-# CHECK-PLUS: :[[@LINE+1]]:18: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:18 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.selecteqi x9, 16, x4, x3
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)}}
 qc.selecteqi x9, 15, x4, x3
 
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selectieq 8, x4, x3, 12
 
-# CHECK-PLUS: :[[@LINE+2]]:24: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:24 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selectieq x8, x4, x3
 
-# CHECK-PLUS: :[[@LINE+1]]:26: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:26 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.selectieq x8, x4, x3, 17
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)}}
 qc.selectieq x8, x4, x3, 12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selectieqi 9, 11, x3, 12
 
-# CHECK-PLUS: :[[@LINE+2]]:25: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:25 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selectieqi x9, 11, x3
 
-# CHECK-PLUS: :[[@LINE+1]]:19: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:19 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.selectieqi x9, 16, x3, 12
 
-# CHECK-PLUS: :[[@LINE+1]]:27: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:27 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.selectieqi x9, 11, x3, 18
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)}}
 qc.selectieqi x9, 11, x3, 12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selectiieq 9, x3, 11, 12
 
-# CHECK-PLUS: :[[@LINE+2]]:25: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:25 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selectiieq x9, x3, 11
 
-# CHECK-PLUS: :[[@LINE+1]]:23: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:23 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.selectiieq x9, x3, 16, 12
 
-# CHECK-PLUS: :[[@LINE+1]]:27: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:27 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.selectiieq x9, x3, 11, 17
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)}}
 qc.selectiieq x9, x3, 11, 12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selectiine 8, x3, 10, 11
 
-# CHECK-PLUS: :[[@LINE+2]]:25: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:25 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selectiine x8, x3, 10
 
-# CHECK-PLUS: :[[@LINE+1]]:23: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:23 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.selectiine x8, x3, 16, 11
 
-# CHECK-PLUS: :[[@LINE+1]]:27: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:27 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.selectiine x8, x3, 12, 18
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)}}
 qc.selectiine x8, x3, 10, 11
 
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selectine 8, x3, x4, 11
 
-# CHECK-PLUS: :[[@LINE+2]]:24: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:24 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selectine x8, x3, x4
 
-# CHECK-PLUS: :[[@LINE+1]]:26: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:26 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.selectine x8, x3, x4, 16
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)}}
 qc.selectine x8, x3, x4, 11
 
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selectinei 8, 11, x3, 12
 
-# CHECK-PLUS: :[[@LINE+2]]:25: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:25 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selectinei x8, 11, x3
 
-# CHECK-PLUS: :[[@LINE+1]]:19: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:19 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.selectinei x8, 16, x3, 12
 
-# CHECK-PLUS: :[[@LINE+1]]:27: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:27 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.selectinei x8, 11, x3, 18
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)}}
 qc.selectinei x8, 11, x3, 12
 
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selectnei 8, 11, x3, x5
 
-# CHECK-PLUS: :[[@LINE+2]]:24: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:24 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.selectnei x8, 11, x3
 
-# CHECK-PLUS: :[[@LINE+1]]:18: error: immediate must be an integer in the range [-16, 15]
+# plus-error at +2:18 {{immediate must be an integer in the range [-16, 15]}}
+# minus-error at +1 {{invalid instruction}}
 qc.selectnei x8, 16, x3, x5
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcics' (Qualcomm uC Conditional Select Extension)}}
 qc.selectnei x8, 11, x3, x5
 
diff --git a/llvm/test/MC/RISCV/xqcicsr-invalid.s b/llvm/test/MC/RISCV/xqcicsr-invalid.s
index 3b3a319cba9c67..c031dd70f7da49 100644
--- a/llvm/test/MC/RISCV/xqcicsr-invalid.s
+++ b/llvm/test/MC/RISCV/xqcicsr-invalid.s
@@ -1,31 +1,30 @@
 # Xqcicsr - Qualcomm uC CSR Extension
-# RUN: not llvm-mc -triple riscv32 -mattr=+xqcicsr < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-PLUS %s
-# RUN: not llvm-mc -triple riscv32 -mattr=-xqcicsr < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-MINUS %s
+# RUN: llvm-mc --verify=plus -triple riscv32 -mattr=+xqcicsr < %s
+# RUN: llvm-mc --verify=minus -triple riscv32 -mattr=-xqcicsr < %s
 
-# CHECK-PLUS: :[[@LINE+2]]:20: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:20 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.csrrwr x10, x5, x0
 
-# CHECK-PLUS: :[[@LINE+2]]:18: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:18 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.csrrwr x10, x5
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicsr' (Qualcomm uC CSR Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicsr' (Qualcomm uC CSR Extension)}}
 qc.csrrwr x10, x5, x20
 
 
-# CHECK-PLUS: :[[@LINE+2]]:21: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:21 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.csrrwri x20, 31, x0
 
-# CHECK-PLUS: :[[@LINE+1]]:17: error: immediate must be an integer in the range [0, 31]
+# plus-error at +2:17 {{immediate must be an integer in the range [0, 31]}}
+# minus-error at +1 {{invalid instruction}}
 qc.csrrwri x20, 45, x12
 
-# CHECK-PLUS: :[[@LINE+2]]:19: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:19 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.csrrwri x20, 23
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicsr' (Qualcomm uC CSR Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcicsr' (Qualcomm uC CSR Extension)}}
 qc.csrrwri x30, 31, x12
diff --git a/llvm/test/MC/RISCV/xqciint-invalid.s b/llvm/test/MC/RISCV/xqciint-invalid.s
index b9f2c03c83dc06..b505d8c0f6c010 100644
--- a/llvm/test/MC/RISCV/xqciint-invalid.s
+++ b/llvm/test/MC/RISCV/xqciint-invalid.s
@@ -1,139 +1,138 @@
 # Xqciint - Qualcomm uC Interrupts extension
-# RUN: not llvm-mc -triple riscv32 -mattr=+xqciint < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-PLUS %s
-# RUN: not llvm-mc -triple riscv32 -mattr=-xqciint < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-MINUS %s
+# RUN: llvm-mc --verify=plus -triple riscv32 -mattr=+xqciint < %s
+# RUN: llvm-mc --verify=minus -triple riscv32 -mattr=-xqciint < %s
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: immediate must be an integer in the range [0, 1023]
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{immediate must be an integer in the range [0, 1023]}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.setinti 1025
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.setinti 11, 12
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.setinti
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)}}
 qc.setinti   10
 
 
-# CHECK-PLUS: :[[@LINE+1]]:12: error: immediate must be an integer in the range [0, 1023]
+# plus-error at +2:12 {{immediate must be an integer in the range [0, 1023]}}
+# minus-error at +1 {{invalid instruction}}
 qc.clrinti 2000
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.clrinti 22, x4
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.clrinti
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)}}
 qc.clrinti 8
 
 
-# CHECK-PLUS: :[[@LINE+2]]:13: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:13 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.clrint 22
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.clrint
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)}}
 qc.c.clrint x8
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.di 22
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)}}
 qc.c.di
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.dir 22
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.dir
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)}}
 qc.c.dir x8
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:9 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.ei 22
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)}}
 qc.c.ei
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.eir 22
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.eir
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)}}
 qc.c.eir x8
 
 
-# CHECK-PLUS: :[[@LINE+2]]:19: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:19 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.mienter.nest 22
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)}}
 qc.c.mienter.nest
 
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.mienter 22
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)}}
 qc.c.mienter
 
 
-# CHECK-PLUS: :[[@LINE+2]]:17: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:17 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.mileaveret 22
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)}}
 qc.c.mileaveret
 
 
-# CHECK-PLUS: :[[@LINE+2]]:13: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:13 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.setint 22
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.setint
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)}}
 qc.c.setint x8
 
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.mret x8
 
 # CHECK-EXT: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)
-qc.c.mret
+qc.c.mret # minus-error {{instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)}}
 
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.mnret 10
 
 # CHECK-EXT: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)
-qc.c.mnret
+qc.c.mnret # minus-error {{instruction requires the following: 'Xqciint' (Qualcomm uC Interrupts Extension)}}
diff --git a/llvm/test/MC/RISCV/xqcilb-invalid.s b/llvm/test/MC/RISCV/xqcilb-invalid.s
index 15eefda4e9d088..a4b096a565b9ad 100644
--- a/llvm/test/MC/RISCV/xqcilb-invalid.s
+++ b/llvm/test/MC/RISCV/xqcilb-invalid.s
@@ -1,31 +1,31 @@
 # Xqcilb - Qualcomm uC Long Branch Extension
-# RUN: not llvm-mc -triple riscv32 -mattr=+xqcilb < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK,CHECK-PLUS %s
-# RUN: not llvm-mc -triple riscv32 -mattr=-xqcilb < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK,CHECK-MINUS %s
+# RUN: llvm-mc --verify=expected,plus -triple riscv32 -mattr=+xqcilb < %s
+# RUN: llvm-mc --verify=expected,minus -triple riscv32 -mattr=-xqcilb < %s
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.j
 
-# CHECK-PLUS: :[[@LINE+1]]:9: error: operand must be a multiple of 2 bytes in the range [-2147483648, 2147483646]
+# plus-error at +2:9 {{operand must be a multiple of 2 bytes in the range [-2147483648, 2147483646]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.j  -2147483649
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilb' (Qualcomm uC Long Branch Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilb' (Qualcomm uC Long Branch Extension)}}
 qc.e.j  -2147483648
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilb' (Qualcomm uC Long Branch Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilb' (Qualcomm uC Long Branch Extension)}}
 qc.e.j  foo
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.jal
 
-# CHECK-PLUS: :[[@LINE+1]]:10: error: operand must be a multiple of 2 bytes in the range [-2147483648, 2147483646]
+# plus-error at +2:10 {{operand must be a multiple of 2 bytes in the range [-2147483648, 2147483646]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.jal 2147483649
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilb' (Qualcomm uC Long Branch Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilb' (Qualcomm uC Long Branch Extension)}}
 qc.e.jal 2147483640
 
-# CHECK: :[[@LINE+1]]:11: error: unexpected token
+# expected-error at +1:11 {{unexpected token}}
 qc.e.j foo at plt
diff --git a/llvm/test/MC/RISCV/xqcili-invalid.s b/llvm/test/MC/RISCV/xqcili-invalid.s
index 81775ee4367c82..39baf2096d3bbc 100644
--- a/llvm/test/MC/RISCV/xqcili-invalid.s
+++ b/llvm/test/MC/RISCV/xqcili-invalid.s
@@ -1,36 +1,36 @@
 # Xqcili - Qualcomm uC Load Large Immediate Extension
-# RUN: not llvm-mc -triple riscv32 -mattr=+xqcili < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-PLUS %s
-# RUN: not llvm-mc -triple riscv32 -mattr=-xqcili < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-MINUS %s
+# RUN: llvm-mc --verify=plus -triple riscv32 -mattr=+xqcili < %s
+# RUN: llvm-mc --verify=minus -triple riscv32 -mattr=-xqcili < %s
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension)
+# plus-error at +2:9 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension)}}
 qc.e.li 9, 33554432
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.li x9
 
-# CHECK-PLUS: :[[@LINE+3]]:1: error: invalid instruction, any one of the following would fix this:
-# CHECK-PLUS: :[[@LINE+2]]:13: note: immediate must be an integer in the range [-2147483648, 4294967295]
-# CHECK-PLUS: :[[@LINE+1]]:13: note: immediate must be an integer in the range [-2147483648, 4294967295]
+# plus-error at +4:1 {{invalid instruction, any one of the following would fix this:}}
+# plus-note at +3:13 {{immediate must be an integer in the range [-2147483648, 4294967295]}}
+# plus-note at +2:13 {{immediate must be an integer in the range [-2147483648, 4294967295]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.li x9, 4294967296
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension)}}
 qc.e.li x9, 4294967295
 
 
-# CHECK-PLUS: :[[@LINE+2]]:7: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:7 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.li x0, 114514
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:10 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.li x10
 
-# CHECK-PLUS: :[[@LINE+1]]:12: error: operand must be a symbol with a %qc.abs20 specifier or an integer in the range [-524288, 524287]
+# plus-error at +2:12 {{operand must be a symbol with a %qc.abs20 specifier or an integer in the range [-524288, 524287]}}
+# minus-error at +1 {{invalid instruction}}
 qc.li x10, 33554432
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension)}}
 qc.li x10, 114514
diff --git a/llvm/test/MC/RISCV/xqcilia-invalid.s b/llvm/test/MC/RISCV/xqcilia-invalid.s
index 6c0479e38b0935..f0dc8d49c15f0e 100644
--- a/llvm/test/MC/RISCV/xqcilia-invalid.s
+++ b/llvm/test/MC/RISCV/xqcilia-invalid.s
@@ -1,125 +1,131 @@
 # Xqcilia - Qualcomm uC Large Immediate Arithmetic extension
-# RUN: not llvm-mc -triple riscv32 -mattr=+xqcilia < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-PLUS %s
-# RUN: not llvm-mc -triple riscv32 -mattr=-xqcilia < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-MINUS %s
+# RUN: llvm-mc --verify=plus -triple riscv32 -mattr=+xqcilia < %s
+# RUN: llvm-mc --verify=minus -triple riscv32 -mattr=-xqcilia < %s
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.addai 9, 33554432
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.addai x9
 
-# CHECK-PLUS: :[[@LINE+1]]:16: error: immediate must be an integer in the range [-2147483648, 4294967295]
+# plus-error at +2:16 {{immediate must be an integer in the range [-2147483648, 4294967295]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.addai x9, 20485546494
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)}}
 qc.e.addai x9, 33554432
 
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.addi x10, 9, 554432
 
-# CHECK-PLUS: :[[@LINE+2]]:18: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:18 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.addi x10, x9
 
-# CHECK-PLUS: :[[@LINE+1]]:20: error: immediate must be an integer in the range [-33554432, 33554431]
+# plus-error at +2:20 {{immediate must be an integer in the range [-33554432, 33554431]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.addi x10, x9, 335544312
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)}}
 qc.e.addi x10, x9, 554432
 
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.andai 9, 33554432
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.andai x9
 
-# CHECK-PLUS: :[[@LINE+1]]:16: error: immediate must be an integer in the range [-2147483648, 4294967295]
+# plus-error at +2:16 {{immediate must be an integer in the range [-2147483648, 4294967295]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.andai x9, 20494437494
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)}}
 qc.e.andai x9, 33554432
 
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.andi x10, 9, 554432
 
-# CHECK-PLUS: :[[@LINE+2]]:18: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:18 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.andi x10, x9
 
-# CHECK-PLUS: :[[@LINE+1]]:20: error: immediate must be an integer in the range [-33554432, 33554431]
+# plus-error at +2:20 {{immediate must be an integer in the range [-33554432, 33554431]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.andi x10, x9, 335544312
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)}}
 qc.e.andi x10, x9, 554432
 
 
-# CHECK-PLUS: :[[@LINE+2]]:11: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:11 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.orai 9, 33554432
 
-# CHECK-PLUS: :[[@LINE+2]]:13: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:13 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.orai x9
 
-# CHECK-PLUS: :[[@LINE+1]]:15: error: immediate must be an integer in the range [-2147483648, 4294967295]
+# plus-error at +2:15 {{immediate must be an integer in the range [-2147483648, 4294967295]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.orai x9, 20494437494
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)}}
 qc.e.orai x9, 33554432
 
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.ori x10, 9, 554432
 
-# CHECK-PLUS: :[[@LINE+2]]:17: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:17 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.ori x10, x9
 
-# CHECK-PLUS: :[[@LINE+1]]:19: error: immediate must be an integer in the range [-33554432, 33554431]
+# plus-error at +2:19 {{immediate must be an integer in the range [-33554432, 33554431]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.ori x10, x9, 335544312
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)}}
 qc.e.ori x10, x9, 554432
 
 
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.xorai 9, 33554432
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.xorai x9
 
-# CHECK-PLUS: :[[@LINE+1]]:16: error: immediate must be an integer in the range [-2147483648, 4294967295]
+# plus-error at +2:16 {{immediate must be an integer in the range [-2147483648, 4294967295]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.xorai x9, 20494437494
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)}}
 qc.e.xorai x9, 33554432
 
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{register must be a GPR excluding zero (x0)}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.xori x10, 9, 554432
 
-# CHECK-PLUS: :[[@LINE+2]]:18: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:18 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.xori x10, x9
 
-# CHECK-PLUS: :[[@LINE+1]]:20: error: immediate must be an integer in the range [-33554432, 33554431]
+# plus-error at +2:20 {{immediate must be an integer in the range [-33554432, 33554431]}}
+# minus-error at +1 {{invalid instruction}}
 qc.e.xori x10, x9, 335544312
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)}}
 qc.e.xori x10, x9, 554432
diff --git a/llvm/test/MC/RISCV/xqcilo-invalid.s b/llvm/test/MC/RISCV/xqcilo-invalid.s
index 7ef7a21272ba07..04611a33efc9d4 100644
--- a/llvm/test/MC/RISCV/xqcilo-invalid.s
+++ b/llvm/test/MC/RISCV/xqcilo-invalid.s
@@ -1,124 +1,130 @@
 # Xqcilo - Qualcomm uC Extension Large Offset Load Store extension
-# RUN: not llvm-mc -triple riscv32 -mattr=+xqcilo < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-PLUS %s
-# RUN: not llvm-mc -triple riscv32 -mattr=-xqcilo < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-MINUS %s
+# RUN: llvm-mc --verify=plus -triple riscv32 -mattr=+xqcilo < %s
+# RUN: llvm-mc --verify=minus -triple riscv32 -mattr=-xqcilo < %s
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# plus-error at +2:9 {{register must be a GPR}}
+# minus-error at +1:1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lb 11, 12(x10)
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.lb x11
 
-# CHECK-PLUS: :[[@LINE+1]]:14: error: immediate must be an integer in the range [-33554432, 33554431]
+# plus-error at +2:14 {{immediate must be an integer in the range [-33554432, 33554431]}}
+# minus-error at +1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lb x11, 33445562212(x10)
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lb x11, 12(x10)
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# plus-error at +2:10 {{register must be a GPR}}
+# minus-error at +1:1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lbu 11, 12(x10)
 
-# CHECK-PLUS: :[[@LINE+2]]:13: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:13 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.lbu x11
 
-# CHECK-PLUS: :[[@LINE+1]]:15: error: immediate must be an integer in the range [-33554432, 33554431]
+# plus-error at +2:15 {{immediate must be an integer in the range [-33554432, 33554431]}}
+# minus-error at +1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lbu x11, 33445562212(x10)
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lbu x11, 12(x10)
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# plus-error at +2:9 {{register must be a GPR}}
+# minus-error at +1:1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lh 11, 12(x10)
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.lh x11
 
-# CHECK-PLUS: :[[@LINE+1]]:14: error: immediate must be an integer in the range [-33554432, 33554431]
+# plus-error at +2:14 {{immediate must be an integer in the range [-33554432, 33554431]}}
+# minus-error at +1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lh x11, 33445562212(x10)
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lh x11, 12(x10)
 
 
-# CHECK-PLUS: :[[@LINE+2]]:10: error: register must be a GPR
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# plus-error at +2:10 {{register must be a GPR}}
+# minus-error at +1:1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lhu 11, 12(x10)
 
-# CHECK-PLUS: :[[@LINE+2]]:13: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:13 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.lhu x11
 
-# CHECK-PLUS: :[[@LINE+1]]:15: error: immediate must be an integer in the range [-33554432, 33554431]
+# plus-error at +2:15 {{immediate must be an integer in the range [-33554432, 33554431]}}
+# minus-error at +1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lhu x11, 33445562212(x10)
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lhu x11, 12(x10)
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# plus-error at +2:9 {{register must be a GPR}}
+# minus-error at +1:1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lw 11, 12(x10)
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.lw x11
 
-# CHECK-PLUS: :[[@LINE+1]]:14: error: immediate must be an integer in the range [-33554432, 33554431]
+# plus-error at +2:14 {{immediate must be an integer in the range [-33554432, 33554431]}}
+# minus-error at +1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lw x11, 33445562212(x10)
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.lw x11, 12(x10)
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# plus-error at +2:9 {{register must be a GPR}}
+# minus-error at +1:1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.sb 11, 12(x10)
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.sb x11
 
-# CHECK-PLUS: :[[@LINE+1]]:14: error: immediate must be an integer in the range [-33554432, 33554431]
+# plus-error at +2:14 {{immediate must be an integer in the range [-33554432, 33554431]}}
+# minus-error at +1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.sb x11, 33445562212(x10)
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.sb x11, 12(x10)
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# plus-error at +2:9 {{register must be a GPR}}
+# minus-error at +1:1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.sh 11, 12(x10)
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.sh x11
 
-# CHECK-PLUS: :[[@LINE+1]]:14: error: immediate must be an integer in the range [-33554432, 33554431]
+# plus-error at +2:14 {{immediate must be an integer in the range [-33554432, 33554431]}}
+# minus-error at +1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.sh x11, 33445562212(x10)
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.sh x11, 12(x10)
 
 
-# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# plus-error at +2:9 {{register must be a GPR}}
+# minus-error at +1:1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.sw 11, 12(x10)
 
-# CHECK-PLUS: :[[@LINE+2]]:12: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:12 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.e.sw x11
 
-# CHECK-PLUS: :[[@LINE+1]]:14: error: immediate must be an integer in the range [-33554432, 33554431]
+# plus-error at +2:14 {{immediate must be an integer in the range [-33554432, 33554431]}}
+# minus-error at +1 {{instruction requires the following: 'Xqcili' (Qualcomm uC Load Large Immediate Extension), 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.sw x11, 33445562212(x10)
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)}}
 qc.e.sw x11, 12(x10)
diff --git a/llvm/test/MC/RISCV/xqcisim-invalid.s b/llvm/test/MC/RISCV/xqcisim-invalid.s
index 5987aa190bee1c..288c56af548ebf 100644
--- a/llvm/test/MC/RISCV/xqcisim-invalid.s
+++ b/llvm/test/MC/RISCV/xqcisim-invalid.s
@@ -1,125 +1,150 @@
 # Xqcisim - Simulaton Hint Instructions
-# RUN: not llvm-mc -triple riscv32 -mattr=+xqcisim < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-PLUS %s
-# RUN: not llvm-mc -triple riscv32 -mattr=-xqcisim < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-MINUS %s
+# RUN: llvm-mc --verify=plus -triple riscv32 -mattr=+xqcisim < %s
+# RUN: llvm-mc --verify=minus -triple riscv32 -mattr=-xqcisim < %s
 
-# CHECK-PLUS: :[[@LINE+1]]:14: error: immediate must be an integer in the range [0, 1023]
+# plus-error at +2:14 {{immediate must be an integer in the range [0, 1023]}}
+# minus-error at +1 {{invalid instruction}}
 qc.psyscalli 1024
 
-# CHECK-PLUS: :[[@LINE+1]]:1: error: too few operands for instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.psyscalli
 
-# CHECK-PLUS: :[[@LINE+1]]:18: error: unexpected extra operand for instruction
+# plus-error at +2:18 {{unexpected extra operand for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.psyscalli 23, x0
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)}}
 qc.psyscalli       1023
 
 
-# CHECK-PLUS: :[[@LINE+1]]:11: error: immediate must be an integer in the range [0, 255]
+# plus-error at +2:11 {{immediate must be an integer in the range [0, 255]}}
+# minus-error at +1 {{invalid instruction}}
 qc.pputci 256
 
-# CHECK-PLUS: :[[@LINE+1]]:1: error: too few operands for instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.pputci
 
-# CHECK-PLUS: :[[@LINE+1]]:16: error: unexpected extra operand for instruction
+# plus-error at +2:16 {{unexpected extra operand for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.pputci 200, x8
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)}}
 qc.pputci  255
 
 
-# CHECK-PLUS: :[[@LINE+1]]:13: error: unexpected extra operand for instruction
+# plus-error at +2:13 {{unexpected extra operand for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.c.ptrace x0
 
-# CHECK-PLUS: :[[@LINE+1]]:13: error: unexpected extra operand for instruction
+# plus-error at +2:13 {{unexpected extra operand for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.c.ptrace 1
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)}}
 qc.c.ptrace
 
 
-# CHECK-PLUS: :[[@LINE+1]]:14: error: unexpected extra operand for instruction
+# plus-error at +2:14 {{unexpected extra operand for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.pcoredump 12
 
-# CHECK-PLUS: :[[@LINE+1]]:14: error: unexpected extra operand for instruction
+# plus-error at +2:14 {{unexpected extra operand for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.pcoredump x4
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)}}
 qc.pcoredump
 
 
-# CHECK-PLUS: :[[@LINE+1]]:11: error: unexpected extra operand for instruction
+# plus-error at +2:11 {{unexpected extra operand for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.ppregs x1
 
-# CHECK-PLUS: :[[@LINE+1]]:11: error: unexpected extra operand for instruction
+# plus-error at +2:11 {{unexpected extra operand for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.ppregs 23
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)}}
 qc.ppregs
 
 
-# CHECK-PLUS: :[[@LINE+1]]:15: error: unexpected extra operand for instruction
+# plus-error at +2:15 {{unexpected extra operand for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.ppreg x10, x2
 
-# CHECK-PLUS: :[[@LINE+1]]:1: error: too few operands for instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.ppreg
 
-# CHECK-PLUS: :[[@LINE+1]]:10: error: register must be a GPR
+# plus-error at +2:10 {{register must be a GPR}}
+# minus-error at +1 {{invalid instruction}}
 qc.ppreg 23
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)}}
 qc.ppreg   a0
 
 
-# CHECK-PLUS: :[[@LINE+1]]:14: error: unexpected extra operand for instruction
+# plus-error at +2:14 {{unexpected extra operand for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.pputc x7, x3
 
-# CHECK-PLUS: :[[@LINE+1]]:1: error: too few operands for instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.pputc
 
-# CHECK-PLUS: :[[@LINE+1]]:10: error: register must be a GPR
+# plus-error at +2:10 {{register must be a GPR}}
+# minus-error at +1 {{invalid instruction}}
 qc.pputc 34
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)}}
 qc.pputc   t2
 
 
-# CHECK-PLUS: :[[@LINE+1]]:15: error: unexpected extra operand for instruction
+# plus-error at +2:15 {{unexpected extra operand for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.pputs x15, x18
 
-# CHECK-PLUS: :[[@LINE+1]]:1: error: too few operands for instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.pputs
 
-# CHECK-PLUS: :[[@LINE+1]]:10: error: register must be a GPR
+# plus-error at +2:10 {{register must be a GPR}}
+# minus-error at +1 {{invalid instruction}}
 qc.pputs 45
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)}}
 qc.pputs   a5
 
 
-# CHECK-PLUS: :[[@LINE+1]]:15: error: unexpected extra operand for instruction
+# plus-error at +2:15 {{unexpected extra operand for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.pexit x26, x23
 
-# CHECK-PLUS: :[[@LINE+1]]:1: error: too few operands for instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.pexit
 
-# CHECK-PLUS: :[[@LINE+1]]:10: error: register must be a GPR
+# plus-error at +2:10 {{register must be a GPR}}
+# minus-error at +1 {{invalid instruction}}
 qc.pexit 78
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)}}
 qc.pexit   s10
 
 
-# CHECK-PLUS: :[[@LINE+1]]:18: error: unexpected extra operand for instruction
+# plus-error at +2:18 {{unexpected extra operand for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.psyscall x11, x5
 
-# CHECK-PLUS: :[[@LINE+1]]:1: error: too few operands for instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1 {{invalid instruction}}
 qc.psyscall
 
-# CHECK-PLUS: :[[@LINE+1]]:13: error: register must be a GPR
+# plus-error at +2:13 {{register must be a GPR}}
+# minus-error at +1 {{invalid instruction}}
 qc.psyscall 98
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisim' (Qualcomm uC Simulation Hint Extension)}}
 qc.psyscall        a1
diff --git a/llvm/test/MC/RISCV/xqcisync-invalid.s b/llvm/test/MC/RISCV/xqcisync-invalid.s
index 84af7b78fc64cf..64e9aff83c7be0 100644
--- a/llvm/test/MC/RISCV/xqcisync-invalid.s
+++ b/llvm/test/MC/RISCV/xqcisync-invalid.s
@@ -1,139 +1,146 @@
 # Xqcisync - Qualcomm uC Sync Delay Extension
-# RUN: not llvm-mc -triple riscv32 -mattr=+xqcisync < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-PLUS %s
-# RUN: not llvm-mc -triple riscv32 -mattr=-xqcisync < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-MINUS %s
+# RUN: llvm-mc --verify=plus -triple riscv32 -mattr=+xqcisync < %s
+# RUN: llvm-mc --verify=minus -triple riscv32 -mattr=-xqcisync < %s
 
-# CHECK-PLUS: :[[@LINE+1]]:12: error: immediate must be an integer in the range [1, 31]
+# plus-error at +2:12 {{immediate must be an integer in the range [1, 31]}}
+# minus-error at +1 {{invalid instruction}}
 qc.c.delay 34
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.delay 11, 12
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.delay
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)}}
 qc.c.delay   10
 
 
-# CHECK-PLUS: :[[@LINE+1]]:9: error: immediate must be an integer in the range [0, 31]
+# plus-error at +2:9 {{immediate must be an integer in the range [0, 31]}}
+# minus-error at +1 {{invalid instruction}}
 qc.sync 45
 
-# CHECK-PLUS: :[[@LINE+2]]:13: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:13 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.sync 22, x4
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.sync
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)}}
 qc.sync 8
 
 
-# CHECK-PLUS: :[[@LINE+1]]:10: error: immediate must be an integer in the range [0, 31]
+# plus-error at +2:10 {{immediate must be an integer in the range [0, 31]}}
+# minus-error at +1 {{invalid instruction}}
 qc.syncr 56
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.syncr 31, 45
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.syncr
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)}}
 qc.syncr   23
 
 
-# CHECK-PLUS: :[[@LINE+1]]:11: error: immediate must be an integer in the range [0, 31]
+# plus-error at +2:11 {{immediate must be an integer in the range [0, 31]}}
+# minus-error at +1 {{invalid instruction}}
 qc.syncwf 88
 
-# CHECK-PLUS: :[[@LINE+2]]:14: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:14 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.syncwf 5, 44
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.syncwf
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)}}
 qc.syncwf  31
 
 
-# CHECK-PLUS: :[[@LINE+1]]:11: error: immediate must be an integer in the range [0, 31]
+# plus-error at +2:11 {{immediate must be an integer in the range [0, 31]}}
+# minus-error at +1 {{invalid instruction}}
 qc.syncwl 99
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.syncwl 11, x10
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.syncwl
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)}}
 qc.syncwl  1
 
 
-# CHECK-PLUS: :[[@LINE+1]]:11: error: immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31
+# plus-error at +2:11 {{immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31}}
+# minus-error at +1 {{invalid instruction}}
 qc.c.sync 45
 
-# CHECK-PLUS: :[[@LINE+2]]:15: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:15 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.sync 31, x4
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.sync
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)}}
 qc.c.sync 8
 
 
-# CHECK-PLUS: :[[@LINE+1]]:12: error: immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31
+# plus-error at +2:12 {{immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31}}
+# minus-error at +1 {{invalid instruction}}
 qc.c.syncr 56
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.syncr 31, 45
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.syncr
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)}}
 qc.c.syncr   8
 
 
-# CHECK-PLUS: :[[@LINE+1]]:13: error: immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31
+# plus-error at +2:13 {{immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31}}
+# minus-error at +1 {{invalid instruction}}
 qc.c.syncwf 88
 
-# CHECK-PLUS: :[[@LINE+2]]:16: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:16 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.syncwf 8, 44
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.syncwf
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)}}
 qc.c.syncwf  31
 
 
-# CHECK-PLUS: :[[@LINE+1]]:13: error: immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31
+# plus-error at +2:13 {{immediate must be one of: 0, 1, 2, 4, 8, 15, 16, 31}}
+# minus-error at +1 {{invalid instruction}}
 qc.c.syncwl 99
 
-# CHECK-PLUS: :[[@LINE+2]]:17: error: unexpected extra operand for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:17 {{unexpected extra operand for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.syncwl 15, x10
 
-# CHECK-PLUS: :[[@LINE+2]]:1: error: too few operands for instruction
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
+# plus-error at +2:1 {{too few operands for instruction}}
+# minus-error at +1:1 {{invalid instruction}}
 qc.c.syncwl
 
-# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)
+# minus-error at +1:1 {{instruction requires the following: 'Xqcisync' (Qualcomm uC Sync Delay Extension)}}
 qc.c.syncwl  1
diff --git a/llvm/test/MC/RISCV/zibi-valid.s b/llvm/test/MC/RISCV/zibi-valid.s
index b86d10e58e8f91..4ec005764fd7fc 100644
--- a/llvm/test/MC/RISCV/zibi-valid.s
+++ b/llvm/test/MC/RISCV/zibi-valid.s
@@ -2,10 +2,8 @@
 # RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-ASM
 # RUN: llvm-mc -triple=riscv64 -show-encoding --mattr=+experimental-zibi %s \
 # RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-ASM
-# RUN: not llvm-mc -triple=riscv32 -show-encoding %s 2>&1 \
-# RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
-# RUN: not llvm-mc -triple=riscv64 -show-encoding %s 2>&1 \
-# RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+# RUN: llvm-mc --verify -triple=riscv32 -show-encoding %s
+# RUN: llvm-mc --verify -triple=riscv64 -show-encoding %s
 # RUN: llvm-mc -triple=riscv32 -filetype=obj --mattr=+experimental-zibi %s \
 # RUN:        | llvm-objdump -dr --mattr=+experimental-zibi --no-print-imm-hex  - \
 # RUN:        | FileCheck %s --check-prefix=CHECK-OBJ
@@ -13,44 +11,44 @@ beqi a0, 1, 1024
 # CHECK-OBJ: beqi a0, 1, 0x400
 # CHECK-ASM: beqi a0, 1, 1024
 # CHECK-ENCODING: [0x63,0x20,0x15,0x40]
-# CHECK-ERROR: instruction requires the following: 'Zibi' (Branch with Immediate){{$}}
+# expected-error at -4 {{instruction requires the following: 'Zibi' (Branch with Immediate)}}
 beqi a5, -1, -1024
 # CHECK-OBJ: beqi a5, -1, 0xfffffc04
 # CHECK-ASM: beqi a5, -1, -1024
 # CHECK-ENCODING: [0xe3,0xa0,0x07,0xc0]
-# CHECK-ERROR: instruction requires the following: 'Zibi' (Branch with Immediate){{$}}
+# expected-error at -4 {{instruction requires the following: 'Zibi' (Branch with Immediate)}}
 beqi s0, 22, 0xffe
 # CHECK-OBJ: beqi s0, 22, 0x1006
 # CHECK-ASM: beqi s0, 22, 4094
 # CHECK-ENCODING: [0xe3,0x2f,0x64,0x7f]
-# CHECK-ERROR: instruction requires the following: 'Zibi' (Branch with Immediate){{$}}
+# expected-error at -4 {{instruction requires the following: 'Zibi' (Branch with Immediate)}}
 beqi s1, 11, -4096
 # CHECK-OBJ: beqi s1, 11, 0xfffff00c
 # CHECK-ASM: beqi s1, 11, -4096
 # CHECK-ENCODING: [0x63,0xa0,0xb4,0x80]
-# CHECK-ERROR: instruction requires the following: 'Zibi' (Branch with Immediate){{$}}
+# expected-error at -4 {{instruction requires the following: 'Zibi' (Branch with Immediate)}}
 bnei a0, 1, 1024
 # CHECK-OBJ: bnei a0, 1, 0x410
 # CHECK-ASM: bnei a0, 1, 1024
 # CHECK-ENCODING: [0x63,0x30,0x15,0x40]
-# CHECK-ERROR: instruction requires the following: 'Zibi' (Branch with Immediate){{$}}
+# expected-error at -4 {{instruction requires the following: 'Zibi' (Branch with Immediate)}}
 bnei a5, -1, -1024
 # CHECK-OBJ: bnei a5, -1, 0xfffffc14
 # CHECK-ASM: bnei a5, -1, -1024
 # CHECK-ENCODING: [0xe3,0xb0,0x07,0xc0]
-# CHECK-ERROR: instruction requires the following: 'Zibi' (Branch with Immediate){{$}}
+# expected-error at -4 {{instruction requires the following: 'Zibi' (Branch with Immediate)}}
 bnei s0, 22, 0xffe
 # CHECK-OBJ: bnei s0, 22, 0x1016
 # CHECK-ASM: bnei s0, 22, 4094
 # CHECK-ENCODING: [0xe3,0x3f,0x64,0x7f]
-# CHECK-ERROR: instruction requires the following: 'Zibi' (Branch with Immediate){{$}}
+# expected-error at -4 {{instruction requires the following: 'Zibi' (Branch with Immediate)}}
 bnei s1, 11, -4096
 # CHECK-OBJ: bnei s1, 11, 0xfffff01c
 # CHECK-ASM: bnei s1, 11, -4096
 # CHECK-ENCODING: [0x63,0xb0,0xb4,0x80]
-# CHECK-ERROR: instruction requires the following: 'Zibi' (Branch with Immediate){{$}}
+# expected-error at -4 {{instruction requires the following: 'Zibi' (Branch with Immediate)}}
 
-bnei s1, 12, undef+1
+bnei s1, 12, undef+1 # expected-error {{instruction requires the following: 'Zibi' (Branch with Immediate)}}
 # CHECK-OBJ:      beqi s1, 12, {{.*}}
 # CHECK-OBJ-NEXT: j {{.*}}
 # CHECK-OBJ-NEXT: R_RISCV_JAL undef+0x1
diff --git a/llvm/test/MC/RISCV/zicfiss-valid.s b/llvm/test/MC/RISCV/zicfiss-valid.s
index 2cfea489ad72bd..7f561fb642e7e3 100644
--- a/llvm/test/MC/RISCV/zicfiss-valid.s
+++ b/llvm/test/MC/RISCV/zicfiss-valid.s
@@ -13,54 +13,61 @@
 # not Zicfiss. SSAMOSWAP still requires Zicfiss.
 # (riscv-non-isa/riscv-elf-psabi-doc#474)
 #
-# RUN: not llvm-mc -triple riscv32 -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
-# RUN: not llvm-mc -triple riscv64 -defsym=RV64=1 -M no-aliases -show-encoding < %s 2>&1 \
-# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT-RV64 %s
+# RUN: llvm-mc --verify=no-ext -triple riscv32 -M no-aliases -show-encoding < %s
+# RUN: llvm-mc --verify=no-ext-rv64 -triple riscv64 -defsym=RV64=1 -M no-aliases -show-encoding < %s
 
 # CHECK-ASM-AND-OBJ: sspopchk ra
 # CHECK-ASM: encoding: [0x73,0xc0,0xc0,0xcd]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 sspopchk x1
 
 # CHECK-ASM-AND-OBJ: sspopchk ra
 # CHECK-ASM: encoding: [0x73,0xc0,0xc0,0xcd]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 sspopchk ra
 
 # CHECK-ASM-AND-OBJ: sspopchk t0
 # CHECK-ASM: encoding: [0x73,0xc0,0xc2,0xcd]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 sspopchk x5
 
 # CHECK-ASM-AND-OBJ: sspopchk t0
 # CHECK-ASM: encoding: [0x73,0xc0,0xc2,0xcd]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 sspopchk t0
 
 # CHECK-ASM-AND-OBJ: sspush ra
 # CHECK-ASM: encoding: [0x73,0x40,0x10,0xce]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 sspush x1
 
 # CHECK-ASM-AND-OBJ: sspush ra
 # CHECK-ASM: encoding: [0x73,0x40,0x10,0xce]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 sspush ra
 
 # CHECK-ASM-AND-OBJ: sspush t0
 # CHECK-ASM: encoding: [0x73,0x40,0x50,0xce]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 sspush x5
 
 # CHECK-ASM-AND-OBJ: sspush t0
 # CHECK-ASM: encoding: [0x73,0x40,0x50,0xce]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 sspush t0
 
 # CHECK-ASM-AND-OBJ: ssrdp ra
 # CHECK-ASM: encoding: [0xf3,0x40,0xc0,0xcd]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 ssrdp ra
 
 # sspopchk, sspush, and ssrdp share their encoding with the Zimop mop.r.28
@@ -73,72 +80,81 @@ ssrdp ra
 
 # CHECK-ASM-AND-OBJ: sspopchk ra
 # CHECK-ASM: encoding: [0x73,0xc0,0xc0,0xcd]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 mop.r.28 x0, x1
 
 # CHECK-ASM-AND-OBJ: sspopchk t0
 # CHECK-ASM: encoding: [0x73,0xc0,0xc2,0xcd]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 mop.r.28 x0, x5
 
 # CHECK-ASM-AND-OBJ: ssrdp ra
 # CHECK-ASM: encoding: [0xf3,0x40,0xc0,0xcd]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 mop.r.28 x1, x0
 
 # CHECK-ASM-AND-OBJ: ssrdp t0
 # CHECK-ASM: encoding: [0xf3,0x42,0xc0,0xcd]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 mop.r.28 x5, x0
 
 # CHECK-ASM-AND-OBJ: sspush ra
 # CHECK-ASM: encoding: [0x73,0x40,0x10,0xce]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 mop.rr.7 x0, x0, x1
 
 # CHECK-ASM-AND-OBJ: sspush t0
 # CHECK-ASM: encoding: [0x73,0x40,0x50,0xce]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zimop' (May-Be-Operations)
+# no-ext-error at +2 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zimop' (May-Be-Operations)}}
 mop.rr.7 x0, x0, x5
 
 # CHECK-ASM-AND-OBJ: ssamoswap.w a4, ra, (s0)
 # CHECK-ASM: encoding: [0x2f,0x27,0x14,0x48]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zicfiss' (Shadow stack)
+# no-ext-error at +2 {{instruction requires the following: 'Zicfiss' (Shadow stack)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zicfiss' (Shadow stack)}}
 ssamoswap.w a4, ra, (s0)
 
 # CHECK-ASM-AND-OBJ: ssamoswap.w.aq a4, ra, (s0)
 # CHECK-ASM: encoding: [0x2f,0x27,0x14,0x4c]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zicfiss' (Shadow stack)
+# no-ext-error at +2 {{instruction requires the following: 'Zicfiss' (Shadow stack)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zicfiss' (Shadow stack)}}
 ssamoswap.w.aq a4, ra, (s0)
 
 # CHECK-ASM-AND-OBJ: ssamoswap.w.rl a4, ra, (s0)
 # CHECK-ASM: encoding: [0x2f,0x27,0x14,0x4a]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zicfiss' (Shadow stack)
+# no-ext-error at +2 {{instruction requires the following: 'Zicfiss' (Shadow stack)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zicfiss' (Shadow stack)}}
 ssamoswap.w.rl a4, ra, (s0)
 
 # CHECK-ASM-AND-OBJ: ssamoswap.w.aqrl a4, ra, (s0)
 # CHECK-ASM: encoding: [0x2f,0x27,0x14,0x4e]
-# CHECK-NO-EXT: error: instruction requires the following: 'Zicfiss' (Shadow stack)
+# no-ext-error at +2 {{instruction requires the following: 'Zicfiss' (Shadow stack)}}
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zicfiss' (Shadow stack)}}
 ssamoswap.w.aqrl a4, ra, (s0)
 
 .ifdef RV64
 # CHECK-ASM-AND-OBJ-RV64: ssamoswap.d a4, ra, (s0)
 # CHECK-ASM-RV64: encoding: [0x2f,0x37,0x14,0x48]
-# CHECK-NO-EXT-RV64: error: instruction requires the following: 'Zicfiss' (Shadow stack)
-ssamoswap.d a4, ra, (s0)
+ssamoswap.d a4, ra, (s0) # no-ext-rv64-error {{instruction requires the following: 'Zicfiss' (Shadow stack)}}
 
 # CHECK-ASM-AND-OBJ-RV64: ssamoswap.d.aq a4, ra, (s0)
 # CHECK-ASM-RV64: encoding: [0x2f,0x37,0x14,0x4c]
-# CHECK-NO-EXT-RV64: error: instruction requires the following: 'Zicfiss' (Shadow stack)
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zicfiss' (Shadow stack)}}
 ssamoswap.d.aq a4, ra, (s0)
 
 # CHECK-ASM-AND-OBJ-RV64: ssamoswap.d.rl a4, ra, (s0)
 # CHECK-ASM-RV64: encoding: [0x2f,0x37,0x14,0x4a]
-# CHECK-NO-EXT-RV64: error: instruction requires the following: 'Zicfiss' (Shadow stack)
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zicfiss' (Shadow stack)}}
 ssamoswap.d.rl a4, ra, (s0)
 
 # CHECK-ASM-AND-OBJ-RV64: ssamoswap.d.aqrl a4, ra, (s0)
 # CHECK-ASM-RV64: encoding: [0x2f,0x37,0x14,0x4e]
-# CHECK-NO-EXT-RV64: error: instruction requires the following: 'Zicfiss' (Shadow stack)
+# no-ext-rv64-error at +1 {{instruction requires the following: 'Zicfiss' (Shadow stack)}}
 ssamoswap.d.aqrl a4, ra, (s0)
 .endif



More information about the llvm-branch-commits mailing list