From 1414757b61ed827fd665afd74aa85bcd56541e80 Mon Sep 17 00:00:00 2001 From: Charles Forsyth Date: Mon, 20 Jul 2015 21:30:52 +0100 Subject: 1. give name to SOFTFP option; 2. allow rotate to generate constant indices; 3. avoid add $0; 4. correct ordering of bounds check code; 5. distinguish nil reference from bounds error --- libinterp/comp-arm.c | 73 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 28 deletions(-) (limited to 'libinterp/comp-arm.c') diff --git a/libinterp/comp-arm.c b/libinterp/comp-arm.c index d2b1fc69..a3b1024e 100644 --- a/libinterp/comp-arm.c +++ b/libinterp/comp-arm.c @@ -11,6 +11,7 @@ */ #define RESCHED 1 /* check for interpreter reschedule */ +#define SOFTFP 1 enum { @@ -117,6 +118,8 @@ enum Blo = 0, /* offset of low order word in big */ Bhi = 4, /* offset of high order word in big */ + Lg2Rune = 2, + NCON = (0xFFC-8)/4, SRCOP = (1<<0), @@ -217,16 +220,19 @@ enum #define PATCH(ptr) *ptr |= (((ulong)code-(ulong)(ptr)-8)>>2) & 0x00ffffff #define MOV(src, dst) DP(AL, Mov, 0, dst, 0, src) + +#define FITS12(v) ((ulong)(v)add&ARM) != AXIMM || !FITS8((short)i->reg<<1)){ + if((i->add&ARM) != AXIMM || !FITS12((short)i->reg<reg) == 0){ mid(i, Ldw, RA2); // RA2 = i imm = 0; } mem(Ldw, O(String,len),RA1, RA0); // len<0 => index Runes, otherwise bytes + if(bflag){ + DPI(AL, Orr, RA0, RA3, 0, 0); + DPI(LT, Rsb, RA3, RA3, 0, 0); + if(imm) + BCKR(immrot((short)i->reg), RA3); + else + BCK(RA2, RA3); + } DPI(AL, Add, RA1, RA1, 0, O(String,data)); CMPI(AL, RA0, 0, 0, 0); - if(bflag) - DPI(LT, Rsb, RA0, RA0, 0, 0); if(imm){ LDB(GE, RA1, RA3, i->reg); - LDH(LT, RA1, RA3, (short)i->reg<<1); - if(bflag) - BCKI(i->reg, RA0); + LDW(LT, RA1, RA3, (short)i->reg<op) { case IINDL: @@ -1595,10 +1608,11 @@ comp(Inst *i) r = 2; break; } - if(UXDST(i->add) == DST(AIMM) && FITS8(i->d.imm<add) == DST(AIMM) && (imm = immrot(i->d.imm)) != 0) { if(bflag) - BCKI(i->d.imm, RA2); - DPI(AL, Add, RA0, RA0, 0, (i->d.imm<d.imm != 0) + DPI(AL, Add, RA0, RA0, 0, 0) | immrot(i->d.imm<op]); break; } @@ -1695,7 +1712,7 @@ comp(Inst *i) opflst(i, Stf, FA4); break; case INEGF: - if(1){ + if(SOFTFP){ punt(i, SRCOP|DSTOP, optab[i->op]); break; } @@ -1705,7 +1722,7 @@ comp(Inst *i) //if(pass){print("%D\n", i); das(s, code-s);} break; case ICVTWF: - if(1){ + if(SOFTFP){ punt(i, SRCOP|DSTOP, optab[i->op]); break; } @@ -1715,7 +1732,7 @@ comp(Inst *i) //if(pass){print("%D\n", i); das(s, code-s);} break; case ICVTFW: - if(1){ + if(SOFTFP){ punt(i, SRCOP|DSTOP, optab[i->op]); break; } -- cgit v1.2.3