Move logic for if (int value) to tccgen.c
Move the logic to do a test of an integer value (ex if (0)) out of arch-specific code to tccgen.c to avoid code duplication. This also fixes test of long long value which was only testing the bottom half of such values on 32 bits architectures.
This commit is contained in:
25
arm-gen.c
25
arm-gen.c
@ -1390,7 +1390,7 @@ int gtst(int inv, int t)
|
||||
op|=encbranch(r,t,1);
|
||||
o(op);
|
||||
t=r;
|
||||
} else if (v == VT_JMP || v == VT_JMPI) {
|
||||
} else { /* VT_JMP || VT_JMPI */
|
||||
if ((v & 1) == inv) {
|
||||
if(!vtop->c.i)
|
||||
vtop->c.i=t;
|
||||
@ -1412,29 +1412,6 @@ int gtst(int inv, int t)
|
||||
t = gjmp(t);
|
||||
gsym(vtop->c.i);
|
||||
}
|
||||
} else {
|
||||
if (is_float(vtop->type.t)) {
|
||||
r=gv(RC_FLOAT);
|
||||
#ifdef TCC_ARM_VFP
|
||||
o(0xEEB50A40|(vfpr(r)<<12)|T2CPR(vtop->type.t)); /* fcmpzX */
|
||||
o(0xEEF1FA10); /* fmstat */
|
||||
#else
|
||||
o(0xEE90F118|(fpr(r)<<16));
|
||||
#endif
|
||||
vtop->r = VT_CMP;
|
||||
vtop->c.i = TOK_NE;
|
||||
return gtst(inv, t);
|
||||
} else if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
|
||||
/* constant jmp optimization */
|
||||
if ((vtop->c.i != 0) != inv)
|
||||
t = gjmp(t);
|
||||
} else {
|
||||
v = gv(RC_INT);
|
||||
o(0xE3300000|(intr(v)<<16));
|
||||
vtop->r = VT_CMP;
|
||||
vtop->c.i = TOK_NE;
|
||||
return gtst(inv, t);
|
||||
}
|
||||
}
|
||||
vtop--;
|
||||
return t;
|
||||
|
||||
Reference in New Issue
Block a user