On Mon Apr 29 14:55:02 EDT 2013, cinap_len...@gmx.de wrote:
> following up, theres my naive fix for this. instead of 
> emiting conditional division instruction by 5c... dont and
> keep the branch. does this make any sense?
> 
> term% hg diff -r 1777 peep.c
> diff -r 5eeb36d3ddd0 sys/src/cmd/5c/peep.c
> --- a/sys/src/cmd/5c/peep.c   Mon Jul 30 19:11:16 2012 +0200
> +++ b/sys/src/cmd/5c/peep.c   Mon Apr 29 20:51:12 2013 +0200
> @@ -1354,6 +1354,15 @@
>                       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;

it's possible to do in the linker, but without trying this,
it looks reasonable to me.  what does the resulting asm
look like?

- erik

Reply via email to