From: spth Date: Sun, 3 Aug 2008 11:48:46 +0000 (+0000) Subject: Added two peepholes that simplify conditional jumps X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=0a04254e69623ab8772a291cac7e3a09fb7d7f7a;p=fw%2Fsdcc Added two peepholes that simplify conditional jumps git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5203 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/z80/peeph-z80.def b/src/z80/peeph-z80.def index 5af099d0..b34a6b0d 100644 --- a/src/z80/peeph-z80.def +++ b/src/z80/peeph-z80.def @@ -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