diff options
| author | jiang <30155751@qq.com> | 2014-04-30 14:24:44 +0800 |
|---|---|---|
| committer | jiang <30155751@qq.com> | 2014-04-30 14:24:44 +0800 |
| commit | 9ff288648b23537c205e4dad16002e2b9ca03203 (patch) | |
| tree | 04168042a0103b0dfde4491e8c664086db990711 /arm-gen.c | |
| parent | 515169f21bf6c75a3179822e1dd9e006f5ef4412 (diff) | |
| download | tinycc-9ff288648b23537c205e4dad16002e2b9ca03203.tar.gz tinycc-9ff288648b23537c205e4dad16002e2b9ca03203.tar.bz2 | |
Restore eda2c756edc4dca004ba217d5bf361235dd9de1f
Diffstat (limited to 'arm-gen.c')
| -rw-r--r-- | arm-gen.c | 83 |
1 files changed, 53 insertions, 30 deletions
@@ -1409,37 +1409,60 @@ void gjmp_addr(int a) /* generate a test. set 'inv' to invert test. Stack entry is popped */ int gtst(int inv, int t) { - int v, r; - uint32_t op; - v = vtop->r & VT_VALMASK; - r=ind; - if (v == VT_CMP) { - op=mapcc(inv?negcc(vtop->c.i):vtop->c.i); - op|=encbranch(r,t,1); - o(op); - t=r; - } else { /* VT_JMP || VT_JMPI */ - if ((v & 1) == inv) { - if(!vtop->c.i) - vtop->c.i=t; - else { - uint32_t *x; - int p,lp; - if(t) { - p = vtop->c.i; - do { - p = decbranch(lp=p); - } while(p); - x = (uint32_t *)(cur_text_section->data + lp); - *x &= 0xff000000; - *x |= encbranch(lp,t,1); - } - t = vtop->c.i; - } - } else { - t = gjmp(t); - gsym(vtop->c.i); + int v, r; + uint32_t op; + v = vtop->r & VT_VALMASK; + r=ind; + if (v == VT_CMP) { + op=mapcc(inv?negcc(vtop->c.i):vtop->c.i); + op|=encbranch(r,t,1); + o(op); + t=r; + } else if (v == VT_JMP || v == VT_JMPI) { + if ((v & 1) == inv) { + if(!vtop->c.i) + vtop->c.i=t; + else { + uint32_t *x; + int p,lp; + if(t) { + p = vtop->c.i; + do { + p = decbranch(lp=p); + } while(p); + x = (uint32_t *)(cur_text_section->data + lp); + *x &= 0xff000000; + *x |= encbranch(lp,t,1); + } + t = vtop->c.i; + } + } else { + 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; |
