fix two bugs in isel

This commit is contained in:
Quentin Carbonneaux 2015-08-06 13:08:31 -04:00
parent e5983ba1a2
commit 2482f4dbbb
5 changed files with 11 additions and 6 deletions

View file

@ -86,6 +86,7 @@ sel(Ins i, Fn *fn)
break;
default:
if (OCmp <= i.op && i.op <= OCmp1) {
t = -1;
r0 = i.arg[0];
c = i.op - OCmp;
if (rtype(i.arg[0]) == RCon) {
@ -98,12 +99,12 @@ sel(Ins i, Fn *fn)
} else {
r0 = i.arg[1];
i.arg[1] = i.arg[0];
c = CNEG(c);
c = COP(c);
}
}
emit(OXSet+c, i.to, R, R);
emit(OXCmp, R, i.arg[1], r0);
if (!req(r0, i.arg[0]))
if (t != -1)
emit(OCopy, r0, i.arg[0], R);
break;
}