Added patterns
authorceriel <none@none>
Mon, 16 Jan 1989 13:35:02 +0000 (13:35 +0000)
committerceriel <none@none>
Mon, 16 Jan 1989 13:35:02 +0000 (13:35 +0000)
mach/m68020/ncg/mach.h
mach/m68020/ncg/table
mach/m68k2/ncg/mach.h
mach/m68k2/ncg/table
mach/m68k4/ncg/mach.h
mach/m68k4/ncg/table
mach/moon3/ncg/mach.h
mach/moon3/ncg/table

index f100a66..70ece9c 100644 (file)
@@ -25,7 +25,7 @@ and then run "make" again
 #define cst_fmt                "%ld"
 #define        off_fmt         "%ld"
 #define ilb_fmt                "I%x_%x"
-#define dlb_fmt                "_%d"
+#define dlb_fmt                "I_%d"
 #define        hol_fmt         "hol%d"
 
 #ifdef TBL68020
index 7355786..bc1a8f4 100644 (file)
@@ -1038,7 +1038,7 @@ pat lol loc adu stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("add.l")
 pat lil adu sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
                                        call lilxxsil("add.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof adu lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("add.l")
 pat lil loc adu sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("add.l")
@@ -1071,7 +1071,7 @@ pat lol loc and stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("and.l")
 pat lil and sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
                                        call lilxxsil("and.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof and lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("and.l")
 pat lil loc and sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("and.l")
@@ -1086,7 +1086,7 @@ pat lol loc ior stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("or.l")
 pat lil ior sil $1==$3 && $2==4 && inreg($1)==reg_pointer
                                        call lilxxsil("or.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof ior lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("or.l")
 pat lil loc ior sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("or.l")
@@ -1102,7 +1102,7 @@ pat lol loc xor stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("eor.l")
 pat lil xor sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
                                        call lilxxsil("eor.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof xor lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("eor.l")
 pat lil loc xor sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("eor.l")
@@ -2246,10 +2246,18 @@ pat zrl
     kills all_indir, LOCAL %bd==$1
     gen clr_l {LOCAL, $1}
 
+pat zrl lol $1==$2 && inreg($1) < 0
+    kills all_indir, LOCAL %bd==$1
+    gen clr_l {LOCAL, $1}      yields {small_const, 0}
+
 pat zre
     kills posextern
     gen clr_l {absolute4, $1}
 
+pat zre loe $1==$2
+    kills posextern
+    gen clr_l {absolute4, $1}  yields {small_const, 0}
+
 pat zer $1==4          yields  {small_const, 0}
 pat zer $1==8          yields  {small_const, 0} {small_const, 0}
 pat zer $1==12         yields  {small_const, 0} {small_const, 0} {small_const, 0}
@@ -2312,6 +2320,8 @@ with datalt4+const+small_const DD_REG
     gen xxx* %1, %2    yields  %2
 with DD_REG datalt4+const+small_const
     gen xxx* %2, %1    yields  %1
+with DD_REG STACK
+    gen xxx* {post_inc4, sp}, %1       yields %1
 
 proc logdef example and
 with STACK
@@ -3506,6 +3516,26 @@ with imm_cmp2 STACK
     gen cmp_w {const, loww($4)}, %1
        bxx* {llabel, $5}
 
+proc bxx1_small example loc bne
+with imm_cmp1-D_REG STACK
+    gen cmp_b {const, $1}, %1
+       bxx[1] {llabel, $2}
+with imm_cmp2-D_REG STACK
+    gen        cmp_w {const, $1}, %1
+       bxx[1] {llabel, $2}
+with D_REG STACK
+uses DD_REG = {const, $1}
+    gen cmp_l %a, %1
+       bxx[2] {llabel, $2}
+
+proc bxx2_small example loc bne
+with imm_cmp2-D_REG STACK
+    gen cmp_w {const, $1}, %1
+       bxx[1] {llabel, $2}
+with D_REG STACK
+    gen cmp_l {const, $1}, %1
+       bxx[2] {llabel, $2}
+
 proc zxx1_in example loc loc cii zne
 with test_set1 STACK
     gen test %1
@@ -3550,6 +3580,20 @@ pat loc loc cii loc bne $1==2 && $2==4 && in_2($4)       call bxx2_in("bne")
 pat loc loc cii loc bge $1==2 && $2==4 && in_2($4)     call bxx2_in("bge")
 pat loc loc cii loc bgt $1==2 && $2==4 && in_2($4)     call bxx2_in("bgt")
 
+pat loc blt $1>=0 && $1<128            call bxx1_small("bcs", "blt")
+pat loc ble $1>=0 && $1<128            call bxx1_small("bls", "ble")
+pat loc beq $1>=0 && $1<128            call bxx1_small("beq", "beq")
+pat loc bne $1>=0 && $1<128            call bxx1_small("bne", "bne")
+pat loc bge $1>=0 && $1<128            call bxx1_small("bcc", "bge")
+pat loc bgt $1>=0 && $1<128            call bxx1_small("bhi", "bgt")
+
+pat loc blt $1>=128 && $1<32768                call bxx2_small("bcs", "blt")
+pat loc ble $1>=128 && $1<32768                call bxx2_small("bls", "ble")
+pat loc beq $1>=128 && $1<32768                call bxx2_small("beq", "beq")
+pat loc bne $1>=128 && $1<32768                call bxx2_small("bne", "bne")
+pat loc bge $1>=128 && $1<32768                call bxx2_small("bcc", "bge")
+pat loc bgt $1>=128 && $1<32768                call bxx2_small("bhi", "bgt")
+
 pat loc loc cii stl $1==1 && $2==4 && inreg($4)==reg_any
 with memory1+DD_REG
     kills regvar($4, reg_any), use_index %xreg==regvar($4, reg_any)
index f100a66..70ece9c 100644 (file)
@@ -25,7 +25,7 @@ and then run "make" again
 #define cst_fmt                "%ld"
 #define        off_fmt         "%ld"
 #define ilb_fmt                "I%x_%x"
-#define dlb_fmt                "_%d"
+#define dlb_fmt                "I_%d"
 #define        hol_fmt         "hol%d"
 
 #ifdef TBL68020
index 7355786..bc1a8f4 100644 (file)
@@ -1038,7 +1038,7 @@ pat lol loc adu stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("add.l")
 pat lil adu sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
                                        call lilxxsil("add.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof adu lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("add.l")
 pat lil loc adu sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("add.l")
@@ -1071,7 +1071,7 @@ pat lol loc and stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("and.l")
 pat lil and sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
                                        call lilxxsil("and.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof and lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("and.l")
 pat lil loc and sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("and.l")
@@ -1086,7 +1086,7 @@ pat lol loc ior stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("or.l")
 pat lil ior sil $1==$3 && $2==4 && inreg($1)==reg_pointer
                                        call lilxxsil("or.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof ior lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("or.l")
 pat lil loc ior sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("or.l")
@@ -1102,7 +1102,7 @@ pat lol loc xor stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("eor.l")
 pat lil xor sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
                                        call lilxxsil("eor.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof xor lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("eor.l")
 pat lil loc xor sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("eor.l")
@@ -2246,10 +2246,18 @@ pat zrl
     kills all_indir, LOCAL %bd==$1
     gen clr_l {LOCAL, $1}
 
+pat zrl lol $1==$2 && inreg($1) < 0
+    kills all_indir, LOCAL %bd==$1
+    gen clr_l {LOCAL, $1}      yields {small_const, 0}
+
 pat zre
     kills posextern
     gen clr_l {absolute4, $1}
 
+pat zre loe $1==$2
+    kills posextern
+    gen clr_l {absolute4, $1}  yields {small_const, 0}
+
 pat zer $1==4          yields  {small_const, 0}
 pat zer $1==8          yields  {small_const, 0} {small_const, 0}
 pat zer $1==12         yields  {small_const, 0} {small_const, 0} {small_const, 0}
@@ -2312,6 +2320,8 @@ with datalt4+const+small_const DD_REG
     gen xxx* %1, %2    yields  %2
 with DD_REG datalt4+const+small_const
     gen xxx* %2, %1    yields  %1
+with DD_REG STACK
+    gen xxx* {post_inc4, sp}, %1       yields %1
 
 proc logdef example and
 with STACK
@@ -3506,6 +3516,26 @@ with imm_cmp2 STACK
     gen cmp_w {const, loww($4)}, %1
        bxx* {llabel, $5}
 
+proc bxx1_small example loc bne
+with imm_cmp1-D_REG STACK
+    gen cmp_b {const, $1}, %1
+       bxx[1] {llabel, $2}
+with imm_cmp2-D_REG STACK
+    gen        cmp_w {const, $1}, %1
+       bxx[1] {llabel, $2}
+with D_REG STACK
+uses DD_REG = {const, $1}
+    gen cmp_l %a, %1
+       bxx[2] {llabel, $2}
+
+proc bxx2_small example loc bne
+with imm_cmp2-D_REG STACK
+    gen cmp_w {const, $1}, %1
+       bxx[1] {llabel, $2}
+with D_REG STACK
+    gen cmp_l {const, $1}, %1
+       bxx[2] {llabel, $2}
+
 proc zxx1_in example loc loc cii zne
 with test_set1 STACK
     gen test %1
@@ -3550,6 +3580,20 @@ pat loc loc cii loc bne $1==2 && $2==4 && in_2($4)       call bxx2_in("bne")
 pat loc loc cii loc bge $1==2 && $2==4 && in_2($4)     call bxx2_in("bge")
 pat loc loc cii loc bgt $1==2 && $2==4 && in_2($4)     call bxx2_in("bgt")
 
+pat loc blt $1>=0 && $1<128            call bxx1_small("bcs", "blt")
+pat loc ble $1>=0 && $1<128            call bxx1_small("bls", "ble")
+pat loc beq $1>=0 && $1<128            call bxx1_small("beq", "beq")
+pat loc bne $1>=0 && $1<128            call bxx1_small("bne", "bne")
+pat loc bge $1>=0 && $1<128            call bxx1_small("bcc", "bge")
+pat loc bgt $1>=0 && $1<128            call bxx1_small("bhi", "bgt")
+
+pat loc blt $1>=128 && $1<32768                call bxx2_small("bcs", "blt")
+pat loc ble $1>=128 && $1<32768                call bxx2_small("bls", "ble")
+pat loc beq $1>=128 && $1<32768                call bxx2_small("beq", "beq")
+pat loc bne $1>=128 && $1<32768                call bxx2_small("bne", "bne")
+pat loc bge $1>=128 && $1<32768                call bxx2_small("bcc", "bge")
+pat loc bgt $1>=128 && $1<32768                call bxx2_small("bhi", "bgt")
+
 pat loc loc cii stl $1==1 && $2==4 && inreg($4)==reg_any
 with memory1+DD_REG
     kills regvar($4, reg_any), use_index %xreg==regvar($4, reg_any)
index f100a66..70ece9c 100644 (file)
@@ -25,7 +25,7 @@ and then run "make" again
 #define cst_fmt                "%ld"
 #define        off_fmt         "%ld"
 #define ilb_fmt                "I%x_%x"
-#define dlb_fmt                "_%d"
+#define dlb_fmt                "I_%d"
 #define        hol_fmt         "hol%d"
 
 #ifdef TBL68020
index 7355786..bc1a8f4 100644 (file)
@@ -1038,7 +1038,7 @@ pat lol loc adu stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("add.l")
 pat lil adu sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
                                        call lilxxsil("add.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof adu lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("add.l")
 pat lil loc adu sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("add.l")
@@ -1071,7 +1071,7 @@ pat lol loc and stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("and.l")
 pat lil and sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
                                        call lilxxsil("and.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof and lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("and.l")
 pat lil loc and sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("and.l")
@@ -1086,7 +1086,7 @@ pat lol loc ior stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("or.l")
 pat lil ior sil $1==$3 && $2==4 && inreg($1)==reg_pointer
                                        call lilxxsil("or.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof ior lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("or.l")
 pat lil loc ior sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("or.l")
@@ -1102,7 +1102,7 @@ pat lol loc xor stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("eor.l")
 pat lil xor sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
                                        call lilxxsil("eor.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof xor lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("eor.l")
 pat lil loc xor sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("eor.l")
@@ -2246,10 +2246,18 @@ pat zrl
     kills all_indir, LOCAL %bd==$1
     gen clr_l {LOCAL, $1}
 
+pat zrl lol $1==$2 && inreg($1) < 0
+    kills all_indir, LOCAL %bd==$1
+    gen clr_l {LOCAL, $1}      yields {small_const, 0}
+
 pat zre
     kills posextern
     gen clr_l {absolute4, $1}
 
+pat zre loe $1==$2
+    kills posextern
+    gen clr_l {absolute4, $1}  yields {small_const, 0}
+
 pat zer $1==4          yields  {small_const, 0}
 pat zer $1==8          yields  {small_const, 0} {small_const, 0}
 pat zer $1==12         yields  {small_const, 0} {small_const, 0} {small_const, 0}
@@ -2312,6 +2320,8 @@ with datalt4+const+small_const DD_REG
     gen xxx* %1, %2    yields  %2
 with DD_REG datalt4+const+small_const
     gen xxx* %2, %1    yields  %1
+with DD_REG STACK
+    gen xxx* {post_inc4, sp}, %1       yields %1
 
 proc logdef example and
 with STACK
@@ -3506,6 +3516,26 @@ with imm_cmp2 STACK
     gen cmp_w {const, loww($4)}, %1
        bxx* {llabel, $5}
 
+proc bxx1_small example loc bne
+with imm_cmp1-D_REG STACK
+    gen cmp_b {const, $1}, %1
+       bxx[1] {llabel, $2}
+with imm_cmp2-D_REG STACK
+    gen        cmp_w {const, $1}, %1
+       bxx[1] {llabel, $2}
+with D_REG STACK
+uses DD_REG = {const, $1}
+    gen cmp_l %a, %1
+       bxx[2] {llabel, $2}
+
+proc bxx2_small example loc bne
+with imm_cmp2-D_REG STACK
+    gen cmp_w {const, $1}, %1
+       bxx[1] {llabel, $2}
+with D_REG STACK
+    gen cmp_l {const, $1}, %1
+       bxx[2] {llabel, $2}
+
 proc zxx1_in example loc loc cii zne
 with test_set1 STACK
     gen test %1
@@ -3550,6 +3580,20 @@ pat loc loc cii loc bne $1==2 && $2==4 && in_2($4)       call bxx2_in("bne")
 pat loc loc cii loc bge $1==2 && $2==4 && in_2($4)     call bxx2_in("bge")
 pat loc loc cii loc bgt $1==2 && $2==4 && in_2($4)     call bxx2_in("bgt")
 
+pat loc blt $1>=0 && $1<128            call bxx1_small("bcs", "blt")
+pat loc ble $1>=0 && $1<128            call bxx1_small("bls", "ble")
+pat loc beq $1>=0 && $1<128            call bxx1_small("beq", "beq")
+pat loc bne $1>=0 && $1<128            call bxx1_small("bne", "bne")
+pat loc bge $1>=0 && $1<128            call bxx1_small("bcc", "bge")
+pat loc bgt $1>=0 && $1<128            call bxx1_small("bhi", "bgt")
+
+pat loc blt $1>=128 && $1<32768                call bxx2_small("bcs", "blt")
+pat loc ble $1>=128 && $1<32768                call bxx2_small("bls", "ble")
+pat loc beq $1>=128 && $1<32768                call bxx2_small("beq", "beq")
+pat loc bne $1>=128 && $1<32768                call bxx2_small("bne", "bne")
+pat loc bge $1>=128 && $1<32768                call bxx2_small("bcc", "bge")
+pat loc bgt $1>=128 && $1<32768                call bxx2_small("bhi", "bgt")
+
 pat loc loc cii stl $1==1 && $2==4 && inreg($4)==reg_any
 with memory1+DD_REG
     kills regvar($4, reg_any), use_index %xreg==regvar($4, reg_any)
index f100a66..70ece9c 100644 (file)
@@ -25,7 +25,7 @@ and then run "make" again
 #define cst_fmt                "%ld"
 #define        off_fmt         "%ld"
 #define ilb_fmt                "I%x_%x"
-#define dlb_fmt                "_%d"
+#define dlb_fmt                "I_%d"
 #define        hol_fmt         "hol%d"
 
 #ifdef TBL68020
index 7355786..bc1a8f4 100644 (file)
@@ -1038,7 +1038,7 @@ pat lol loc adu stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("add.l")
 pat lil adu sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
                                        call lilxxsil("add.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof adu lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("add.l")
 pat lil loc adu sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("add.l")
@@ -1071,7 +1071,7 @@ pat lol loc and stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("and.l")
 pat lil and sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
                                        call lilxxsil("and.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof and lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("and.l")
 pat lil loc and sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("and.l")
@@ -1086,7 +1086,7 @@ pat lol loc ior stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("or.l")
 pat lil ior sil $1==$3 && $2==4 && inreg($1)==reg_pointer
                                        call lilxxsil("or.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof ior lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("or.l")
 pat lil loc ior sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("or.l")
@@ -1102,7 +1102,7 @@ pat lol loc xor stl $1==$4 && $3==4 && inreg($1)==reg_any
                                        call lolcxxstl("eor.l")
 pat lil xor sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
                                        call lilxxsil("eor.l")
-pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+pat lol lof xor lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
                                        call lolfxxlolf("eor.l")
 pat lil loc xor sil $1==$4 && $3==4 && inreg($1)==reg_pointer
                                        call lilcxxsil("eor.l")
@@ -2246,10 +2246,18 @@ pat zrl
     kills all_indir, LOCAL %bd==$1
     gen clr_l {LOCAL, $1}
 
+pat zrl lol $1==$2 && inreg($1) < 0
+    kills all_indir, LOCAL %bd==$1
+    gen clr_l {LOCAL, $1}      yields {small_const, 0}
+
 pat zre
     kills posextern
     gen clr_l {absolute4, $1}
 
+pat zre loe $1==$2
+    kills posextern
+    gen clr_l {absolute4, $1}  yields {small_const, 0}
+
 pat zer $1==4          yields  {small_const, 0}
 pat zer $1==8          yields  {small_const, 0} {small_const, 0}
 pat zer $1==12         yields  {small_const, 0} {small_const, 0} {small_const, 0}
@@ -2312,6 +2320,8 @@ with datalt4+const+small_const DD_REG
     gen xxx* %1, %2    yields  %2
 with DD_REG datalt4+const+small_const
     gen xxx* %2, %1    yields  %1
+with DD_REG STACK
+    gen xxx* {post_inc4, sp}, %1       yields %1
 
 proc logdef example and
 with STACK
@@ -3506,6 +3516,26 @@ with imm_cmp2 STACK
     gen cmp_w {const, loww($4)}, %1
        bxx* {llabel, $5}
 
+proc bxx1_small example loc bne
+with imm_cmp1-D_REG STACK
+    gen cmp_b {const, $1}, %1
+       bxx[1] {llabel, $2}
+with imm_cmp2-D_REG STACK
+    gen        cmp_w {const, $1}, %1
+       bxx[1] {llabel, $2}
+with D_REG STACK
+uses DD_REG = {const, $1}
+    gen cmp_l %a, %1
+       bxx[2] {llabel, $2}
+
+proc bxx2_small example loc bne
+with imm_cmp2-D_REG STACK
+    gen cmp_w {const, $1}, %1
+       bxx[1] {llabel, $2}
+with D_REG STACK
+    gen cmp_l {const, $1}, %1
+       bxx[2] {llabel, $2}
+
 proc zxx1_in example loc loc cii zne
 with test_set1 STACK
     gen test %1
@@ -3550,6 +3580,20 @@ pat loc loc cii loc bne $1==2 && $2==4 && in_2($4)       call bxx2_in("bne")
 pat loc loc cii loc bge $1==2 && $2==4 && in_2($4)     call bxx2_in("bge")
 pat loc loc cii loc bgt $1==2 && $2==4 && in_2($4)     call bxx2_in("bgt")
 
+pat loc blt $1>=0 && $1<128            call bxx1_small("bcs", "blt")
+pat loc ble $1>=0 && $1<128            call bxx1_small("bls", "ble")
+pat loc beq $1>=0 && $1<128            call bxx1_small("beq", "beq")
+pat loc bne $1>=0 && $1<128            call bxx1_small("bne", "bne")
+pat loc bge $1>=0 && $1<128            call bxx1_small("bcc", "bge")
+pat loc bgt $1>=0 && $1<128            call bxx1_small("bhi", "bgt")
+
+pat loc blt $1>=128 && $1<32768                call bxx2_small("bcs", "blt")
+pat loc ble $1>=128 && $1<32768                call bxx2_small("bls", "ble")
+pat loc beq $1>=128 && $1<32768                call bxx2_small("beq", "beq")
+pat loc bne $1>=128 && $1<32768                call bxx2_small("bne", "bne")
+pat loc bge $1>=128 && $1<32768                call bxx2_small("bcc", "bge")
+pat loc bgt $1>=128 && $1<32768                call bxx2_small("bhi", "bgt")
+
 pat loc loc cii stl $1==1 && $2==4 && inreg($4)==reg_any
 with memory1+DD_REG
     kills regvar($4, reg_any), use_index %xreg==regvar($4, reg_any)