From ce62bbb8539eaa56c6646da3d445d968dabec99f Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 29 Apr 2013 20:15:40 +0200 Subject: [PATCH] 5c: dont emit conditional integer division instructions the integer division instructions are emulated with _div() function patched in by 5l which does not handle conditional execution. so do not optimize away the branch in that case. --- sys/src/cmd/5c/peep.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/src/cmd/5c/peep.c b/sys/src/cmd/5c/peep.c index c7b4c2a30..3d624a93d 100644 --- a/sys/src/cmd/5c/peep.c +++ b/sys/src/cmd/5c/peep.c @@ -1354,6 +1354,15 @@ joinsplit(Reg *r, Joininfo *j) j->end = r->s2; return Branch; } + switch(r->prog->as){ + case ADIV: + case ADIVU: + case AMOD: + case AMODU: + /* emulated by 5l, doesnt handle conditionals */ + j->end = r->s1; + return Toolong; + } if (modifiescpsr(r->prog)) { j->end = r->s1; return Setcond;