a866d187b1063c0e27d2afac7f4f08e0ff271dab
[fw/sdcc] / src / z80 / peeph.def
1 replace restart {
2         ld (hl),(hl)
3 } by {
4         ERROR - peephole - caught (hl),(hl)
5 }
6 replace restart {
7         ld %1,%1
8 } by {
9         ; Removed redundent load
10 }
11 replace restart {
12         xor a,a
13         or a,%1
14         or a,a
15         jp %2,%3
16 } by {
17         ; Removed redundent or a,a
18         xor     a,a
19         or      a,%1
20         jp      %2,%3
21 }
22 replace restart {
23         cp a,#0x00
24         jp nz,%1
25 } by {
26         ; Rule 3
27         or      a,a
28         jp      nz,%1
29 }
30 replace restart {
31         jp nz,%1
32         jp      %2
33 %1:
34         jp      %3
35 %2:
36 } by {
37         ; Rule 4
38         jp      z,%2
39 %1:
40         jp      %3
41 %2:
42 }
43 replace restart {
44         jp      nz,%1
45         jp      %2
46 %1:
47 } by {
48         ; Rule 5
49         jp      z,%2
50 %1:
51 }
52 replace restart {
53         jp      z,%1
54         jp      %2
55 %1:
56 } by {
57         ; Rule 6
58         jp      nz,%2
59 %1:
60 }
61 replace restart {
62         ld      a,%1
63         or      a,%2
64         or      a,a
65 } by {
66         ; Rule 8
67         ld      a,%1
68         or      a,%2
69 }