[PATCH] D136157: [X86][2/2] Support PREFETCHI instructions
Phoebe Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 19 19:04:16 PDT 2022
pengfei updated this revision to Diff 469101.
pengfei added a comment.
Rebase and address comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136157/new/
https://reviews.llvm.org/D136157
Files:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86InstrInfo.td
llvm/test/CodeGen/X86/prefetchi.ll
Index: llvm/test/CodeGen/X86/prefetchi.ll
===================================================================
--- llvm/test/CodeGen/X86/prefetchi.ll
+++ llvm/test/CodeGen/X86/prefetchi.ll
@@ -4,8 +4,8 @@
define dso_local void @t(ptr %ptr) nounwind {
; CHECK-LABEL: t:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: prefetchit1 (%rdi)
-; CHECK-NEXT: prefetchit0 (%rdi)
+; CHECK-NEXT: prefetcht1 (%rdi)
+; CHECK-NEXT: prefetcht0 (%rdi)
; CHECK-NEXT: prefetchit1 t(%rip)
; CHECK-NEXT: prefetchit0 ext(%rip)
; CHECK-NEXT: retq
Index: llvm/lib/Target/X86/X86InstrInfo.td
===================================================================
--- llvm/lib/Target/X86/X86InstrInfo.td
+++ llvm/lib/Target/X86/X86InstrInfo.td
@@ -3002,7 +3002,8 @@
//===----------------------------------------------------------------------===//
// PREFETCHIT0 and PREFETCHIT1 Instructions
// prefetch ADDR, RW, Locality, Data
-let Predicates = [HasPREFETCHI, In64BitMode], SchedRW = [WriteLoad] in {
+let Predicates = [HasPREFETCHI, In64BitMode], SchedRW = [WriteLoad],
+ usesCustomInserter = 1 in {
def PREFETCHIT0 : I<0x18, MRM7m, (outs), (ins i8mem:$src),
"prefetchit0\t$src", [(prefetch addr:$src, (i32 0), (i32 3), (i32 0))]>, TB;
def PREFETCHIT1 : I<0x18, MRM6m, (outs), (ins i8mem:$src),
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -36981,6 +36981,13 @@
MI.eraseFromParent(); // The pseudo is gone now.
return BB;
}
+ case X86::PREFETCHIT0:
+ case X86::PREFETCHIT1:
+ if (MI.getOperand(0).getReg() != X86::RIP)
+ MI.setDesc(TII->get(MI.getOpcode() == X86::PREFETCHIT0
+ ? X86::PREFETCHT0
+ : X86::PREFETCHT1));
+ return BB;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136157.469101.patch
Type: text/x-patch
Size: 1905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221020/547ffec9/attachment.bin>
More information about the llvm-commits
mailing list