Added two peepholes that simplify conditional jumps
authorspth <spth@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 3 Aug 2008 11:48:46 +0000 (11:48 +0000)
committerspth <spth@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 3 Aug 2008 11:48:46 +0000 (11:48 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5203 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/z80/peeph-z80.def

index 5af099d0968f72591e7c44f4d1e9202515215e4b..b34a6b0dd1457912282bf438875f225836f20465 100644 (file)
@@ -1267,7 +1267,27 @@ replace {
        ; peephole z13 removed unused ret.
 }
 
-// These two need two be here since the peephole optimizer continues to apply rules further down the file even for replace restart rules.
+// These four need two be here since the peephole optimizer continues to apply rules further down the file even for replace restart rules.
+replace restart {
+       jp      NC,%1
+       jp      %2
+%1:
+} by {
+       jp      C,%2
+       ; peephole 5' removed jp by using inverse jump logic
+%1:
+} if labelRefCountChange(%1 -1)
+
+replace restart {
+       jp      C,%1
+       jp      %2
+%1:
+} by {
+       jp      NC,%2
+       ; peephole 5' removed jp by using inverse jump logic
+%1:
+} if labelRefCountChange(%1 -1)
+
 replace restart {
        jp      NZ,%1
        jp      %2