From 256151c7e416dfa8469033419278d1cbfd7964de Mon Sep 17 00:00:00 2001 From: ceriel Date: Wed, 3 Feb 1993 10:10:07 +0000 Subject: [PATCH] Added some patterns and fixed error in constant multiplication --- util/opt/patterns | 4 ++++ util/opt/peephole.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/util/opt/patterns b/util/opt/patterns index ca0079ef6..f8285d5a3 100644 --- a/util/opt/patterns +++ b/util/opt/patterns @@ -374,6 +374,10 @@ 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 diff --git a/util/opt/peephole.c b/util/opt/peephole.c index d7513deb2..753b439c2 100644 --- a/util/opt/peephole.c +++ b/util/opt/peephole.c @@ -777,7 +777,12 @@ repl_mul(lp, b, e) } else { if (virgin) { newinstr(b, op_dup, sz); b = &((*b)->l_next); - newinstr(b, op_loc, 0); b = &((*b)->l_next); + if (sz == wordsize) { + newinstr(b, op_loc, 0); b = &((*b)->l_next); + } + else { + newinstr(b, op_ldc, 0); b = &((*b)->l_next); + } newinstr(b, op_exg, sz); b = &((*b)->l_next); virgin = 0; } -- 2.34.1