[llvm] [RISCV] Allow prefetch hints without Zicbop. (PR #191027)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 07:10:21 PDT 2026


https://github.com/topperc updated https://github.com/llvm/llvm-project/pull/191027

>From 2d7c56b85cf9cd8d2423bca046ea46cacf486faa Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Wed, 8 Apr 2026 11:30:27 -0700
Subject: [PATCH 1/4] [RISCV] Allow prefetch hints without Zicbop.

The prefetch encodings are ORI with x0 destination. To be consistent
with other hints like Zihintntl, we should always allow these.
---
 llvm/lib/Target/RISCV/RISCVISelLowering.cpp  |   2 +-
 llvm/lib/Target/RISCV/RISCVInstrInfoZicbo.td |   9 +-
 llvm/test/CodeGen/RISCV/prefetch.ll          | 125 +++++++++++++++++++
 llvm/test/MC/RISCV/rvzicbom-invalid.s        |   3 -
 llvm/test/MC/RISCV/rvzicbop-valid.s          |  14 +++
 llvm/test/MC/RISCV/rvzicboz-invalid.s        |   3 -
 6 files changed, 145 insertions(+), 11 deletions(-)

diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 2e25b2ad122b8..7c3fe72e9eff6 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -822,7 +822,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
 
   if (Subtarget.hasVendorXMIPSCBOP())
     setOperationAction(ISD::PREFETCH, MVT::Other, Custom);
-  else if (Subtarget.hasStdExtZicbop())
+  else
     setOperationAction(ISD::PREFETCH, MVT::Other, Legal);
 
   if (Subtarget.hasStdExtZalrsc()) {
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZicbo.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZicbo.td
index 3ddcb1d615dbb..16f59c0c03c2e 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoZicbo.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZicbo.td
@@ -58,11 +58,12 @@ let Predicates = [HasStdExtZicboz] in {
 def CBO_ZERO : CBO_r<0b000000000100, "cbo.zero">, Sched<[]>;
 } // Predicates = [HasStdExtZicboz]
 
-let Predicates = [HasStdExtZicbop, NoVendorXMIPSCBOP] in {
+// prefetch hints are always available in the assembler and disassembler, even
+// without enabling Zicbop, per psABI decision
+// (riscv-non-isa/riscv-elf-psabi-doc#474).
 def PREFETCH_I : Prefetch_ri<0b00000, "prefetch.i">, Sched<[]>;
 def PREFETCH_R : Prefetch_ri<0b00001, "prefetch.r">, Sched<[]>;
 def PREFETCH_W : Prefetch_ri<0b00011, "prefetch.w">, Sched<[]>;
-} // Predicates = [HasStdExtZicbop, NoVendorXMIPSCBOP]
 
 //===----------------------------------------------------------------------===//
 // Patterns
@@ -70,7 +71,7 @@ def PREFETCH_W : Prefetch_ri<0b00011, "prefetch.w">, Sched<[]>;
 
 def AddrRegImmLsb00000 : ComplexPattern<iPTR, 2, "SelectAddrRegImmLsb00000">;
 
-let Predicates = [HasStdExtZicbop, NoVendorXMIPSCBOP] in {
+let Predicates = [NoVendorXMIPSCBOP] in {
   def : Pat<(prefetch (AddrRegImmLsb00000 (XLenVT GPR:$rs1), simm12_lsb00000:$imm12),
                       timm, timm, (i32 0)),
             (PREFETCH_I GPR:$rs1, simm12_lsb00000:$imm12)>;
@@ -80,4 +81,4 @@ let Predicates = [HasStdExtZicbop, NoVendorXMIPSCBOP] in {
   def : Pat<(prefetch (AddrRegImmLsb00000 (XLenVT GPR:$rs1), simm12_lsb00000:$imm12),
                       (i32 1), timm, (i32 1)),
             (PREFETCH_W GPR:$rs1, simm12_lsb00000:$imm12)>;
-} // Predicates = [HasStdExtZicbop, NoVendorXMIPSCBOP]
+} // Predicates = [NoVendorXMIPSCBOP]
diff --git a/llvm/test/CodeGen/RISCV/prefetch.ll b/llvm/test/CodeGen/RISCV/prefetch.ll
index dbce4e74954ca..36ecfa878e5cd 100644
--- a/llvm/test/CodeGen/RISCV/prefetch.ll
+++ b/llvm/test/CodeGen/RISCV/prefetch.ll
@@ -8,6 +8,8 @@
 define void @test_prefetch_read_locality_0(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_read_locality_0:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_read_locality_0:
@@ -22,6 +24,8 @@ define void @test_prefetch_read_locality_0(ptr %a) nounwind {
 define void @test_prefetch_write_locality_0(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_write_locality_0:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.w 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_write_locality_0:
@@ -36,6 +40,8 @@ define void @test_prefetch_write_locality_0(ptr %a) nounwind {
 define void @test_prefetch_instruction_locality_0(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_instruction_locality_0:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.i 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_instruction_locality_0:
@@ -50,6 +56,8 @@ define void @test_prefetch_instruction_locality_0(ptr %a) nounwind {
 define void @test_prefetch_read_locality_1(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_read_locality_1:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    ntl.pall
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_read_locality_1:
@@ -64,6 +72,8 @@ define void @test_prefetch_read_locality_1(ptr %a) nounwind {
 define void @test_prefetch_write_locality_1(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_write_locality_1:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    ntl.pall
+; NOZICBOP-NEXT:    prefetch.w 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_write_locality_1:
@@ -78,6 +88,8 @@ define void @test_prefetch_write_locality_1(ptr %a) nounwind {
 define void @test_prefetch_instruction_locality_1(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_instruction_locality_1:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    ntl.pall
+; NOZICBOP-NEXT:    prefetch.i 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_instruction_locality_1:
@@ -92,6 +104,8 @@ define void @test_prefetch_instruction_locality_1(ptr %a) nounwind {
 define void @test_prefetch_read_locality_2(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_read_locality_2:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    ntl.p1
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_read_locality_2:
@@ -106,6 +120,8 @@ define void @test_prefetch_read_locality_2(ptr %a) nounwind {
 define void @test_prefetch_write_locality_2(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_write_locality_2:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    ntl.p1
+; NOZICBOP-NEXT:    prefetch.w 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_write_locality_2:
@@ -120,6 +136,8 @@ define void @test_prefetch_write_locality_2(ptr %a) nounwind {
 define void @test_prefetch_instruction_locality_2(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_instruction_locality_2:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    ntl.p1
+; NOZICBOP-NEXT:    prefetch.i 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_instruction_locality_2:
@@ -134,6 +152,7 @@ define void @test_prefetch_instruction_locality_2(ptr %a) nounwind {
 define void @test_prefetch_read_locality_3(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_read_locality_3:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_read_locality_3:
@@ -147,6 +166,7 @@ define void @test_prefetch_read_locality_3(ptr %a) nounwind {
 define void @test_prefetch_write_locality_3(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_write_locality_3:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    prefetch.w 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_write_locality_3:
@@ -160,6 +180,7 @@ define void @test_prefetch_write_locality_3(ptr %a) nounwind {
 define void @test_prefetch_instruction_locality_3(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_instruction_locality_3:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    prefetch.i 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_instruction_locality_3:
@@ -173,6 +194,8 @@ define void @test_prefetch_instruction_locality_3(ptr %a) nounwind {
 define void @test_prefetch_offsetable_0(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_offsetable_0:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 2016(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_offsetable_0:
@@ -188,6 +211,8 @@ define void @test_prefetch_offsetable_0(ptr %a) nounwind {
 define void @test_prefetch_offsetable_1(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_offsetable_1:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r -2048(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_offsetable_1:
@@ -203,6 +228,8 @@ define void @test_prefetch_offsetable_1(ptr %a) nounwind {
 define void @test_prefetch_offsetable_2(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_offsetable_2:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 32(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_offsetable_2:
@@ -218,6 +245,8 @@ define void @test_prefetch_offsetable_2(ptr %a) nounwind {
 define void @test_prefetch_offsetable_3(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_offsetable_3:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r -32(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_offsetable_3:
@@ -233,6 +262,9 @@ define void @test_prefetch_offsetable_3(ptr %a) nounwind {
 define void @test_prefetch_offsetable_4(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_offsetable_4:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    addi a0, a0, 32
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 2016(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_offsetable_4:
@@ -249,6 +281,9 @@ define void @test_prefetch_offsetable_4(ptr %a) nounwind {
 define void @test_prefetch_offsetable_5(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_offsetable_5:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    addi a0, a0, -1
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r -2048(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_offsetable_5:
@@ -265,6 +300,9 @@ define void @test_prefetch_offsetable_5(ptr %a) nounwind {
 define void @test_prefetch_offsetable_6(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_offsetable_6:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    addi a0, a0, 16
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_offsetable_6:
@@ -281,6 +319,9 @@ define void @test_prefetch_offsetable_6(ptr %a) nounwind {
 define void @test_prefetch_offsetable_7(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_offsetable_7:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    addi a0, a0, -16
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_offsetable_7:
@@ -297,6 +338,10 @@ define void @test_prefetch_offsetable_7(ptr %a) nounwind {
 define void @test_prefetch_offsetable_9(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_offsetable_9:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a1, 1
+; NOZICBOP-NEXT:    add a0, a0, a1
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 64(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_offsetable_9:
@@ -314,6 +359,10 @@ define void @test_prefetch_offsetable_9(ptr %a) nounwind {
 define void @test_prefetch_offsetable_8(ptr %a) nounwind {
 ; NOZICBOP-LABEL: test_prefetch_offsetable_8:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a1, 1048575
+; NOZICBOP-NEXT:    add a0, a0, a1
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r -64(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_offsetable_8:
@@ -332,6 +381,8 @@ define void @test_prefetch_frameindex_0() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_frameindex_0:
 ; NOZICBOP:       # %bb.0:
 ; NOZICBOP-NEXT:    addi sp, sp, -512
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 0(sp)
 ; NOZICBOP-NEXT:    addi sp, sp, 512
 ; NOZICBOP-NEXT:    ret
 ;
@@ -355,6 +406,9 @@ define void @test_prefetch_frameindex_1() nounwind {
 ; NOZICBOP-NEXT:    lui a0, 1
 ; NOZICBOP-NEXT:    addi a0, a0, 16
 ; NOZICBOP-NEXT:    sub sp, sp, a0
+; NOZICBOP-NEXT:    addi a0, sp, 16
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    lui a0, 1
 ; NOZICBOP-NEXT:    addi a0, a0, 16
 ; NOZICBOP-NEXT:    add sp, sp, a0
@@ -382,6 +436,9 @@ define void @test_prefetch_frameindex_2() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_frameindex_2:
 ; NOZICBOP:       # %bb.0:
 ; NOZICBOP-NEXT:    addi sp, sp, -512
+; NOZICBOP-NEXT:    addi a0, sp, 16
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    addi sp, sp, 512
 ; NOZICBOP-NEXT:    ret
 ;
@@ -404,6 +461,9 @@ define void @test_prefetch_frameindex_3() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_frameindex_3:
 ; NOZICBOP:       # %bb.0:
 ; NOZICBOP-NEXT:    addi sp, sp, -512
+; NOZICBOP-NEXT:    addi a0, sp, -16
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    addi sp, sp, 512
 ; NOZICBOP-NEXT:    ret
 ;
@@ -426,6 +486,8 @@ define void @test_prefetch_frameindex_4() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_frameindex_4:
 ; NOZICBOP:       # %bb.0:
 ; NOZICBOP-NEXT:    addi sp, sp, -512
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 32(sp)
 ; NOZICBOP-NEXT:    addi sp, sp, 512
 ; NOZICBOP-NEXT:    ret
 ;
@@ -447,6 +509,8 @@ define void @test_prefetch_frameindex_5() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_frameindex_5:
 ; NOZICBOP:       # %bb.0:
 ; NOZICBOP-NEXT:    addi sp, sp, -512
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r -32(sp)
 ; NOZICBOP-NEXT:    addi sp, sp, 512
 ; NOZICBOP-NEXT:    ret
 ;
@@ -468,6 +532,8 @@ define void @test_prefetch_frameindex_6() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_frameindex_6:
 ; NOZICBOP:       # %bb.0:
 ; NOZICBOP-NEXT:    addi sp, sp, -512
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 2016(sp)
 ; NOZICBOP-NEXT:    addi sp, sp, 512
 ; NOZICBOP-NEXT:    ret
 ;
@@ -489,6 +555,8 @@ define void @test_prefetch_frameindex_7() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_frameindex_7:
 ; NOZICBOP:       # %bb.0:
 ; NOZICBOP-NEXT:    addi sp, sp, -512
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r -2048(sp)
 ; NOZICBOP-NEXT:    addi sp, sp, 512
 ; NOZICBOP-NEXT:    ret
 ;
@@ -510,6 +578,9 @@ define void @test_prefetch_frameindex_8() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_frameindex_8:
 ; NOZICBOP:       # %bb.0:
 ; NOZICBOP-NEXT:    addi sp, sp, -512
+; NOZICBOP-NEXT:    addi a0, sp, 2020
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    addi sp, sp, 512
 ; NOZICBOP-NEXT:    ret
 ;
@@ -532,6 +603,10 @@ define void @test_prefetch_frameindex_9() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_frameindex_9:
 ; NOZICBOP:       # %bb.0:
 ; NOZICBOP-NEXT:    addi sp, sp, -512
+; NOZICBOP-NEXT:    mv a0, sp
+; NOZICBOP-NEXT:    addi a0, a0, -4
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r -2048(a0)
 ; NOZICBOP-NEXT:    addi sp, sp, 512
 ; NOZICBOP-NEXT:    ret
 ;
@@ -554,6 +629,9 @@ define void @test_prefetch_frameindex_9() nounwind {
 define void @test_prefetch_constant_address_0() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_constant_address_0:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a0, 1
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 32(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_constant_address_0:
@@ -570,6 +648,10 @@ define void @test_prefetch_constant_address_0() nounwind {
 define void @test_prefetch_constant_address_1() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_constant_address_1:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a0, 1
+; NOZICBOP-NEXT:    addi a0, a0, 31
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_constant_address_1:
@@ -587,6 +669,9 @@ define void @test_prefetch_constant_address_1() nounwind {
 define void @test_prefetch_constant_address_2() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_constant_address_2:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a0, 1048561
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 32(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_constant_address_2:
@@ -603,6 +688,10 @@ define void @test_prefetch_constant_address_2() nounwind {
 define void @test_prefetch_constant_address_3() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_constant_address_3:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a0, 1048561
+; NOZICBOP-NEXT:    addi a0, a0, 31
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_constant_address_3:
@@ -622,6 +711,10 @@ define void @test_prefetch_constant_address_3() nounwind {
 define void @test_prefetch_global_0() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_global_0:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a0, %hi(g)
+; NOZICBOP-NEXT:    addi a0, a0, %lo(g)
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_global_0:
@@ -639,6 +732,10 @@ define void @test_prefetch_global_0() nounwind {
 define void @test_prefetch_global_1() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_global_1:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a0, %hi(g+16)
+; NOZICBOP-NEXT:    addi a0, a0, %lo(g+16)
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_global_1:
@@ -656,6 +753,10 @@ define void @test_prefetch_global_1() nounwind {
 define void @test_prefetch_global_2() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_global_2:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a0, %hi(g-16)
+; NOZICBOP-NEXT:    addi a0, a0, %lo(g-16)
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_global_2:
@@ -673,6 +774,10 @@ define void @test_prefetch_global_2() nounwind {
 define void @test_prefetch_global_3() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_global_3:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a0, %hi(g)
+; NOZICBOP-NEXT:    addi a0, a0, %lo(g)
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 32(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_global_3:
@@ -690,6 +795,10 @@ define void @test_prefetch_global_3() nounwind {
 define void @test_prefetch_global_4() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_global_4:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a0, %hi(g)
+; NOZICBOP-NEXT:    addi a0, a0, %lo(g)
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r -32(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_global_4:
@@ -707,6 +816,10 @@ define void @test_prefetch_global_4() nounwind {
 define void @test_prefetch_global_5() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_global_5:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a0, %hi(g)
+; NOZICBOP-NEXT:    addi a0, a0, %lo(g)
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 2016(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_global_5:
@@ -724,6 +837,10 @@ define void @test_prefetch_global_5() nounwind {
 define void @test_prefetch_global_6() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_global_6:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a0, %hi(g)
+; NOZICBOP-NEXT:    addi a0, a0, %lo(g)
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r -2048(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_global_6:
@@ -741,6 +858,10 @@ define void @test_prefetch_global_6() nounwind {
 define void @test_prefetch_global_7() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_global_7:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a0, %hi(g+2020)
+; NOZICBOP-NEXT:    addi a0, a0, %lo(g+2020)
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r 0(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_global_7:
@@ -758,6 +879,10 @@ define void @test_prefetch_global_7() nounwind {
 define void @test_prefetch_global_8() nounwind {
 ; NOZICBOP-LABEL: test_prefetch_global_8:
 ; NOZICBOP:       # %bb.0:
+; NOZICBOP-NEXT:    lui a0, %hi(g-4)
+; NOZICBOP-NEXT:    addi a0, a0, %lo(g-4)
+; NOZICBOP-NEXT:    ntl.all
+; NOZICBOP-NEXT:    prefetch.r -2048(a0)
 ; NOZICBOP-NEXT:    ret
 ;
 ; ZICBOP-LABEL: test_prefetch_global_8:
diff --git a/llvm/test/MC/RISCV/rvzicbom-invalid.s b/llvm/test/MC/RISCV/rvzicbom-invalid.s
index 6a64d46d16ef2..d4e19b9d74054 100644
--- a/llvm/test/MC/RISCV/rvzicbom-invalid.s
+++ b/llvm/test/MC/RISCV/rvzicbom-invalid.s
@@ -22,6 +22,3 @@ cbo.inval 3(t0) # CHECK: :[[@LINE]]:11: error: optional integer offset must be 0
 # Instructions from other zicbo* extensions aren't available without enabling
 # the appropriate -mattr flag.
 cbo.zero (t0) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zicboz' (Cache-Block Zero Instructions){{$}}
-prefetch.i 0(t3) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zicbop' (Cache-Block Prefetch Instructions){{$}}
-prefetch.r 0(t4) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zicbop' (Cache-Block Prefetch Instructions){{$}}
-prefetch.w 0(t5) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zicbop' (Cache-Block Prefetch Instructions){{$}}
diff --git a/llvm/test/MC/RISCV/rvzicbop-valid.s b/llvm/test/MC/RISCV/rvzicbop-valid.s
index 9a179f98667bf..de8d42f061781 100644
--- a/llvm/test/MC/RISCV/rvzicbop-valid.s
+++ b/llvm/test/MC/RISCV/rvzicbop-valid.s
@@ -9,6 +9,20 @@
 # RUN:     | llvm-objdump --no-print-imm-hex --mattr=+zicbop -d -r - \
 # RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
 
+# prefetch hints are always available even without Zicbop
+# (riscv-non-isa/riscv-elf-psabi-doc#474).
+
+# RUN: llvm-mc %s -triple=riscv32 -show-encoding \
+# RUN:     | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc %s -triple=riscv64 -show-encoding \
+# RUN:     | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple=riscv32 < %s \
+# RUN:     | llvm-objdump --no-print-imm-hex -d -r - \
+# RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple=riscv64 < %s \
+# RUN:     | llvm-objdump --no-print-imm-hex -d -r - \
+# RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
+
 # CHECK-ASM-AND-OBJ: prefetch.i -2048(t0)
 # CHECK-ASM: encoding: [0x13,0xe0,0x02,0x80]
 prefetch.i -2048(t0)
diff --git a/llvm/test/MC/RISCV/rvzicboz-invalid.s b/llvm/test/MC/RISCV/rvzicboz-invalid.s
index e093958536032..bcc4a31a7b374 100644
--- a/llvm/test/MC/RISCV/rvzicboz-invalid.s
+++ b/llvm/test/MC/RISCV/rvzicboz-invalid.s
@@ -14,6 +14,3 @@ cbo.zero 1(t0) # CHECK: :[[@LINE]]:10: error: optional integer offset must be 0
 cbo.clean (t0) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zicbom' (Cache-Block Management Instructions){{$}}
 cbo.flush (t1) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zicbom' (Cache-Block Management Instructions){{$}}
 cbo.inval (t2) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zicbom' (Cache-Block Management Instructions){{$}}
-prefetch.i 0(t3) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zicbop' (Cache-Block Prefetch Instructions){{$}}
-prefetch.r 0(t4) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zicbop' (Cache-Block Prefetch Instructions){{$}}
-prefetch.w 0(t5) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zicbop' (Cache-Block Prefetch Instructions){{$}}

>From 65c5a77b9b43377a35656d41b1b90f848d3407b8 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Wed, 8 Apr 2026 11:35:12 -0700
Subject: [PATCH 2/4] fixup! add common check-prefix

---
 llvm/test/CodeGen/RISCV/prefetch.ll | 910 +++++++++-------------------
 1 file changed, 292 insertions(+), 618 deletions(-)

diff --git a/llvm/test/CodeGen/RISCV/prefetch.ll b/llvm/test/CodeGen/RISCV/prefetch.ll
index 36ecfa878e5cd..7e5393c1d25b3 100644
--- a/llvm/test/CodeGen/RISCV/prefetch.ll
+++ b/llvm/test/CodeGen/RISCV/prefetch.ll
@@ -1,398 +1,253 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s | FileCheck -check-prefix=NOZICBOP %s
-; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s | FileCheck -check-prefix=NOZICBOP %s
-; RUN: llc -mtriple=riscv32 -mattr=+zicbop -verify-machineinstrs < %s | FileCheck -check-prefix=ZICBOP %s
-; RUN: llc -mtriple=riscv64 -mattr=+zicbop -verify-machineinstrs < %s | FileCheck -check-prefix=ZICBOP %s
-; RUN: llc -mtriple=riscv64 -mattr=+zicbop,+zihintntl -verify-machineinstrs < %s | FileCheck -check-prefix=ZICBOP %s
+; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK,NOZICBOP %s
+; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK,NOZICBOP %s
+; RUN: llc -mtriple=riscv32 -mattr=+zicbop -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK,ZICBOP %s
+; RUN: llc -mtriple=riscv64 -mattr=+zicbop -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK,ZICBOP %s
+; RUN: llc -mtriple=riscv64 -mattr=+zicbop,+zihintntl -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK,ZICBOP %s
 
 define void @test_prefetch_read_locality_0(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_read_locality_0:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_read_locality_0:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_read_locality_0:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    ret
   call void @llvm.prefetch(ptr %a, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_write_locality_0(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_write_locality_0:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.w 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_write_locality_0:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.w 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_write_locality_0:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.w 0(a0)
+; CHECK-NEXT:    ret
   call void @llvm.prefetch(ptr %a, i32 1, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_instruction_locality_0(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_instruction_locality_0:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.i 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_instruction_locality_0:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.i 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_instruction_locality_0:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.i 0(a0)
+; CHECK-NEXT:    ret
   call void @llvm.prefetch(ptr %a, i32 0, i32 0, i32 0)
   ret void
 }
 
 define void @test_prefetch_read_locality_1(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_read_locality_1:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    ntl.pall
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_read_locality_1:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    ntl.pall
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_read_locality_1:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ntl.pall
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    ret
   call void @llvm.prefetch(ptr %a, i32 0, i32 1, i32 1)
   ret void
 }
 
 define void @test_prefetch_write_locality_1(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_write_locality_1:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    ntl.pall
-; NOZICBOP-NEXT:    prefetch.w 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_write_locality_1:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    ntl.pall
-; ZICBOP-NEXT:    prefetch.w 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_write_locality_1:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ntl.pall
+; CHECK-NEXT:    prefetch.w 0(a0)
+; CHECK-NEXT:    ret
   call void @llvm.prefetch(ptr %a, i32 1, i32 1, i32 1)
   ret void
 }
 
 define void @test_prefetch_instruction_locality_1(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_instruction_locality_1:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    ntl.pall
-; NOZICBOP-NEXT:    prefetch.i 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_instruction_locality_1:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    ntl.pall
-; ZICBOP-NEXT:    prefetch.i 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_instruction_locality_1:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ntl.pall
+; CHECK-NEXT:    prefetch.i 0(a0)
+; CHECK-NEXT:    ret
   call void @llvm.prefetch(ptr %a, i32 0, i32 1, i32 0)
   ret void
 }
 
 define void @test_prefetch_read_locality_2(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_read_locality_2:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    ntl.p1
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_read_locality_2:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    ntl.p1
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_read_locality_2:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ntl.p1
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    ret
   call void @llvm.prefetch(ptr %a, i32 0, i32 2, i32 1)
   ret void
 }
 
 define void @test_prefetch_write_locality_2(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_write_locality_2:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    ntl.p1
-; NOZICBOP-NEXT:    prefetch.w 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_write_locality_2:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    ntl.p1
-; ZICBOP-NEXT:    prefetch.w 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_write_locality_2:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ntl.p1
+; CHECK-NEXT:    prefetch.w 0(a0)
+; CHECK-NEXT:    ret
   call void @llvm.prefetch(ptr %a, i32 1, i32 2, i32 1)
   ret void
 }
 
 define void @test_prefetch_instruction_locality_2(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_instruction_locality_2:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    ntl.p1
-; NOZICBOP-NEXT:    prefetch.i 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_instruction_locality_2:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    ntl.p1
-; ZICBOP-NEXT:    prefetch.i 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_instruction_locality_2:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ntl.p1
+; CHECK-NEXT:    prefetch.i 0(a0)
+; CHECK-NEXT:    ret
   call void @llvm.prefetch(ptr %a, i32 0, i32 2, i32 0)
   ret void
 }
 
 define void @test_prefetch_read_locality_3(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_read_locality_3:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_read_locality_3:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_read_locality_3:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    ret
   call void @llvm.prefetch(ptr %a, i32 0, i32 3, i32 1)
   ret void
 }
 
 define void @test_prefetch_write_locality_3(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_write_locality_3:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    prefetch.w 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_write_locality_3:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    prefetch.w 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_write_locality_3:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    prefetch.w 0(a0)
+; CHECK-NEXT:    ret
   call void @llvm.prefetch(ptr %a, i32 1, i32 3, i32 1)
   ret void
 }
 
 define void @test_prefetch_instruction_locality_3(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_instruction_locality_3:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    prefetch.i 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_instruction_locality_3:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    prefetch.i 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_instruction_locality_3:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    prefetch.i 0(a0)
+; CHECK-NEXT:    ret
   call void @llvm.prefetch(ptr %a, i32 0, i32 3, i32 0)
   ret void
 }
 
 define void @test_prefetch_offsetable_0(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_offsetable_0:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 2016(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_offsetable_0:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 2016(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_offsetable_0:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 2016(a0)
+; CHECK-NEXT:    ret
   %addr = getelementptr i8, ptr %a, i64 2016
   call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_offsetable_1(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_offsetable_1:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r -2048(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_offsetable_1:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r -2048(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_offsetable_1:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r -2048(a0)
+; CHECK-NEXT:    ret
   %addr = getelementptr i8, ptr %a, i64 -2048
   call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_offsetable_2(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_offsetable_2:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 32(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_offsetable_2:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 32(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_offsetable_2:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 32(a0)
+; CHECK-NEXT:    ret
   %addr = getelementptr i8, ptr %a, i64 32
   call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_offsetable_3(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_offsetable_3:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r -32(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_offsetable_3:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r -32(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_offsetable_3:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r -32(a0)
+; CHECK-NEXT:    ret
   %addr = getelementptr i8, ptr %a, i64 -32
   call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_offsetable_4(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_offsetable_4:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    addi a0, a0, 32
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 2016(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_offsetable_4:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    addi a0, a0, 32
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 2016(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_offsetable_4:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addi a0, a0, 32
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 2016(a0)
+; CHECK-NEXT:    ret
   %addr = getelementptr i8, ptr %a, i64 2048
   call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_offsetable_5(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_offsetable_5:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    addi a0, a0, -1
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r -2048(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_offsetable_5:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    addi a0, a0, -1
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r -2048(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_offsetable_5:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addi a0, a0, -1
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r -2048(a0)
+; CHECK-NEXT:    ret
   %addr = getelementptr i8, ptr %a, i64 -2049
   call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_offsetable_6(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_offsetable_6:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    addi a0, a0, 16
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_offsetable_6:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    addi a0, a0, 16
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_offsetable_6:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addi a0, a0, 16
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    ret
   %addr = getelementptr i8, ptr %a, i64 16
   call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_offsetable_7(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_offsetable_7:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    addi a0, a0, -16
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_offsetable_7:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    addi a0, a0, -16
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_offsetable_7:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addi a0, a0, -16
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    ret
   %addr = getelementptr i8, ptr %a, i64 -16
   call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_offsetable_9(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_offsetable_9:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a1, 1
-; NOZICBOP-NEXT:    add a0, a0, a1
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 64(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_offsetable_9:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a1, 1
-; ZICBOP-NEXT:    add a0, a0, a1
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 64(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_offsetable_9:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a1, 1
+; CHECK-NEXT:    add a0, a0, a1
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 64(a0)
+; CHECK-NEXT:    ret
   %addr = getelementptr i8, ptr %a, i64 4160
   call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_offsetable_8(ptr %a) nounwind {
-; NOZICBOP-LABEL: test_prefetch_offsetable_8:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a1, 1048575
-; NOZICBOP-NEXT:    add a0, a0, a1
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r -64(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_offsetable_8:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a1, 1048575
-; ZICBOP-NEXT:    add a0, a0, a1
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r -64(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_offsetable_8:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a1, 1048575
+; CHECK-NEXT:    add a0, a0, a1
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r -64(a0)
+; CHECK-NEXT:    ret
   %addr = getelementptr i8, ptr %a, i64 -4160
   call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_frameindex_0() nounwind {
-; NOZICBOP-LABEL: test_prefetch_frameindex_0:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    addi sp, sp, -512
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 0(sp)
-; NOZICBOP-NEXT:    addi sp, sp, 512
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_frameindex_0:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    addi sp, sp, -512
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 0(sp)
-; ZICBOP-NEXT:    addi sp, sp, 512
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_frameindex_0:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addi sp, sp, -512
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 0(sp)
+; CHECK-NEXT:    addi sp, sp, 512
+; CHECK-NEXT:    ret
   %data = alloca [128 x i32], align 4
   %base = bitcast ptr %data to ptr
   %ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 0
@@ -401,31 +256,18 @@ define void @test_prefetch_frameindex_0() nounwind {
 }
 
 define void @test_prefetch_frameindex_1() nounwind {
-; NOZICBOP-LABEL: test_prefetch_frameindex_1:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a0, 1
-; NOZICBOP-NEXT:    addi a0, a0, 16
-; NOZICBOP-NEXT:    sub sp, sp, a0
-; NOZICBOP-NEXT:    addi a0, sp, 16
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    lui a0, 1
-; NOZICBOP-NEXT:    addi a0, a0, 16
-; NOZICBOP-NEXT:    add sp, sp, a0
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_frameindex_1:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a0, 1
-; ZICBOP-NEXT:    addi a0, a0, 16
-; ZICBOP-NEXT:    sub sp, sp, a0
-; ZICBOP-NEXT:    addi a0, sp, 16
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    lui a0, 1
-; ZICBOP-NEXT:    addi a0, a0, 16
-; ZICBOP-NEXT:    add sp, sp, a0
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_frameindex_1:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a0, 1
+; CHECK-NEXT:    addi a0, a0, 16
+; CHECK-NEXT:    sub sp, sp, a0
+; CHECK-NEXT:    addi a0, sp, 16
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    lui a0, 1
+; CHECK-NEXT:    addi a0, a0, 16
+; CHECK-NEXT:    add sp, sp, a0
+; CHECK-NEXT:    ret
   %data = alloca [1024 x i32], align 4
   %ptr = bitcast ptr %data to ptr
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
@@ -433,23 +275,14 @@ define void @test_prefetch_frameindex_1() nounwind {
 }
 
 define void @test_prefetch_frameindex_2() nounwind {
-; NOZICBOP-LABEL: test_prefetch_frameindex_2:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    addi sp, sp, -512
-; NOZICBOP-NEXT:    addi a0, sp, 16
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    addi sp, sp, 512
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_frameindex_2:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    addi sp, sp, -512
-; ZICBOP-NEXT:    addi a0, sp, 16
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    addi sp, sp, 512
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_frameindex_2:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addi sp, sp, -512
+; CHECK-NEXT:    addi a0, sp, 16
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    addi sp, sp, 512
+; CHECK-NEXT:    ret
   %data = alloca [128 x i32], align 4
   %base = bitcast ptr %data to ptr
   %ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 4
@@ -458,23 +291,14 @@ define void @test_prefetch_frameindex_2() nounwind {
 }
 
 define void @test_prefetch_frameindex_3() nounwind {
-; NOZICBOP-LABEL: test_prefetch_frameindex_3:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    addi sp, sp, -512
-; NOZICBOP-NEXT:    addi a0, sp, -16
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    addi sp, sp, 512
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_frameindex_3:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    addi sp, sp, -512
-; ZICBOP-NEXT:    addi a0, sp, -16
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    addi sp, sp, 512
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_frameindex_3:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addi sp, sp, -512
+; CHECK-NEXT:    addi a0, sp, -16
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    addi sp, sp, 512
+; CHECK-NEXT:    ret
   %data = alloca [128 x i32], align 4
   %base = bitcast ptr %data to ptr
   %ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 -4
@@ -483,21 +307,13 @@ define void @test_prefetch_frameindex_3() nounwind {
 }
 
 define void @test_prefetch_frameindex_4() nounwind {
-; NOZICBOP-LABEL: test_prefetch_frameindex_4:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    addi sp, sp, -512
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 32(sp)
-; NOZICBOP-NEXT:    addi sp, sp, 512
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_frameindex_4:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    addi sp, sp, -512
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 32(sp)
-; ZICBOP-NEXT:    addi sp, sp, 512
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_frameindex_4:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addi sp, sp, -512
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 32(sp)
+; CHECK-NEXT:    addi sp, sp, 512
+; CHECK-NEXT:    ret
   %data = alloca [128 x i32], align 4
   %base = bitcast ptr %data to ptr
   %ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 8
@@ -506,21 +322,13 @@ define void @test_prefetch_frameindex_4() nounwind {
 }
 
 define void @test_prefetch_frameindex_5() nounwind {
-; NOZICBOP-LABEL: test_prefetch_frameindex_5:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    addi sp, sp, -512
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r -32(sp)
-; NOZICBOP-NEXT:    addi sp, sp, 512
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_frameindex_5:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    addi sp, sp, -512
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r -32(sp)
-; ZICBOP-NEXT:    addi sp, sp, 512
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_frameindex_5:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addi sp, sp, -512
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r -32(sp)
+; CHECK-NEXT:    addi sp, sp, 512
+; CHECK-NEXT:    ret
   %data = alloca [128 x i32], align 4
   %base = bitcast ptr %data to ptr
   %ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 -8
@@ -529,21 +337,13 @@ define void @test_prefetch_frameindex_5() nounwind {
 }
 
 define void @test_prefetch_frameindex_6() nounwind {
-; NOZICBOP-LABEL: test_prefetch_frameindex_6:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    addi sp, sp, -512
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 2016(sp)
-; NOZICBOP-NEXT:    addi sp, sp, 512
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_frameindex_6:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    addi sp, sp, -512
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 2016(sp)
-; ZICBOP-NEXT:    addi sp, sp, 512
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_frameindex_6:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addi sp, sp, -512
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 2016(sp)
+; CHECK-NEXT:    addi sp, sp, 512
+; CHECK-NEXT:    ret
   %data = alloca [128 x i32], align 4
   %base = bitcast ptr %data to ptr
   %ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 504
@@ -552,21 +352,13 @@ define void @test_prefetch_frameindex_6() nounwind {
 }
 
 define void @test_prefetch_frameindex_7() nounwind {
-; NOZICBOP-LABEL: test_prefetch_frameindex_7:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    addi sp, sp, -512
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r -2048(sp)
-; NOZICBOP-NEXT:    addi sp, sp, 512
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_frameindex_7:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    addi sp, sp, -512
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r -2048(sp)
-; ZICBOP-NEXT:    addi sp, sp, 512
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_frameindex_7:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addi sp, sp, -512
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r -2048(sp)
+; CHECK-NEXT:    addi sp, sp, 512
+; CHECK-NEXT:    ret
   %data = alloca [128 x i32], align 4
   %base = bitcast ptr %data to ptr
   %ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 -512
@@ -575,23 +367,14 @@ define void @test_prefetch_frameindex_7() nounwind {
 }
 
 define void @test_prefetch_frameindex_8() nounwind {
-; NOZICBOP-LABEL: test_prefetch_frameindex_8:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    addi sp, sp, -512
-; NOZICBOP-NEXT:    addi a0, sp, 2020
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    addi sp, sp, 512
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_frameindex_8:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    addi sp, sp, -512
-; ZICBOP-NEXT:    addi a0, sp, 2020
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    addi sp, sp, 512
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_frameindex_8:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addi sp, sp, -512
+; CHECK-NEXT:    addi a0, sp, 2020
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    addi sp, sp, 512
+; CHECK-NEXT:    ret
   %data = alloca [128 x i32], align 4
   %base = bitcast ptr %data to ptr
   %ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 505
@@ -600,25 +383,15 @@ define void @test_prefetch_frameindex_8() nounwind {
 }
 
 define void @test_prefetch_frameindex_9() nounwind {
-; NOZICBOP-LABEL: test_prefetch_frameindex_9:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    addi sp, sp, -512
-; NOZICBOP-NEXT:    mv a0, sp
-; NOZICBOP-NEXT:    addi a0, a0, -4
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r -2048(a0)
-; NOZICBOP-NEXT:    addi sp, sp, 512
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_frameindex_9:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    addi sp, sp, -512
-; ZICBOP-NEXT:    mv a0, sp
-; ZICBOP-NEXT:    addi a0, a0, -4
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r -2048(a0)
-; ZICBOP-NEXT:    addi sp, sp, 512
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_frameindex_9:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addi sp, sp, -512
+; CHECK-NEXT:    mv a0, sp
+; CHECK-NEXT:    addi a0, a0, -4
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r -2048(a0)
+; CHECK-NEXT:    addi sp, sp, 512
+; CHECK-NEXT:    ret
   %data = alloca [128 x i32], align 4
   %base = bitcast ptr %data to ptr
   %ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 -513
@@ -627,80 +400,50 @@ define void @test_prefetch_frameindex_9() nounwind {
 }
 
 define void @test_prefetch_constant_address_0() nounwind {
-; NOZICBOP-LABEL: test_prefetch_constant_address_0:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a0, 1
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 32(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_constant_address_0:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a0, 1
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 32(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_constant_address_0:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a0, 1
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 32(a0)
+; CHECK-NEXT:    ret
   %ptr = inttoptr i64 4128 to ptr
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_constant_address_1() nounwind {
-; NOZICBOP-LABEL: test_prefetch_constant_address_1:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a0, 1
-; NOZICBOP-NEXT:    addi a0, a0, 31
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_constant_address_1:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a0, 1
-; ZICBOP-NEXT:    addi a0, a0, 31
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_constant_address_1:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a0, 1
+; CHECK-NEXT:    addi a0, a0, 31
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    ret
   %ptr = inttoptr i64 4127 to ptr
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_constant_address_2() nounwind {
-; NOZICBOP-LABEL: test_prefetch_constant_address_2:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a0, 1048561
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 32(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_constant_address_2:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a0, 1048561
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 32(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_constant_address_2:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a0, 1048561
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 32(a0)
+; CHECK-NEXT:    ret
   %ptr = inttoptr i64 18446744073709490208 to ptr
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_constant_address_3() nounwind {
-; NOZICBOP-LABEL: test_prefetch_constant_address_3:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a0, 1048561
-; NOZICBOP-NEXT:    addi a0, a0, 31
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_constant_address_3:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a0, 1048561
-; ZICBOP-NEXT:    addi a0, a0, 31
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_constant_address_3:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a0, 1048561
+; CHECK-NEXT:    addi a0, a0, 31
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    ret
   %ptr = inttoptr i64 18446744073709490207 to ptr
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
   ret void
@@ -709,190 +452,121 @@ define void @test_prefetch_constant_address_3() nounwind {
 @g = external global [1024 x i32], align 4
 
 define void @test_prefetch_global_0() nounwind {
-; NOZICBOP-LABEL: test_prefetch_global_0:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a0, %hi(g)
-; NOZICBOP-NEXT:    addi a0, a0, %lo(g)
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_global_0:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a0, %hi(g)
-; ZICBOP-NEXT:    addi a0, a0, %lo(g)
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_global_0:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a0, %hi(g)
+; CHECK-NEXT:    addi a0, a0, %lo(g)
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    ret
   %ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 0
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_global_1() nounwind {
-; NOZICBOP-LABEL: test_prefetch_global_1:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a0, %hi(g+16)
-; NOZICBOP-NEXT:    addi a0, a0, %lo(g+16)
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_global_1:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a0, %hi(g+16)
-; ZICBOP-NEXT:    addi a0, a0, %lo(g+16)
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_global_1:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a0, %hi(g+16)
+; CHECK-NEXT:    addi a0, a0, %lo(g+16)
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    ret
   %ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 4
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_global_2() nounwind {
-; NOZICBOP-LABEL: test_prefetch_global_2:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a0, %hi(g-16)
-; NOZICBOP-NEXT:    addi a0, a0, %lo(g-16)
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_global_2:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a0, %hi(g-16)
-; ZICBOP-NEXT:    addi a0, a0, %lo(g-16)
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_global_2:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a0, %hi(g-16)
+; CHECK-NEXT:    addi a0, a0, %lo(g-16)
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    ret
   %ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 -4
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_global_3() nounwind {
-; NOZICBOP-LABEL: test_prefetch_global_3:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a0, %hi(g)
-; NOZICBOP-NEXT:    addi a0, a0, %lo(g)
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 32(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_global_3:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a0, %hi(g)
-; ZICBOP-NEXT:    addi a0, a0, %lo(g)
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 32(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_global_3:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a0, %hi(g)
+; CHECK-NEXT:    addi a0, a0, %lo(g)
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 32(a0)
+; CHECK-NEXT:    ret
   %ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 8
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_global_4() nounwind {
-; NOZICBOP-LABEL: test_prefetch_global_4:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a0, %hi(g)
-; NOZICBOP-NEXT:    addi a0, a0, %lo(g)
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r -32(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_global_4:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a0, %hi(g)
-; ZICBOP-NEXT:    addi a0, a0, %lo(g)
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r -32(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_global_4:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a0, %hi(g)
+; CHECK-NEXT:    addi a0, a0, %lo(g)
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r -32(a0)
+; CHECK-NEXT:    ret
   %ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 -8
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_global_5() nounwind {
-; NOZICBOP-LABEL: test_prefetch_global_5:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a0, %hi(g)
-; NOZICBOP-NEXT:    addi a0, a0, %lo(g)
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 2016(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_global_5:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a0, %hi(g)
-; ZICBOP-NEXT:    addi a0, a0, %lo(g)
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 2016(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_global_5:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a0, %hi(g)
+; CHECK-NEXT:    addi a0, a0, %lo(g)
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 2016(a0)
+; CHECK-NEXT:    ret
   %ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 504
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_global_6() nounwind {
-; NOZICBOP-LABEL: test_prefetch_global_6:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a0, %hi(g)
-; NOZICBOP-NEXT:    addi a0, a0, %lo(g)
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r -2048(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_global_6:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a0, %hi(g)
-; ZICBOP-NEXT:    addi a0, a0, %lo(g)
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r -2048(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_global_6:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a0, %hi(g)
+; CHECK-NEXT:    addi a0, a0, %lo(g)
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r -2048(a0)
+; CHECK-NEXT:    ret
   %ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 -512
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_global_7() nounwind {
-; NOZICBOP-LABEL: test_prefetch_global_7:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a0, %hi(g+2020)
-; NOZICBOP-NEXT:    addi a0, a0, %lo(g+2020)
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r 0(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_global_7:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a0, %hi(g+2020)
-; ZICBOP-NEXT:    addi a0, a0, %lo(g+2020)
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r 0(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_global_7:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a0, %hi(g+2020)
+; CHECK-NEXT:    addi a0, a0, %lo(g+2020)
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r 0(a0)
+; CHECK-NEXT:    ret
   %ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 505
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
   ret void
 }
 
 define void @test_prefetch_global_8() nounwind {
-; NOZICBOP-LABEL: test_prefetch_global_8:
-; NOZICBOP:       # %bb.0:
-; NOZICBOP-NEXT:    lui a0, %hi(g-4)
-; NOZICBOP-NEXT:    addi a0, a0, %lo(g-4)
-; NOZICBOP-NEXT:    ntl.all
-; NOZICBOP-NEXT:    prefetch.r -2048(a0)
-; NOZICBOP-NEXT:    ret
-;
-; ZICBOP-LABEL: test_prefetch_global_8:
-; ZICBOP:       # %bb.0:
-; ZICBOP-NEXT:    lui a0, %hi(g-4)
-; ZICBOP-NEXT:    addi a0, a0, %lo(g-4)
-; ZICBOP-NEXT:    ntl.all
-; ZICBOP-NEXT:    prefetch.r -2048(a0)
-; ZICBOP-NEXT:    ret
+; CHECK-LABEL: test_prefetch_global_8:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    lui a0, %hi(g-4)
+; CHECK-NEXT:    addi a0, a0, %lo(g-4)
+; CHECK-NEXT:    ntl.all
+; CHECK-NEXT:    prefetch.r -2048(a0)
+; CHECK-NEXT:    ret
   %ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 -513
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
   ret void
 }
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; NOZICBOP: {{.*}}
+; ZICBOP: {{.*}}

>From 6a46a99b8edaff1607679fb28cf93dc95cbae9b1 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Wed, 8 Apr 2026 11:39:27 -0700
Subject: [PATCH 3/4] Remove unused prefixes

---
 llvm/test/CodeGen/RISCV/prefetch.ll | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/llvm/test/CodeGen/RISCV/prefetch.ll b/llvm/test/CodeGen/RISCV/prefetch.ll
index 7e5393c1d25b3..eba1c535c254e 100644
--- a/llvm/test/CodeGen/RISCV/prefetch.ll
+++ b/llvm/test/CodeGen/RISCV/prefetch.ll
@@ -1,9 +1,9 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK,NOZICBOP %s
-; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK,NOZICBOP %s
-; RUN: llc -mtriple=riscv32 -mattr=+zicbop -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK,ZICBOP %s
-; RUN: llc -mtriple=riscv64 -mattr=+zicbop -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK,ZICBOP %s
-; RUN: llc -mtriple=riscv64 -mattr=+zicbop,+zihintntl -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK,ZICBOP %s
+; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK %s
+; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK %s
+; RUN: llc -mtriple=riscv32 -mattr=+zicbop -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK %s
+; RUN: llc -mtriple=riscv64 -mattr=+zicbop -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK %s
+; RUN: llc -mtriple=riscv64 -mattr=+zicbop,+zihintntl -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK %s
 
 define void @test_prefetch_read_locality_0(ptr %a) nounwind {
 ; CHECK-LABEL: test_prefetch_read_locality_0:
@@ -567,6 +567,3 @@ define void @test_prefetch_global_8() nounwind {
   call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
   ret void
 }
-;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
-; NOZICBOP: {{.*}}
-; ZICBOP: {{.*}}

>From d2a97823b384fa3cca111a5328c87bbc64ac0321 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Wed, 8 Apr 2026 12:38:50 -0700
Subject: [PATCH 4/4] fixup! Add ori disassembly tests.

---
 llvm/test/MC/RISCV/rvzicbop-valid.s | 38 ++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/llvm/test/MC/RISCV/rvzicbop-valid.s b/llvm/test/MC/RISCV/rvzicbop-valid.s
index de8d42f061781..3932ca933e082 100644
--- a/llvm/test/MC/RISCV/rvzicbop-valid.s
+++ b/llvm/test/MC/RISCV/rvzicbop-valid.s
@@ -4,10 +4,10 @@
 # RUN:     | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
 # RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+zicbop < %s \
 # RUN:     | llvm-objdump --no-print-imm-hex --mattr=+zicbop -d -r - \
-# RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
+# RUN:     | FileCheck --check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s
 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+zicbop < %s \
 # RUN:     | llvm-objdump --no-print-imm-hex --mattr=+zicbop -d -r - \
-# RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
+# RUN:     | FileCheck --check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s
 
 # prefetch hints are always available even without Zicbop
 # (riscv-non-isa/riscv-elf-psabi-doc#474).
@@ -18,10 +18,10 @@
 # RUN:     | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
 # RUN: llvm-mc -filetype=obj -triple=riscv32 < %s \
 # RUN:     | llvm-objdump --no-print-imm-hex -d -r - \
-# RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
+# RUN:     | FileCheck --check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s
 # RUN: llvm-mc -filetype=obj -triple=riscv64 < %s \
 # RUN:     | llvm-objdump --no-print-imm-hex -d -r - \
-# RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
+# RUN:     | FileCheck --check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s
 
 # CHECK-ASM-AND-OBJ: prefetch.i -2048(t0)
 # CHECK-ASM: encoding: [0x13,0xe0,0x02,0x80]
@@ -44,6 +44,36 @@ prefetch.w -2048(t2)
 # CHECK-ASM: encoding: [0x13,0xe0,0x33,0x7e]
 prefetch.w 2016(t2)
 
+# Ensure that ori disassembles as prefetch.*
+# FIXME: Should CHECK-ASM also print prefetch.*?
+
+# CHECK-ASM: ori zero, t0, -2048
+# CHECK-OBJ: prefetch.i -2048(t0)
+# CHECK-ASM: encoding: [0x13,0xe0,0x02,0x80]
+ori x0, t0, -2048
+# CHECK-ASM: ori zero, t0, 2016
+# CHECK-OBJ: prefetch.i 2016(t0)
+# CHECK-ASM: encoding: [0x13,0xe0,0x02,0x7e]
+ori x0, t0, 2016
+
+# CHECK-ASM: ori zero, t1, -2047
+# CHECK-OBJ: prefetch.r -2048(t1)
+# CHECK-ASM: encoding: [0x13,0x60,0x13,0x80]
+ori x0, t1, -2047
+# CHECK-ASM: ori zero, t1, 2017
+# CHECK-OBJ: prefetch.r 2016(t1)
+# CHECK-ASM: encoding: [0x13,0x60,0x13,0x7e]
+ori x0, t1, 2017
+
+# CHECK-ASM: ori zero, t2, -2045
+# CHECK-OBJ: prefetch.w -2048(t2)
+# CHECK-ASM: encoding: [0x13,0xe0,0x33,0x80]
+ori x0, t2, -2045
+# CHECK-ASM: ori zero, t2, 2019
+# CHECK-OBJ: prefetch.w 2016(t2)
+# CHECK-ASM: encoding: [0x13,0xe0,0x33,0x7e]
+ori x0, t2, 2019
+
 # Ensure that enabling zicbop doesn't cause issues decoding ori instructions.
 
 # CHECK-ASM-AND-OBJ: ori a0, a1, -2048



More information about the llvm-commits mailing list