diff options
Diffstat (limited to 'sim/sh/gencode.c')
-rw-r--r-- | sim/sh/gencode.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/sim/sh/gencode.c b/sim/sh/gencode.c index e171848..476acc1 100644 --- a/sim/sh/gencode.c +++ b/sim/sh/gencode.c @@ -49,13 +49,10 @@ op tab[] = {"n","","add #<imm>,<REG_N>", "0111nnnni8*1....", "R[n] += SEXT(i);if (i == 0) { UNDEF(n); break; } "}, {"n","mn","add <REG_M>,<REG_N>", "0011nnnnmmmm1100", "R[n] += R[m];"}, - {"n","mn","addc <REG_M>,<REG_N>", "0011nnnnmmmm1110", "ult=R[n]+T;T=ult<T;ult=ult+R[m];T=T|(ult<R[m]);R[n]=ult;"}, + {"n","mn","addc <REG_M>,<REG_N>", "0011nnnnmmmm1110", + "ult=R[n]+T;T=ult<R[n];R[n]=ult+R[m];T|=R[n]<ult;"}, {"n","mn","addv <REG_M>,<REG_N>", "0011nnnnmmmm1111", - "{long ans;", - " ans = R[n] + R[m];", - "T = ((~R[n] & R[m] & ans) | (R[n] & R[m] & ~ans)) >>31;", - "R[n] = ans;}"}, - + "ult = R[n] + R[m]; T = ((~(R[n] ^ R[m]) & (ult ^ R[n])) >> 31); R[n] = ult;"}, {"0","","and #<imm>,R0", "11001001i8*1....", ";R0&=i;"}, {"n","nm","and <REG_M>,<REG_N>", "0010nnnnmmmm1001", " R[n]&=R[m];"}, {"","0","and.b #<imm>,@(R0,GBR)", "11001101i8*1....", ";WBAT(GBR+R0, RBAT(GBR+R0) & i);"}, @@ -99,7 +96,7 @@ op tab[] = {"","n","lds.l @<REG_N>+,MACH", "0100nnnn00000110", "MACH = SEXT(RLAT(R[n]));R[n]+=4;"}, {"","n","lds.l @<REG_N>+,MACL", "0100nnnn00010110", "MACL = RLAT(R[n]);R[n]+=4;"}, {"","n","lds.l @<REG_N>+,PR", "0100nnnn00100110", "PR = RLAT(R[n]);R[n]+=4;;"}, - {"","n","mac.w @<REG_M>+,@<REG_N>+", "0100nnnnmmmm1111", "abort();"}, + {"","n","mac.w @<REG_M>+,@<REG_N>+", "0100nnnnmmmm1111", "macw(R0,memory,n,m);"}, {"n","","mov #<imm>,<REG_N>", "1110nnnni8*1....", "R[n] = SEXT(i);"}, {"n","m","mov <REG_M>,<REG_N>", "0110nnnnmmmm0011", "R[n] = R[m];"}, {"","mn0","mov.b <REG_M>,@(R0,<REG_N>)", "0000nnnnmmmm0100", "WBAT(R[n]+R0, R[m]);"}, @@ -140,8 +137,7 @@ op tab[] = {"","mn","mul.l <REG_M>,<REG_N>","0000nnnnmmmm0111","MACL=((int)R[n])*((int)R[m]);"}, {"","mn","mulu <REG_M>,<REG_N>", "0010nnnnmmmm1110","MACL=((unsigned int)(unsigned short)R[n])*((unsigned int)(unsigned short)R[m]);"}, {"n","m","neg <REG_M>,<REG_N>", "0110nnnnmmmm1011", "R[n] = - R[m];"}, - {"n","m","negc <REG_M>,<REG_N>", "0110nnnnmmmm1010", - "ult=R[m]; R[n]=0-R[m]-T;T=SBIT(R[n])!=SBIT(ult); "}, + {"n","m","negc <REG_M>,<REG_N>", "0110nnnnmmmm1010", "ult=-T;T=ult>0;R[n]=ult-R[m];T|=R[n]>ult;"}, {"","","nop", "0000000000001001", ""}, {"n","m","not <REG_M>,<REG_N>", "0110nnnnmmmm0111", "R[n]=~R[m];"}, {"0","","or #<imm>,R0", "11001011i8*1....", "R0|=i;"}, @@ -187,8 +183,9 @@ op tab[] = {"n","n","sts.l MACL,@-<REG_N>", "0100nnnn00010010", "R[n]-=4;WLAT(R[n],MACL);"}, {"n","n","sts.l PR,@-<REG_N>", "0100nnnn00100010", "R[n]-=4;WLAT(R[n],PR);"}, {"n","nm","sub <REG_M>,<REG_N>", "0011nnnnmmmm1000", "R[n]-=R[m];"}, - {"n","nm","subc <REG_M>,<REG_N>", "0011nnnnmmmm1010", "ult=R[n]-T;T=ult>T;ult=ult-R[m];T=T|(ult>R[m]);R[n]=ult;"}, - {"n","nm","subv <REG_M>,<REG_N>", "0011nnnnmmmm1011", "abort();"}, +{"n","nm","subc <REG_M>,<REG_N>", "0011nnnnmmmm1010", "ult=R[n]-T;T=ult>R[n];R[n]=ult-R[m];T|=R[n]>ult;"}, + {"n","nm","subv <REG_M>,<REG_N>", "0011nnnnmmmm1011", + "ult = R[n] - R[m]; T = (((R[n] ^ R[m]) & (ult ^ R[n])) >> 31); R[n] = ult;"}, {"n","nm","swap.b <REG_M>,<REG_N>", "0110nnnnmmmm1000", "R[n]=((R[m]<<8)&0xff00)|((R[m]>>8)&0x00ff);"}, {"n","nm","swap.w <REG_M>,<REG_N>", "0110nnnnmmmm1001", "R[n]=((R[m]<<16)&0xffff0000)|((R[m]>>16)&0x00ffff);"}, {"","n","tas.b @<REG_N>", "0100nnnn00011011", "ult=RBAT(R[n]);T=ult==0;WBAT(R[n],ult|0x80);"}, @@ -205,11 +202,10 @@ op tab[] = {"n","n","dt <REG_N>", "0100nnnn00010000", "R[n]--; T=R[n] == 0;"}, {"","nm","dmuls.l <REG_M>,<REG_N>", "0011nnnnmmmm1101", "dmul(1,R[n],R[m]);"}, {"","nm","dmulu.l <REG_M>,<REG_N>", "0011nnnnmmmm0101", "dmul(0,R[n],R[m]);"}, - {"","nm","mac.l @<REG_M>+,@<REG_N>+", "0000nnnnmmmm1111", ""}, - + {"","nm","mac.l @<REG_M>+,@<REG_N>+", "0000nnnnmmmm1111", "abort();"}, + {"","n","braf <REG_N>", "0000nnnn00100011", "ult = PC; PC+=R[n]-2;SL(ult+2);"}, + {"","n","bsrf <REG_N>", "0000nnnn00000011", "PR = PC; PC+=R[n]-2;SL(PR+2);"}, #if 0 - {"braf @<REG_N>", "0000nnnn00100011", ""}, - {"bsrf @<REG_N>", "0000nnnn00000011", ""}, {"divs.l <REG_M>,<REG_N>", "0100nnnnmmmm1110", "divl(0,R[n],R[m]);"}, {"divu.l <REG_M>,<REG_N>", "0100nnnnmmmm1101", "divl(0,R[n],R[m]);"}, #endif |