[llvm] ec428f7 - [SPARC] Recognize the prefetch instruction
Daniel Cederman via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 20 01:59:46 PDT 2021
Author: Joerg Sonnenberger
Date: 2021-10-20T10:59:01+02:00
New Revision: ec428f7b780615769b7ca712ff67d05c2c957946
URL: https://github.com/llvm/llvm-project/commit/ec428f7b780615769b7ca712ff67d05c2c957946
DIFF: https://github.com/llvm/llvm-project/commit/ec428f7b780615769b7ca712ff67d05c2c957946.diff
LOG: [SPARC] Recognize the prefetch instruction
Reviewed By: LemonBoy
Differential Revision: https://reviews.llvm.org/D96311
Added:
Modified:
llvm/lib/Target/Sparc/SparcInstrInfo.td
llvm/test/MC/Sparc/sparcv9-instructions.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/Sparc/SparcInstrInfo.td b/llvm/lib/Target/Sparc/SparcInstrInfo.td
index b161e2a9d087..4b8c3a614787 100644
--- a/llvm/lib/Target/Sparc/SparcInstrInfo.td
+++ b/llvm/lib/Target/Sparc/SparcInstrInfo.td
@@ -1623,6 +1623,17 @@ let hasSideEffects = 1 in {
}
}
+// Section A.42 - Prefetch Data
+let Predicates = [HasV9] in {
+ def PREFETCHr : F3_1<3, 0b101101,
+ (outs), (ins MEMrr:$addr, shift_imm5:$rd),
+ "prefetch [$addr], $rd", []>;
+ def PREFETCHi : F3_2<3, 0b101101,
+ (outs), (ins MEMri:$addr, shift_imm5:$rd),
+ "prefetch [$addr], $rd", []>;
+}
+
+
// Section A.43 - Read Privileged Register Instructions
let Predicates = [HasV9] in {
diff --git a/llvm/test/MC/Sparc/sparcv9-instructions.s b/llvm/test/MC/Sparc/sparcv9-instructions.s
index 6a88375b8213..7b130de93b8d 100644
--- a/llvm/test/MC/Sparc/sparcv9-instructions.s
+++ b/llvm/test/MC/Sparc/sparcv9-instructions.s
@@ -301,3 +301,13 @@
! V9: st %o1, [%o0] ! encoding: [0xd2,0x22,0x00,0x00]
stw %o1, [%o0]
+
+ ! V8: error: instruction requires a CPU feature not currently enabled
+ ! V8-NEXT: prefetch [ %i1 + 0xf80 ], 1
+ ! V9: prefetch [%i1+3968], 1 ! encoding: [0xc3,0x6e,0x6f,0x80]
+ prefetch [ %i1 + 0xf80 ], 1
+
+ ! V8: error: instruction requires a CPU feature not currently enabled
+ ! V8-NEXT: prefetch [ %i1 + %i2 ], 1
+ ! V9: prefetch [%i1+%i2], 1 ! encoding: [0xc3,0x6e,0x40,0x1a]
+ prefetch [ %i1 + %i2 ], 1
More information about the llvm-commits
mailing list