[PATCH] D24660: [Sparc][LEON] Erratum fix to replace broken SDIV instruction with SDIVcc.

Daniel Cederman via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 08:36:28 PDT 2016


dcederman added inline comments.

================
Comment at: lib/Target/Sparc/LeonPasses.cpp:300-305
@@ +299,8 @@
+      unsigned Opcode = MI.getOpcode();
+      if (Opcode == SP::SDIVrr) {
+        MI.setDesc(TII.get(SP::SDIVCCrr));
+        Modified = true;
+      } else if (Opcode == SP::SDIVri) {
+        MI.setDesc(TII.get(SP::SDIVCCri));
+        Modified = true;
+      }
----------------
SDIVcc modifies the integer condition codes, so if any later instruction depends on the current value of those you might get the wrong result. You probably need to do the switch at an earlier stage to prevent this from happening.


Repository:
  rL LLVM

https://reviews.llvm.org/D24660





More information about the llvm-commits mailing list