[PATCH] D21960: [Sparc] Leon errata fixes passes.
Chris Dewhurst via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 11 13:06:31 PDT 2016
lero_chris added a comment.
Addressing review comments.
================
Comment at: lib/Target/Sparc/LeonFeatures.td:66-69
@@ -65,6 +65,6 @@
def PreventRoundChange
: SubtargetFeature<"prvntroundchange", "PreventRoundChange", "true",
"LEON3 erratum fix: Prevent any rounding mode change "
"request: use only the round-to-nearest rounding mode">;
def FixAllFDIVSQRT
----------------
Warning now issued when this pass makes any changes.
================
Comment at: lib/Target/Sparc/LeonFeatures.td:82-86
@@ -87,5 +81,7 @@
def InsertNOPsLoadStore
: SubtargetFeature<"insertnopsloadstore", "InsertNOPsLoadStore", "true",
"LEON3 erratum fix: Insert NOPs between "
"single-precision loads and the store, so the number of "
"instructions between is 4">;
+
+def FillDataCache : SubtargetFeature<"filldatacache", "FillDataCache", "true",
----------------
Removed this pass if it does nothing.
================
Comment at: lib/Target/Sparc/LeonPasses.cpp:231-232
@@ -261,26 +230,4 @@
Reg2Index = MI.getOperand(1).getReg();
Reg3Index = MI.getOperand(2).getReg();
- } else if (MI.isInlineAsm()) {
- StringRef AsmString =
- MI.getOperand(InlineAsm::MIOp_AsmString).getSymbolName();
- if (AsmString.startswith_lower("fmuls")) {
- // this is an inline FMULS instruction
- unsigned StartOp = InlineAsm::MIOp_FirstOperand;
-
- // extracts the registers from the inline assembly instruction
- for (unsigned i = StartOp, e = MI.getNumOperands(); i != e; ++i) {
- const MachineOperand &MO = MI.getOperand(i);
- if (MO.isReg()) {
- if (Reg1Index == UNASSIGNED_INDEX)
- Reg1Index = MO.getReg();
- else if (Reg2Index == UNASSIGNED_INDEX)
- Reg2Index = MO.getReg();
- else if (Reg3Index == UNASSIGNED_INDEX)
- Reg3Index = MO.getReg();
- }
- if (Reg3Index != UNASSIGNED_INDEX)
- break;
- }
- }
}
----------------
All inline assembly code removed.
================
Comment at: lib/Target/Sparc/LeonPasses.cpp:757-762
@@ +756,8 @@
+//
+// mov 0, %l0
+// mov 4096, %l1
+// loop1:
+// inc %l0
+// cmp %l0, %l1
+// ble loop1
+
----------------
A cache stores recently-accessed data. To fill the cache, we need to access data big enough to fill the L1 cache of the LEON 2 FT CPU. To solve this problem, we use NOP instructions to fill a block of memory with NOP instructions. The LEON 2’s L1 data cache is 16 KB [6] and the size of the NOP instruction is 4 Bytes. Therefore, we need 4096 NOPs to entirely fill the cache. Note this will happen only once at the first call of the runOnMachineFunction() method.
================
Comment at: lib/Target/Sparc/LeonPasses.cpp:851-859
@@ +850,11 @@
+//****************************************************************************************************************
+// This erratum fix should handle user traps of FPU exceptions and restore the
+// execution address by skipping the trapped FPU instruction.
+// The algorithm:
+// find rett - return from trap
+// insert code before rett to:
+// 1. load the FSR register
+// 2. check if there is an FPU exception
+// 3. branch to old rett if there is no exception
+// 4. rett to a restored exec address
+char RestoreExecAddress::ID = 0;
----------------
Do you suggest that this pass should not be part of the compiler then? I can remove it if it fixes nothing.
================
Comment at: lib/Target/Sparc/LeonPasses.h:108-110
@@ +107,5 @@
+
+ const char *getPassName() const override {
+ return "FillDataCache: Leon erratum fix: fill data cache with values at application startup";
+ }
+};
----------------
Removed these internal project reference codes.
================
Comment at: lib/Target/Sparc/LeonPasses.h:188
@@ -161,3 +187,3 @@
const char *getPassName() const override {
- return "InsertNOPLoad: insert a NOP instruction after "
+ return "InsertNOPLoad: Leon erratum fix: Insert a NOP instruction after "
"every single-cycle load instruction when the next instruction is "
----------------
Removed these internal project reference codes.
================
Comment at: lib/Target/Sparc/Sparc.td:145
@@ -143,3 +144,3 @@
[ FeatureLeon, LeonCASA ]> {}
//===----------------------------------------------------------------------===//
----------------
Removed from feature set.
Repository:
rL LLVM
https://reviews.llvm.org/D21960
More information about the llvm-commits
mailing list