quick fix for comparisons with constants

This commit is contained in:
Quentin Carbonneaux 2015-08-05 12:47:10 -04:00
parent 246a48ba94
commit 9c7b06d68f
5 changed files with 22 additions and 7 deletions

View file

@ -87,8 +87,14 @@ sel(Ins i, Fn *fn)
default:
if (OCmp <= i.op && i.op <= OCmp1) {
c = i.op - OCmp;
if (rtype(i.arg[0]) == RCon) {
r0 = i.arg[0];
i.arg[0] = i.arg[1];
i.arg[1] = r0;
c = CNEG(c);
}
emit(OXSet+c, i.to, R, R);
emit(OXCmp, R, i.arg[0], i.arg[1]);
emit(OXCmp, R, i.arg[1], i.arg[0]);
break;
}
diag("isel: non-exhaustive implementation");