ack/util/opt/patterns

773 lines
28 KiB
Plaintext

"$Header$"
inc dec:
inc loc adi $3==w: loc $2+1 adi w
inc loc sbi $3==w: loc $2-1 sbi w
dec loc adi $3==w: loc $2-1 adi w
dec loc sbi $3==w: loc $2+1 sbi w
loc adi loc sbi $2==w && $4==w: loc $1-$3 adi w
ldc adi ldc sbi $2==2*w && $4==2*w: ldc $1-$3 adi 2*w
loc adi loc adi $2==w && $4==w: loc $1+$3 adi w
ldc adi ldc adi $2==2*w && $4==2*w: ldc $1+$3 adi 2*w
loc adu loc sbu $2==w && $4==w: loc $1-$3 adu w
ldc adu ldc sbu $2==2*w && $4==2*w: ldc $1-$3 adu 2*w
loc adu loc adu $2==w && $4==w: loc $1+$3 adu w
ldc adu ldc adu $2==2*w && $4==2*w: ldc $1+$3 adu 2*w
loc mli loc mli $2==w && $4==w && sfit($1*$3,8*w): loc $1*$3 mli w
loc mlu loc mlu $2==w && $4==w && ufit($1*$3,8*w): loc $1*$3 mlu w
ldc mli ldc mli $2==2*w && $4==2*w && sfit($1*$3,16*w): ldc $1*$3 mli 2*w
ldc mlu ldc mlu $2==2*w && $4==2*w && ufit($1*$3,16*w): ldc $1*$3 mlu 2*w
/*
loc adi loc mli $2==w && $4==w: loc $3 mli w loc $1*$3 adi w
loc adi loc sli $2==w && $4==w && $3==1: loc $3 sli w loc 2*$1 adi w
*/
adp $1==0:
adp adp : adp $1+$2
adp lof : lof $1+$2
adp ldf : ldf $1+$2
adp loi $1!=0 && $2==w: lof $1
adp loi $1!=0 && $2==2*w: ldf $1
adp stf : stf $1+$2
adp sdf : sdf $1+$2
adp sti $1!=0 && $2==w: stf $1
adp sti $1!=0 && $2==2*w: sdf $1
asp $1==0:
asp asp : asp $1+$2
dup asp $1<=$2: asp $2-$1
blm $1==0 : asp 2*p
cmi zeq $1==w: beq $2
cmi zge $1==w: bge $2
cmi zgt $1==w: bgt $2
cmi zle $1==w: ble $2
cmi zlt $1==w: blt $2
cmi zne $1==w: bne $2
cmu zeq $1==w: beq $2
cmu zne $1==w: bne $2
dvi ngi $1==$2: ngi $1 dvi $1
lae adp : lae $1+$2
lae blm $2==w: loi w ste $1
lae blm $2==2*w: loi 2*w sde $1
lae ldf : lde $1+$2
lae lof : loe $1+$2
lae loi $2==w: loe $1
lae loi $2==2*w: lde $1
#ifdef INT
lae loi loe $3==$1-w && $2%w==0: lae $3 loi $2+w
lae loi lde $3==$1-2*w && $2%w==0: lae $3 loi $2+2*w
lae loi lae loi $1==$3+$4 && $2%w==0 && $4%w==0: lae $3 loi $2+$4
lae sti ste $3==$1+$2: lae $1 sti $2+w
lae sti sde $3==$1+$2: lae $1 sti $2+2*w
lae sti loc ste $4==$1-w: loc $3 lae $4 sti $2+w
lae sti lol ste $4==$1-w: lol $3 lae $4 sti $2+w
#endif
lae lae blm loe ste $4==$1+$3 && $5==$2+$3: lae $1 lae $2 blm $3+w
lae lae blm lde sde $4==$1+$3 && $5==$2+$3: lae $1 lae $2 blm $3+2*w
lae lae blm lae lae blm $4==$1+$3 && $5==$2+$3: lae $1 lae $2 blm $3+$6
lae lal blm lae lal blm $4==$1+$3 && $5==$2+$3 && samesign($2,$5):
lae $1 lal $2 blm $3+$6
lal lae blm lal lae blm $4==$1+$3 && $5==$2+$3 && samesign($1,$4):
lal $1 lae $2 blm $3+$6
lal lal blm lal lal blm $4==$1+$3 && $5==$2+$3 && samesign($1,$4) && samesign($2,$5):
lal $1 lal $2 blm $3+$6
lal lal sbs $3==w && samesign($1,$2): loc $1-$2
lae sdf : sde $1+$2
lae stf : ste $1+$2
lae sti $2==w: ste $1
lae sti $2==2*w: sde $1
lal adp samesign($1,$1+$2): lal $1+$2
lal blm $2==w: loi w stl $1
lal blm $2==2*w: loi 2*w sdl $1
#ifdef INT
lal sti loc stl notreg($4) && $4==$1-w && samesign($1,$4):
loc $3 lal $4 sti $2+w
lal sti loe stl notreg($4) && $4==$1-w && samesign($1,$4):
loe $3 lal $4 sti $2+w
#endif
lal ldf samesign($1,$1+$2): ldl $1+$2
lal lof samesign($1,$1+$2): lol $1+$2
lal loi $2==w: lol $1
lal loi $2==2*w: ldl $1
#ifdef INT
lal loi lol notreg($3) && $3==$1-w && samesign($1,$3) && $2%w==0:
lal $3 loi $2+w
lal loi ldl notreg($3) && $3==$1-2*w && samesign($1,$3) && $2%w==0:
lal $3 loi $2+2*w
lal loi lal loi $1==$3+$4 && samesign($1,$3) && $2%w==0 && $4%w==0:
lal $3 loi $2+$4
lal sti stl notreg($3) && $3==$1+$2 && samesign($1,$3): lal $1 sti $2+w
lal sti sdl notreg($3) && $3==$1+$2 && samesign($1,$3): lal $1 sti $2+2*w
#endif
lal sdf samesign($1,$1+$2): sdl $1+$2
lal stf samesign($1,$1+$2): stl $1+$2
lal sti $2==w: stl $1
lal sti $2==2*w: sdl $1
#ifdef INT
lde lde $2==$1-2*w: lae $2 loi 4*w
lde loe $2==$1-w: lae $2 loi 3*w
#endif
lde sde $2==$1:
lde sde lde sde $3==$1+2*w && $4==$2+2*w: lae $1 lae $2 blm 4*w
#ifdef INT
ldl ldl $2==$1-2*w && notreg($1) && notreg($2) && samesign($1,$2):
lal $2 loi 4*w
ldl lol $2==$1-w && notreg($1) && notreg($2) && samesign($1,$2):
lal $2 loi 3*w
#endif
ldl sdl $1==$2:
lxa loi lxa sti $3==$1 && $4==$2:
lxa lof lxa stf $3==$1 && $4==$2:
lxa ldf lxa sdf $3==$1 && $4==$2:
lxa stf lxa lof $1>1 && $3==$1 && $4==$2: dup w lxa $1 stf $2
lxa sdf lxa ldf $1>1 && $3==$1 && $4==$2: dup 2*w lxa $1 sdf $2
lxl lof lxl stf $3==$1 && $4==$2:
lxl ldf lxl sdf $3==$1 && $4==$2:
lxl stf lxl lof $1>1 && $3==$1 && $4==$2: dup w lxl $1 stf $2
lxl sdf lxl ldf $1>1 && $3==$1 && $4==$2: dup 2*w lxl $1 sdf $2
lxa sti lxa loi $1>1 && $3==$1 && $4==$2 && $2%w==0: dup $2 lxa $1 sti $2
loc adi $1==-1 && $2==w: dec
loc dec sfit($1-1,8*w) : loc $1-1
loc bgt $1==-1: zge $2
loc ble $1==-1: zlt $2
loc dvi $1==-1 && $2==w: ngi w
ldc dvi $1==-1 && $2==2*w: ngi 2*w
loc loe adi $1==-1 && $3==w: loe $2 dec
loc lol adi $1==-1 && $3==w: lol $2 dec
loc mli $1==-1 && $2==w: ngi w
ldc mli $1==-1 && $2==2*w: ngi 2*w
loc sbi $1==-1 && $2==w: inc
loc inc sfit($1+1,8*w) : loc $1+1
loc adi $1==0 && $2==w:
ldc adi $1==0 && $2==2*w:
loc adu $1==0 && $2==w:
ldc adu $1==0 && $2==2*w:
loc ads $1==0 && $2==w:
ldc ads $1==0 && $2==2*w:
zer adi $1==$2:
loc sri $1==0 && $2==w:
loc sli $1==0 && $2==w:
loc sru $1==0 && $2==w:
loc slu $1==0 && $2==w:
loc sri $1==0 && $2==2*w:
loc sli $1==0 && $2==2*w:
loc sru $1==0 && $2==2*w:
loc slu $1==0 && $2==2*w:
loc and $1==0 && $2==w: asp w loc 0
ldc and $1==0 && $2==2*w: asp 2*w ldc 0
zer and $1==$2: asp $1 zer $1
loc ior $1==0 && $2==w:
ldc ior $1==0 && $2==2*w:
zer ior $1==$2:
loc beq $1==0: zeq $2
loc bge $1==0: zge $2
loc bgt $1==0: zgt $2
loc ble $1==0: zle $2
loc blt $1==0: zlt $2
loc bne $1==0: zne $2
loc cmi teq $1==0 && $2==w: teq
loc cmi tge $1==0 && $2==w: tge
loc cmi tgt $1==0 && $2==w: tgt
loc cmi tle $1==0 && $2==w: tle
loc cmi tlt $1==0 && $2==w: tlt
loc cmi tne $1==0 && $2==w: tne
loc cmu teq $1==0 && $2==w: teq
loc cmu tne $1==0 && $2==w: tne
loc cmu zeq $1==0 && $2==w: zeq $3
loc cmu zne $1==0 && $2==w: zne $3
loc cmu tlt $1==0 && $2==w: asp w loc 0
loc cmu tle $1==0 && $2==w: teq
loc cmu tge $1==0 && $2==w: asp w loc 1
loc cmu tgt $1==0 && $2==w: tne
loc cmu zlt $1==0 && $2==w: asp w
loc cmu zle $1==0 && $2==w: zeq $3
loc cmu zge $1==0 && $2==w: asp w bra $3
loc cmu zgt $1==0 && $2==w: zne $3
ldc cmu tlt $1==0 && $2==2*w: asp 2*w loc 0
ldc cmu tle $1==0 && $2==2*w: ldc 0 cms 2*w teq
ldc cmu tge $1==0 && $2==2*w: asp 2*w loc 1
ldc cmu tgt $1==0 && $2==2*w: ldc 0 cms 2*w tne
ldc cmu zlt $1==0 && $2==2*w: asp 2*w
ldc cmu zle $1==0 && $2==2*w: ldc 0 cms 2*w zeq $3
ldc cmu zge $1==0 && $2==2*w: asp 2*w bra $3
ldc cmu zgt $1==0 && $2==2*w: ldc 0 cms 2*w zne $3
loc ior $1==0 && $2==w:
ldc ior $1==0 && $2==2*w:
zer ior $1==$2:
loc ste $1==0: zre $2
loc stl $1==0: zrl $2
loc sbi $1==0 && $2==w:
ldc sbi $1==0 && $2==2*w:
loc sbu $1==0 && $2==w:
ldc sbu $1==0 && $2==2*w:
zer sbi $1==$2:
zer sbu $1==$2:
loc xor $1==0 && $2==w:
ldc xor $1==0 && $2==2*w:
zer xor $1==$2:
loc adi $1==1 && $2==w: inc
loc bge $1==1: zgt $2
loc blt $1==1: zle $2
loc dvi $1==1 && $2==w:
ldc dvi $1==1 && $2==2*w:
loc dvu $1==1 && $2==w:
ldc dvu $1==1 && $2==2*w:
loc loe adi $1==1 && $3==w: loe $2 inc
loc lol adi $1==1 && $3==w: lol $2 inc
loc mli $1==0 && $2==w: asp w loc 0
ldc mli $1==0 && $2==2*w: asp 2*w ldc 0
loc mlu $1==0 && $2==w: asp w loc 0
ldc mlu $1==0 && $2==2*w: asp 2*w ldc 0
loc mli $1==1 && $2==w:
ldc mli $1==1 && $2==2*w:
loc mlu $1==1 && $2==w:
ldc mlu $1==1 && $2==2*w:
loc sbi $1==1 && $2==w: dec
loc loc sli $3==w: loc ($1 << $2)
loc loc slu $3==w: loc ($1 << $2)
ldc loc sli $3==2*w: ldc ($1 << $2)
ldc loc slu $3==2*w: ldc ($1 << $2)
loc loc sri $3==w: loc ($1 >> $2)
loc loc sru $1 >= 0 && $3==w: loc ($1 >> $2)
ldc loc sri $3==2*w: ldc ($1 >> $2)
ldc loc sru $1 >= 0 && $3==2*w: ldc ($1 >> $2)
loc loe mlu $3==w: loe $2 loc $1 mlu w
loc lol mlu $3==w: lol $2 loc $1 mlu w
ldc lde mlu $3==2*w: lde $2 ldc $1 mlu 2*w
ldc ldl mlu $3==2*w: ldl $2 ldc $1 mlu 2*w
loc loe mli $3==w: loe $2 loc $1 mli w
loc loe adi loc $3==w: loe $2 loc $1 adi w loc $4
loc loe adi inc $3==w: loe $2 loc $1 adi w inc
loc loe adi dec $3==w: loe $2 loc $1 adi w dec
loc lol mli $3==w: lol $2 loc $1 mli w
loc lol adi loc $3==w: lol $2 loc $1 adi w loc $4
loc lol adi inc $3==w: lol $2 loc $1 adi w inc
loc lol adi dec $3==w: lol $2 loc $1 adi w dec
ldc lde mli $3==2*w: lde $2 ldc $1 mli 2*w
ldc lde adi ldc $3==2*w: lde $2 ldc $1 adi 2*w ldc $4
ldc ldl mli $3==2*w: ldl $2 ldc $1 mli 2*w
ldc ldl adi ldc $3==2*w: ldl $2 ldc $1 adi 2*w ldc $4
loc mli $1==2 && $2==w: loc 1 sli w
loc mli $1==4 && $2==w: loc 2 sli w
loc mli $1==8 && $2==w: loc 3 sli w
loc mli $1==16 && $2==w: loc 4 sli w
loc mli $1==32 && $2==w: loc 5 sli w
loc mli $1==64 && $2==w: loc 6 sli w
loc mli $1==128 && $2==w: loc 7 sli w
loc mli $1==256 && $2==w: loc 8 sli w
loc mlu $1==2 && $2==w: loc 1 slu w
loc mlu $1==4 && $2==w: loc 2 slu w
loc mlu $1==8 && $2==w: loc 3 slu w
loc mlu $1==16 && $2==w: loc 4 slu w
loc mlu $1==32 && $2==w: loc 5 slu w
loc mlu $1==64 && $2==w: loc 6 slu w
loc mlu $1==128 && $2==w: loc 7 slu w
loc mlu $1==256 && $2==w: loc 8 slu w
ldc mli $1==2 && $2==2*w: loc 1 sli 2*w
ldc mli $1==4 && $2==2*w: loc 2 sli 2*w
ldc mli $1==8 && $2==2*w: loc 3 sli 2*w
ldc mli $1==16 && $2==2*w: loc 4 sli 2*w
ldc mli $1==32 && $2==2*w: loc 5 sli 2*w
ldc mli $1==64 && $2==2*w: loc 6 sli 2*w
ldc mli $1==128 && $2==2*w: loc 7 sli 2*w
ldc mli $1==256 && $2==2*w: loc 8 sli 2*w
ldc mlu $1==2 && $2==2*w: loc 1 slu 2*w
ldc mlu $1==4 && $2==2*w: loc 2 slu 2*w
ldc mlu $1==8 && $2==2*w: loc 3 slu 2*w
ldc mlu $1==16 && $2==2*w: loc 4 slu 2*w
ldc mlu $1==32 && $2==2*w: loc 5 slu 2*w
ldc mlu $1==64 && $2==2*w: loc 6 slu 2*w
ldc mlu $1==128 && $2==2*w: loc 7 slu 2*w
ldc mlu $1==256 && $2==2*w: loc 8 slu 2*w
/* The following patterns will not work on dvi */
loc dvu $1==2 && $2==w: loc 1 sru w
loc dvu $1==4 && $2==w: loc 2 sru w
loc dvu $1==8 && $2==w: loc 3 sru w
loc dvu $1==16 && $2==w: loc 4 sru w
loc dvu $1==32 && $2==w: loc 5 sru w
loc dvu $1==64 && $2==w: loc 6 sru w
loc dvu $1==128 && $2==w: loc 7 sru w
loc dvu $1==256 && $2==w: loc 8 sru w
ldc dvu $1==2 && $2==2*w: loc 1 sru 2*w /* not ldc 1 */
ldc dvu $1==4 && $2==2*w: loc 2 sru 2*w
ldc dvu $1==8 && $2==2*w: loc 3 sru 2*w
ldc dvu $1==16 && $2==2*w: loc 4 sru 2*w
ldc dvu $1==32 && $2==2*w: loc 5 sru 2*w
ldc dvu $1==64 && $2==2*w: loc 6 sru 2*w
ldc dvu $1==128 && $2==2*w: loc 7 sru 2*w
ldc dvu $1==256 && $2==2*w: loc 8 sru 2*w
loc adi !defined($2): adi $1
loc sbi !defined($2): sbi $1
loc mli !defined($2): mli $1
loc dvi !defined($2): dvi $1
loc rmi !defined($2): rmi $1
loc ngi !defined($2): ngi $1
loc sli !defined($2): sli $1
loc sri !defined($2): sri $1
loc adu !defined($2): adu $1
loc sbu !defined($2): sbu $1
loc mlu !defined($2): mlu $1
loc dvu !defined($2): dvu $1
loc rmu !defined($2): rmu $1
loc slu !defined($2): slu $1
loc sru !defined($2): sru $1
loc adf !defined($2): adf $1
loc sbf !defined($2): sbf $1
loc mlf !defined($2): mlf $1
loc dvf !defined($2): dvf $1
loc ngf !defined($2): ngf $1
loc fif !defined($2): fif $1
loc fef !defined($2): fef $1
loc zer !defined($2): zer $1
loc zrf !defined($2): zrf $1
loc los $2==w: loi $1
ldc los $2==2*w && $1<=32767: loi $1
ldc sts $2==2*w && $1<=32767: sti $1
ldc bls $2==2*w && $1<=32767: blm $1
loc sts $2==w: sti $1
loc ads $2==w: adp $1
ldc ads $2==2*w && sfit($1,8*w): adp $1
loc ass $2==w: asp $1
loc bls $2==w: blm $1
loc dus $2==w: dup $1
loc loc cii $1==$2:
loc loc cuu $1==$2:
loc loc cff $1==$2:
loc loc cii loc loc cii $1==$5 && $2==$4 && $1<$2:
loc loc cuu loc loc cuu $1==$5 && $2==$4 && $1<$2:
loc loc cff loc loc cff $1==$5 && $2==$4 && $1<$2:
loc and !defined($2): and $1
loc ior !defined($2): ior $1
loc xor !defined($2): xor $1
loc com !defined($2): com $1
loc rol !defined($2): rol $1
loc rol $1==0:
loc ror !defined($2): ror $1
loc ror $1==0:
loc inn !defined($2): inn $1
loc set !defined($2): set $1
loc cmi !defined($2): cmi $1
loc cmu !defined($2): cmu $1
loc cmf !defined($2): cmf $1
loe dec ste $1==$3: dee $1
loe inc ste $1==$3: ine $1
loe loc mli $2==0 && $3==w: loc 0
loe LEP adp SEP $1!=$4: LEP $2 adp $3 SEP $4 loe $1
lol LLP adp SLP $1!=$4: LLP $2 adp $3 SLP $4 lol $1
#ifdef INT
loe loe $2==$1-w: lde $2
loe loe beq $2==$1+w: lde $1 beq $3
loe loe bge $2==$1+w: lde $1 ble $3
loe loe bgt $2==$1+w: lde $1 blt $3
loe loe ble $2==$1+w: lde $1 bge $3
loe loe blt $2==$1+w: lde $1 bgt $3
loe loe bne $2==$1+w: lde $1 bne $3
loe loe cmi $2==$1+w && $3==w: lde $1 cmi w ngi w
#endif
ngi teq $1==w: teq
ngi tge $1==w: tle
ngi tgt $1==w: tlt
ngi tle $1==w: tge
ngi tlt $1==w: tgt
ngi tne $1==w: tne
#ifdef INT
loe loe mli $2==$1+w && $3==w: lde $1 mli w
loe loe adi $2==$1+w && $3==w: lde $1 adi w
loe loe $1==$2: loe $1 dup w
#endif
loe ste $1==$2:
LLP blm $2==w: loi w sil $1
lol loc sbi stl $1==$4 && $2==1: del $1
lol loc sbi stl $1==$4 && $2==-1: inl $1
lol loc adi stl $1==$4 && $2==1: inl $1
lol loc adi stl $1==$4 && $2==-1: del $1
lol dec stl $1==$3: del $1
lol inc stl $1==$3: inl $1
lol loc mli $2==0 && $3==w: loc 0
LLP loi $2==w: lil $1
#ifdef INT
lol lol $2==$1-w && notreg($1) && notreg($2) && samesign($1,$2):
ldl $2
lol lol beq $2==$1+w && notreg($1) && notreg($2) && samesign($1,$2):
ldl $1 beq $3
lol lol bge $2==$1+w && notreg($1) && notreg($2) && samesign($1,$2):
ldl $1 ble $3
lol lol bgt $2==$1+w && notreg($1) && notreg($2) && samesign($1,$2):
ldl $1 blt $3
lol lol ble $2==$1+w && notreg($1) && notreg($2) && samesign($1,$2):
ldl $1 bge $3
lol lol blt $2==$1+w && notreg($1) && notreg($2) && samesign($1,$2):
ldl $1 bgt $3
lol lol bne $2==$1+w && notreg($1) && notreg($2) && samesign($1,$2):
ldl $1 bne $3
lol lol cmi $3==w && $2==$1+w && notreg($1) && notreg($2) && samesign($1,$2):
ldl $1 cmi w ngi w
lol lol mli $3==w && $2==$1+w && notreg($1) && notreg($2) && samesign($1,$2):
ldl $1 mli w
lol lol adi $3==w && $2==$1+w && notreg($1) && notreg($2) && samesign($1,$2):
ldl $1 adi w
lol lol $1==$2: lol $1 dup w
#endif
lol stl $1==$2:
LLP sti $2==w: sil $1
mli ngi $1==$2: ngi $1 mli $1
ngi adi $1==$2: sbi $1
ngf adf $1==$2: sbf $1
ngi sbi $1==$2: adi $1
ngf sbf $1==$2: adf $1
ngi ngi $1==$2:
ngf ngf $1==$2:
#ifdef INT
sde sde $2==$1+2*w: lae $1 sti 4*w
sde ste $2==$1+2*w: lae $1 sti 3*w
sde loc ste $3==$1-w: loc $2 lae $3 sti 3*w
sde lol ste $3==$1-w: lol $2 lae $3 sti 3*w
sde lde $1==$2: dup 2*w sde $1
#endif
sdf $1==0: sti 2*w
#ifdef INT
sdl sdl $2==$1+2*w && notreg($1) && notreg($2) && samesign($1,$2):
lal $1 sti 4*w
sdl stl $2==$1+2*w && notreg($1) && notreg($2) && samesign($1,$2):
lal $1 sti 3*w
sdl loc stl $3==$1-w && notreg($1) && notreg($3) && samesign($1,$3):
loc $2 lal $3 sti 3*w
sdl loe stl $3==$1-w && notreg($1) && notreg($3) && samesign($1,$3):
loe $2 lal $3 sti 3*w
sdl ldl $1==$2: dup 2*w sdl $1
ste loe $1==$2: dup w ste $1
ste ste $2==$1-w: sde $2
ste loc ste $3==$1-w: loc $2 sde $3
ste lol ste $3==$1-w: lol $2 sde $3
stl lol $1==$2: dup w stl $1
#endif
stf $1==0: sti w
sdl ldl ret $1==$2 && $3==2*w: ret 2*w
#ifdef INT
stl stl $2==$1+w && notreg($1) && notreg($2) && samesign($1,$2): sdl $1
stl loc stl $3==$1-w && notreg($1) && notreg($3) && samesign($1,$3):
loc $2 sdl $3
stl loe stl $3==$1-w && notreg($1) && notreg($3) && samesign($1,$3):
loe $2 sdl $3
#endif
stl lol ret $1==$2 && $3==w: ret w
lal sti lal loi ret $1==$3 && $2==$4 && $2==$5: ret $2
loc sbi loc sbi $2==w && $4==w: loc $1+$3 sbi w
ldc sbi ldc sbi $2==2*w && $4==2*w: ldc $1+$3 sbi 2*w
loc sbi loc adi $2==w && $4==w: loc $1-$3 sbi w
ldc sbi ldc adi $2==2*w && $4==2*w: ldc $1-$3 sbi 2*w
/*
loc sbi loc mli $2==w && $4==w: loc $3 mli w loc $1*$3 sbi w
loc sbi loc sli $2==w && $4==w && $3==1: loc $3 sli w loc 2*$1 sbi w
*/
teq teq : tne
teq tne : teq
teq zne : zeq $2
teq zeq : zne $2
tge teq : tlt
tge tne : tge
tge zeq : zlt $2
tge zne : zge $2
tgt teq : tle
tgt tne : tgt
tgt zeq : zle $2
tgt zne : zgt $2
tle teq : tgt
tle tne : tle
tle zeq : zgt $2
tle zne : zle $2
tlt teq : tge
tlt tne : tlt
tlt zeq : zge $2
tlt zne : zlt $2
tne teq : teq
tne tne : tne
tne zeq : zeq $2
tne zne : zne $2
#ifdef INT
loc loc loc $1==0 && $2==0 && $3==0 : zer 3*w
zer loc defined($1) && $2==0: zer $1+w
#endif
loc loc loc cui $2==w && $3==w && $1>=0 && $1<=(1<<(8*w-2)): loc $1
loi loc loc cui $1 < w && $2==$3 && $2==w: loi $1
loi loc and $1==1 && $3==w && ($2&255)==255: loi 1
loi loc loc cii zeq $1==$2 && $2<=w && $3==w: loi $1 zeq $5
loi loc loc cii zne $1==$2 && $2<=w && $3==w: loi $1 zne $5
loi loc loc cii teq $1==$2 && $2<=w && $3==w: loi $1 teq
loi loc loc cii tne $1==$2 && $2<=w && $3==w: loi $1 tne
loi loc and loc loc cii $1==1 && $4==w && $3==w && $2==255: loi $1 loc $4 loc $5 cii
loi loc loc cii loc and $1==1 && $2==1 && $3==w && $5==255 && $6==w: loi 1
loi loc loc cii loc cmi zeq $1==1 && $2==1 && $3==w && $5>=0 && $5<128 && $6==w: loi 1 loc $5 cmi w zeq $7
loi loc loc cii loc cmi zne $1==1 && $2==1 && $3==w && $5>=0 && $5<128 && $6==w: loi 1 loc $5 cmi w zne $7
loi loc loc cii loc loc ciu loc and $1==1 && $2==1 && $3==w && $5==w && $6==w && $8==255 && $9==w: loi 1
loc loc cii LLP sti $2>$1 && $1==$5: LLP $4 sti $5
loc loc cii LEP sti $2>$1 && $1==$5: LEP $4 sti $5
loc loc cii lal sti $2>$1 && $1==$5: lal $4 sti $5
loc loc cii lae sti $2>$1 && $1==$5: lae $4 sti $5
loc and LEP sti $1==255 && $2==w && $4==1: LEP $3 sti $4
loc and LEP adp sti $1==255 && $2==w && $5==1: LEP $3 adp $4 sti $5
loc and lae sti $1==255 && $2==w && $4==1: lae $3 sti $4
loc and LLP sti $1==255 && $2==w && $4==1: LLP $3 sti $4
loc and LLP adp sti $1==255 && $2==w && $5==1: LLP $3 adp $4 sti $5
loc and lal sti $1==255 && $2==w && $4==1: lal $3 sti $4
cmp teq : cms p teq
cmp tne : cms p tne
cmp zeq : cms p zeq $2
cmp zne : cms p zne $2
cmi teq defined($1): cms $1 teq
cmi tne defined($1): cms $1 tne
cmu teq defined($1): cms $1 teq
cmu tne defined($1): cms $1 tne
cms zeq $1==w: beq $2
cms zne $1==w: bne $2
lol lae aar adp $3==w: adp $4 lol $1 lae $2 aar w
loe lae aar adp $3==w: adp $4 loe $1 lae $2 aar w
cmi zeq defined($1): cms $1 zeq $2
cmu zeq defined($1): cms $1 zeq $2
cmi zne defined($1): cms $1 zne $2
cmu zne defined($1): cms $1 zne $2
#ifdef INT
loe inc dup ste $1==$4 && $3==w: ine $1 loe $1
loe dec dup ste $1==$4 && $3==w: dee $1 loe $1
lol inc dup stl $1==$4 && $3==w: inl $1 lol $1
lol dec dup stl $1==$4 && $3==w: del $1 lol $1
adp dup SEP adp $1==-$4 && $2==p: dup p adp $1 SEP $3
adp dup SLP adp $1==-$4 && $2==p: dup p adp $1 SLP $3
inc dup ste dec $2==w: dup w inc ste $3
inc dup stl dec $2==w: dup w inc stl $3
#endif
bra lab $1==$2: lab $2
bra bra: bra $1
zeq bra lab $1==$3: zne $2 lab $1
zge bra lab $1==$3: zlt $2 lab $1
zgt bra lab $1==$3: zle $2 lab $1
zlt bra lab $1==$3: zge $2 lab $1
zle bra lab $1==$3: zgt $2 lab $1
zne bra lab $1==$3: zeq $2 lab $1
beq bra lab $1==$3: bne $2 lab $1
bge bra lab $1==$3: blt $2 lab $1
bgt bra lab $1==$3: ble $2 lab $1
blt bra lab $1==$3: bge $2 lab $1
ble bra lab $1==$3: bgt $2 lab $1
bne bra lab $1==$3: beq $2 lab $1
lin lin : lin $2
lin lab lin : lab $2 lin $3
lin ret : ret $2
lin bra : bra $2
#ifdef INT
dup SLP loi $1==p && $3==w: SLP $2 lil $2
dup SLP sti $1==p && $3==w: SLP $2 sil $2
#endif
loc cms $1==0 && $2==w: tne
zer $1==w: loc 0
loc loc adi $3==w && sfit($1+$2,8*w) : loc $1+$2
loc loc adu $3==w : loc $1+$2
loc loc sbi $3==w && sfit($1-$2,8*w) : loc $1-$2
loc loc sbu $3==w : loc $1-$2
loc loc sbs $3==w && w==p && sfit($1-$2,8*w) : loc $1-$2
loc loc mli $3==w && sfit($1*$2,8*w) : loc $1*$2
loc loc mlu $3==w : loc $1*$2
loc loc dvi $3==w && $2!=0 : loc $1/$2
loc loc and $3==w : loc $1&$2
loc loc ior $3==w : loc $1|$2
loc loc ior $1==0 && $2==0 && $3==2*w :
loc loc xor $3==w : loc $1^$2
loc loc xor $1==0 && $2==0 && $3==2*w :
loc loc rol $3==w : loc rotate($1,$2)
loc loc ror $3==w : loc rotate($1,8*w-$2)
loc ngi $2==w && sfit(-$1,8*w) : loc -$1
loc com $2==w : loc ~$1
ldc ngi $2==2*w : ldc -$1
loc lae aar $3==w && $1>=rom(2,0) && $1 <= rom(2,0)+rom(2,1) :
adp ($1-rom(2,0))*rom(2,2)
loc lae lar $3==w && $1>=rom(2,0) && $1 <= rom(2,0)+rom(2,1) :
adp ($1-rom(2,0))*rom(2,2) loi rom(2,2)
loc lae sar $3==w && $1>=rom(2,0) && $1 <= rom(2,0)+rom(2,1) :
adp ($1-rom(2,0))*rom(2,2) sti rom(2,2)
loc teq : loc $1==0
loc tne : loc $1!=0
loc tge : loc $1>=0
loc tle : loc $1<=0
loc tgt : loc $1>0
loc tlt : loc $1<0
loc zeq $1==0 : bra $2
loc zeq :
loc zne $1!=0 : bra $2
loc zne :
loc zge $1>=0 : bra $2
loc zge :
loc zle $1<=0 : bra $2
loc zle :
loc zgt $1>0 : bra $2
loc zgt :
loc zlt $1<0 : bra $2
loc zlt :
loc loc beq $1==$2 : bra $3
loc loc beq :
loc loc bne $1!=$2 : bra $3
loc loc bne :
loc loc bge $1>=$2 : bra $3
loc loc bge :
loc loc ble $1<=$2 : bra $3
loc loc ble :
loc loc bgt $1>$2 : bra $3
loc loc bgt :
loc loc blt $1<$2 : bra $3
loc loc blt :
loc loc cms $3==w : loc $1!=$2
ldc ldc cms $3==2*w : loc $1!=$2
lae loi lal sti $2==$4 && $2>8 : lae $1 lal $3 blm $2
lal loi lae sti $2==$4 && $2>8 : lal $1 lae $3 blm $2
lal loi lal sti $2==$4 && $2>8 && ( $3<=$1-$2 || $3>=$1+$2 ) :
lal $1 lal $3 blm $2
lae loi lae sti $2==$4 && $2>8 && ( !defined($1==$3) || $3<=$1-$2 || $3>=$1+$2 ) :
lae $1 lae $3 blm $2
loc loc loc cif $1==0 && $2==w : zrf $3
loc loc loc ciu $1>=0 && $2==w && $3==2*w : ldc $1
loc loc loc cii $2==w && $3==2*w : ldc $1
loc loc loc cii $2<w && $3==w : loc $1
loi loc inn $1==$3 && $2>=0 && $2<$1*8 :
lof ($2/(8*w))*w loc $2&(8*w-1) inn w
ldl loc inn $3==2*w && $2>=0 && $2<16*w :
lol $1+($2/(8*w))*w loc $2&(8*w-1) inn w
lde loc inn $3==2*w && $2>=0 && $2<16*w :
loe $1+($2/(8*w))*w loc $2&(8*w-1) inn w
ldf loc inn $3==2*w && $2>=0 && $2<16*w :
lof $1+($2/(8*w))*w loc $2&(8*w-1) inn w
loc inn $1<0 || $1>=8*$2 : asp $2 loc 0
lol lol beq $1==$2 : bra $3
loe loe beq $1==$2 : bra $3
lil lil beq $1==$2 : bra $3
lol lol bne $1==$2 :
loe loe bne $1==$2 :
lil lil bne $1==$2 :
lol lol teq $1==$2 : loc 1
loe loe teq $1==$2 : loc 1
lil lil teq $1==$2 : loc 1
lol lol tne $1==$2 : loc 0
loe loe tne $1==$2 : loc 0
lil lil tne $1==$2 : loc 0
lol loc CBO stl $3==w && $1==$4 : loc $2 lol $1 CBO w stl $4
lol loe CBO stl $3==w && $1==$4 : loe $2 lol $1 CBO w stl $4
lol lol CBO stl $3==w && $1==$4 && $1!=$2 : lol $2 lol $1 CBO w stl $4
lol lil CBO stl $3==w && $1==$4 : lil $2 lol $1 CBO w stl $4
ldl ldc CBO sdl $3==2*w && $1==$4 : ldc $2 ldl $1 CBO $3 sdl $4
ldl lde CBO sdl $3==2*w && $1==$4 : lde $2 ldl $1 CBO $3 sdl $4
ldl ldl CBO sdl $3==2*w && $1==$4 &&$1!=$2 : ldl $2 ldl $1 CBO $3 sdl $4
loe loc CBO ste $3==w && $1==$4 : loc $2 loe $1 CBO w ste $4
loe loe CBO ste $3==w && $1==$4 && $1!=$2 : loe $2 loe $1 CBO w ste $4
loe lol CBO ste $3==w && $1==$4 : lol $2 loe $1 CBO w ste $4
loe lil CBO ste $3==w && $1==$4 : lil $2 loe $1 CBO w ste $4
lde ldc CBO sde $3==2*w && $1==$4 : ldc $2 lde $1 CBO $3 sde $4
lde lde CBO sde $3==2*w && $1==$4 && $1!=$2 : lde $2 lde $1 CBO $3 sde $4
lde ldl CBO sde $3==2*w && $1==$4 : ldl $2 lde $1 CBO $3 sde $4
lil loc CBO sil $3==w && $1==$4 : loc $2 lil $1 CBO w sil $4
lil lol CBO sil $3==w && $1==$4 : lol $2 lil $1 CBO w sil $4
lil loe CBO sil $3==w && $1==$4 : loe $2 lil $1 CBO w sil $4
lil lil CBO sil $3==w && $1==$4 && $1!=$2 : lil $2 lil $1 CBO w sil $4
LLP loi ldc CBO LLP sti $4==2*w && $2==$4 && $6==$4 && $1==$5 :
ldc $3 LLP $1 loi $2 CBO $4 LLP $5 sti $6
LLP loi ldl CBO LLP sti $4==2*w && $2==$4 && $6==$4 && $1==$5 :
ldl $3 LLP $1 loi $2 CBO $4 LLP $5 sti $6
LLP loi lde CBO LLP sti $4==2*w && $2==$4 && $6==$4 && $1==$5 :
lde $3 LLP $1 loi $2 CBO $4 LLP $5 sti $6
LLP ldf ldc CBO LLP sdf $4==2*w && $2==$6 && $1==$5 :
ldc $3 LLP $1 ldf $2 CBO $4 LLP $5 sdf $6
LLP ldf ldl CBO LLP sdf $4==2*w && $2==$6 && $1==$5 :
ldl $3 LLP $1 ldf $2 CBO $4 LLP $5 sdf $6
LLP ldf lde CBO LLP sdf $4==2*w && $2==$6 && $1==$5 :
lde $3 LLP $1 ldf $2 CBO $4 LLP $5 sdf $6
LLP lof loc CBO LLP stf $4==w && $2==$6 && $1==$5 :
loc $3 LLP $1 lof $2 CBO $4 LLP $5 stf $6
LLP lof lol CBO LLP stf $4==w && $2==$6 && $1==$5 :
lol $3 LLP $1 lof $2 CBO $4 LLP $5 stf $6
LLP lof loe CBO LLP stf $4==w && $2==$6 && $1==$5 :
loe $3 LLP $1 lof $2 CBO $4 LLP $5 stf $6
LLP lof lil CBO LLP stf $4==w && $2==$6 && $1==$5 :
lil $3 LLP $1 lof $2 CBO $4 LLP $5 stf $6
LEP loi ldc CBO LEP sti $4==2*w && $2==$4 && $6==$4 && $1==$5 :
ldc $3 LEP $1 loi $2 CBO $4 LEP $5 sti $6
LEP loi ldl CBO LEP sti $4==2*w && $2==$4 && $6==$4 && $1==$5 :
ldl $3 LEP $1 loi $2 CBO $4 LEP $5 sti $6
LEP loi lde CBO LEP sti $4==2*w && $2==$4 && $6==$4 && $1==$5 :
lde $3 LEP $1 loi $2 CBO $4 LEP $5 sti $6
LEP ldf ldc CBO LEP sdf $4==2*w && $2==$6 && $1==$5 :
ldc $3 LEP $1 ldf $2 CBO $4 LEP $5 sdf $6
LEP ldf ldl CBO LEP sdf $4==2*w && $2==$6 && $1==$5 :
ldl $3 LEP $1 ldf $2 CBO $4 LEP $5 sdf $6
LEP ldf lde CBO LEP sdf $4==2*w && $2==$6 && $1==$5 :
lde $3 LEP $1 ldf $2 CBO $4 LEP $5 sdf $6
LEP lof loc CBO LEP stf $4==w && $2==$6 && $1==$5 :
loc $3 LEP $1 lof $2 CBO $4 LEP $5 stf $6
LEP lof lol CBO LEP stf $4==w && $2==$6 && $1==$5 :
lol $3 LEP $1 lof $2 CBO $4 LEP $5 stf $6
LEP lof loe CBO LEP stf $4==w && $2==$6 && $1==$5 :
loe $3 LEP $1 lof $2 CBO $4 LEP $5 stf $6
LEP lof lil CBO LEP stf $4==w && $2==$6 && $1==$5 :
lil $3 LEP $1 lof $2 CBO $4 LEP $5 stf $6
ldl loe loc loc cii adi sdl $6==2*w && $1==$7 && $3==w && $4==2*w :
loe $2 loc $3 loc $4 cii ldl $1 adi 2*w sdl $1
ldl lol loc loc cii adi sdl $6==2*w && $1==$7 && $3==w && $4==2*w :
lol $2 loc $3 loc $4 cii ldl $1 adi 2*w sdl $1
lde loe loc loc cii adi sde $6==2*w && $1==$7 && $3==w && $4==2*w :
loe $2 loc $3 loc $4 cii lde $1 adi 2*w sde $1
lde lol loc loc cii adi sde $6==2*w && $1==$7 && $3==w && $4==2*w :
lol $2 loc $3 loc $4 cii lde $1 adi 2*w sde $1
ldl loe loc loc cii mli sdl $6==2*w && $1==$7 && $3==w && $4==2*w :
loe $2 loc $3 loc $4 cii ldl $1 mli 2*w sdl $1
ldl lol loc loc cii mli sdl $6==2*w && $1==$7 && $3==w && $4==2*w :
lol $2 loc $3 loc $4 cii ldl $1 mli 2*w sdl $1
lde loe loc loc cii mli sde $6==2*w && $1==$7 && $3==w && $4==2*w :
loe $2 loc $3 loc $4 cii lde $1 mli 2*w sde $1
lde lol loc loc cii mli sde $6==2*w && $1==$7 && $3==w && $4==2*w :
lol $2 loc $3 loc $4 cii lde $1 mli 2*w sde $1
loi asp $1==$2 : asp p
lal loi loc loc loc loc ior $2==4*w && $7==4*w && ($3==0)+($4==0)+($5==0)+($6==0)>2 :
lol $1+3*w loc $3 ior w lol $1+2*w loc $4 ior w lol $1+w loc $5 ior w lol $1 loc $6 ior w
loc dup stl loc dup stl $2==w && $5==w:
loc $1 stl $3 loc $4 stl $6 loc $1 loc $4
LLP LLP adp SLP sti $2==$4 && (!notreg($2) || $5!=p):
LLP $1 sti $5 LLP $2 adp $3 SLP $4
LEP LEP adp SEP sti $2==$4 && $5!=p:
LEP $1 sti $5 LEP $2 adp $3 SEP $4
#ifndef INT
stl lol $1==$2 : dup w stl $1
ste loe $1==$2 : dup w ste $1
sil lil $1==$2 : dup w sil $1
sdl ldl $1==$2 : dup 2*w sdl $1
sde lde $1==$2 : dup 2*w sde $1
lol lol $1==$2 : lol $1 dup w
loe loe $1==$2 : loe $1 dup w
lil lil $1==$2 : lil $1 dup w
ldl ldl $1==$2 : ldl $1 dup 2*w
lde lde $1==$2 : lde $1 dup 2*w
LLP lof LLP lof $1==$3 && $2==$4 : LLP $1 lof $2 dup w
LEP lof LEP lof $1==$3 && $2==$4 : LEP $1 lof $2 dup w
LEP loi LEP loi $1==$3 && $2==$4 && $2==w : LEP $1 loi $2 dup w
#endif
adp SLP LLP adp $1+$4==0 && $2==$3 : dup p adp $1 SLP $2
adp SEP LEP adp $1+$4==0 && $2==$3 : dup p adp $1 SEP $2
adp sil lil adp $1+$4==0 && $2==$3 && w==p : dup p adp $1 sil $2
adp LLP sti LLP loi adp $1+$6==0 && $2==$4 && $3==p && $5==p :
dup p adp $1 LLP $2 sti p
adp LEP sti LEP loi adp $1+$6==0 && $2==$4 && $3==p && $5==p :
dup p adp $1 LEP $2 sti p
/* The next to patterns added on request of Kees Visser */
lol asp $2>=w: asp $2-w
ldl asp $2>=2*w: asp $2-2*w