Several fixes from Charles Lindsey

This commit is contained in:
ceriel 1995-07-25 16:43:42 +00:00
parent 34b3d1fb52
commit 4978d19bff

View file

@ -2840,6 +2840,8 @@ C_com_narg ==>
"not $a, $b"; "not $a, $b";
"st $b, [$reg_sp+$i_str]"; "st $b, [$reg_sp+$i_str]";
} }
free_reg(b);
free_reg(a);
} }
else else
arg_error ("com", n); arg_error ("com", n);
@ -2885,39 +2887,36 @@ C_rol
n= n % 32; n= n % 32;
if (n) if (n)
{ {
a= alloc_reg(); a= pop_reg();
pop_reg_as(a);
b= alloc_reg(); b= alloc_reg();
c= alloc_reg(); c= alloc_reg();
sprint(n_str, "%d", n); sprint(n_str, "%d", n);
"sll $a, $n_str, $b"; "sll $a, $n_str, $b";
sprint(n_str, "%d", 32-n); sprint(n_str, "%d", 32-n);
"srl $a, $n_str, $c"; "srl $a, $n_str, $c";
"or $b, $c, $a"; "or $b, $c, $c";
push_reg(a); free_reg(a);
free_reg(b); free_reg(b);
free_reg(c); push_reg(c);
} }
} }
} }
else else
{ {
a= alloc_reg(); a= pop_reg();
pop_reg_as(a); b= pop_reg();
b= alloc_reg();
pop_reg_as(b);
c= alloc_reg(); c= alloc_reg();
d= alloc_reg(); d= alloc_reg();
"and $a, 31, $c"; "and $a, 31, $c";
"mov 32, $a"; "mov 32, $d";
"sub $a, $c, $d"; "sub $d, $c, $d";
"sll $b, $c, $a"; "sll $b, $c, $c";
"srl $b, $d, $c"; "srl $b, $d, $d";
"or $a, $c, $b"; "or $c, $d, $d";
free_reg(a); free_reg(a);
push_reg(b); free_reg(b);
free_reg(c); free_reg(c);
free_reg(d); push_ref(d);
} }
}. }.
default ==> default ==>
@ -2947,39 +2946,36 @@ C_ror
n= n % 32; n= n % 32;
if (n) if (n)
{ {
a= alloc_reg(); a= pop_reg();
pop_reg_as(a);
b= alloc_reg(); b= alloc_reg();
c= alloc_reg(); c= alloc_reg();
sprint(n_str, "%d", n); sprint(n_str, "%d", n);
"srl $a, $n_str, $b"; "srl $a, $n_str, $b";
sprint(n_str, "%d", 32-n); sprint(n_str, "%d", 32-n);
"sll $a, $n_str, $c"; "sll $a, $n_str, $c";
"or $b, $c, $a"; "or $b, $c, $c";
push_reg(a); free_reg(a);
free_reg(b); free_reg(b);
free_reg(c); push_reg(c);
} }
} }
} }
else else
{ {
a= alloc_reg(); a= pop_reg();
pop_reg_as(a); b= pop_reg();
b= alloc_reg();
pop_reg_as(b);
c= alloc_reg(); c= alloc_reg();
d= alloc_reg(); d= alloc_reg();
"and $a, 31, $c"; "and $a, 31, $c";
"mov 32, $a"; "mov 32, $d";
"sub $a, $c, $d"; "sub $d, $c, $d";
"srl $b, $c, $a"; "srl $b, $c, $c";
"sll $b, $d, $c"; "sll $b, $d, $d";
"or $a, $c, $b"; "or $c, $d, $d";
free_reg(a); free_reg(a);
push_reg(b); free_reg(b);
free_reg(c); free_reg(c);
free_reg(d); push_reg(d);
} }
}. }.
default ==> default ==>
@ -3159,10 +3155,10 @@ C_set_narg ==>
"bnz 1b"; "bnz 1b";
"st %g0, [$reg_sp+$a]"; /* HACK delay */ "st %g0, [$reg_sp+$a]"; /* HACK delay */
"andn $b, 31, $c"; "andn $b, 31, $c";
"and $b, 31, $b"; "and $b, 31, $d";
"srl $c, 3, $c"; "srl $c, 3, $c";
"set 1, $a"; "set 1, $a";
"sll $a, $b, $d"; "sll $a, $d, $d";
"st $d, [$reg_sp+$c]"; "st $d, [$reg_sp+$c]";
free_reg(a); free_reg(a);
free_reg(b); free_reg(b);
@ -3172,8 +3168,7 @@ C_set_narg ==>
} else { } else {
a= alloc_reg(); a= alloc_reg();
pop_reg_as(a); pop_reg_as(a);
b= alloc_reg(); b= pop_reg();
pop_reg_as(b);
flush_cache(); flush_cache();
c= alloc_reg(); c= alloc_reg();
d= alloc_reg(); d= alloc_reg();
@ -3183,10 +3178,10 @@ C_set_narg ==>
"bnz 1b"; "bnz 1b";
"st %g0, [$reg_sp+$a]"; /* HACK delay */ "st %g0, [$reg_sp+$a]"; /* HACK delay */
"andn $b, 31, $c"; "andn $b, 31, $c";
"and $b, 31, $b"; "and $b, 31, $d";
"srl $c, 3, $c"; "srl $c, 3, $c";
"set 1, $a"; "set 1, $a";
"sll $a, $b, $d"; "sll $a, $d, $d";
"st $d, [$reg_sp+$c]"; "st $d, [$reg_sp+$c]";
free_reg(a); free_reg(a);
free_reg(b); free_reg(b);
@ -4050,6 +4045,7 @@ C_bls
reg_t b; reg_t b;
reg_t c; reg_t c;
reg_t d; reg_t d;
reg_t e;
reg_t ao_reg; reg_t ao_reg;
reg_t bo_reg; reg_t bo_reg;
int n; int n;
@ -4139,16 +4135,20 @@ C_bls
b= pop_reg(); /* src */ b= pop_reg(); /* src */
c= alloc_reg(); c= alloc_reg();
d= alloc_reg(); d= alloc_reg();
"set $n_str, $c"; e = alloc_reg();
"set $n_str-4, $c";
"set -4, $e";
"1:"; "1:";
"deccc 4, $c"; "inc 4, $e";
"ld [$b+$c], $d"; "ld [$b+$e], $d";
"cmp $e,$c";
"bnz 1b"; "bnz 1b";
"st $d, [$a+$c]"; "st $d, [$a+$e]";
free_reg(a); free_reg(a);
free_reg(b); free_reg(b);
free_reg(c); free_reg(c);
free_reg(d); free_reg(d);
free_reg(e);
} }
} }
else else
@ -4159,15 +4159,21 @@ C_bls
a= pop_reg(); /* dest */ a= pop_reg(); /* dest */
b= pop_reg(); /* src */ b= pop_reg(); /* src */
d= alloc_reg(); d= alloc_reg();
e= alloc_reg();
"ba 2f";
"clr $e";
"1:"; "1:";
"deccc 4, $c"; "st $d, [$a+$e]";
"ld [$b+$c], $d"; "inc 4, $e";
"2:";
"cmp $e, $c"
"bnz 1b"; "bnz 1b";
"st $d, [$a+$c]"; "ld [$b+$e], $d";
free_reg(a); free_reg(a);
free_reg(b); free_reg(b);
free_reg(c); free_reg(c);
free_reg(d); free_reg(d);
free_reg(e);
} }
}. }.