Mercurial > hg > CbC > old > device
diff mc-code-powerpc.c @ 291:7b6df595b205
ia32 code_bool.
author | kono |
---|---|
date | Fri, 04 Jun 2004 03:32:19 +0900 |
parents | 55e611476cba |
children | 6d4231b6f9fe |
line wrap: on
line diff
--- a/mc-code-powerpc.c Thu Jun 03 21:10:46 2004 +0900 +++ b/mc-code-powerpc.c Fri Jun 04 03:32:19 2004 +0900 @@ -1372,7 +1372,7 @@ static void inc_cmpflag() { - cmpflag = (cmpflag+1)%7; + cmpflag = (cmpflag+1)%8; } void @@ -1384,6 +1384,7 @@ r = get_ptr_cache((NMTBL*)cadr(e1)); printf("\t%s %s,0(%s)\n",cload(sz),crn,register_name(r)); cext(0,sz,r); + inc_cmpflag(); printf("\tcmpwi cr%d,%s,0\n",cmpflag,crn); jcond(label,cond); } @@ -1429,6 +1430,7 @@ void code_cmp_register(int e2,int label,int cond) { use_int(e2); + inc_cmpflag(); printf("\tcmpwi cr%d,%s,0\n",cmpflag,register_name(e2)); jcond(label,cond); } @@ -2413,9 +2415,11 @@ printf("\tsub %s,%s,%s\n",crn,crn,orn); break; case CMP: + inc_cmpflag(); printf("\tcmpw cr%d,%s,%s\n",cmpflag,crn,orn); break; case UCMP: + inc_cmpflag(); printf("\tcmplw cr%d,%s,%s\n",cmpflag,crn,orn); break; case BAND: @@ -2495,6 +2499,7 @@ printf("\taddi %s,%s,lo16(-%d)\n",crn,crn,v); break; case CMP: + inc_cmpflag(); printf("\tcmpwi cr%d,%s,lo16(%d)\n",cmpflag,crn,v); break; case EOR: @@ -2546,8 +2551,13 @@ { /* used in dosiwtch() */ if(chk) return; - printf("\tcmpwi cr%d,%s,%d\n",cmpflag,register_name(csreg),e); - jcond(label,cond); + inc_cmpflag(); + if (-32767<e&&e<32767) { + printf("\tcmpwi cr%d,%s,%d\n",cmpflag,register_name(csreg),e); + jcond(label,cond); + } else { + error(-1); /* !? */ + } } void @@ -3112,6 +3122,7 @@ r = get_ptr_cache(&float_zero); rrn = register_name(r); printf("\tlfs %s,0(%s)\n",grn,rrn); + inc_cmpflag(); printf("\tfcmpu cr%d,%s,%s\n",cmpflag,grn,frn); free_register(greg); jcond(label,cond); @@ -3433,6 +3444,7 @@ r = get_ptr_cache((NMTBL*)cadr(e2)); printf("\t%s %s,0(%s)\n",fload(1),grn,register_name(r)); + inc_cmpflag(); printf("\tfcmpu cr%d,%s,%s\n",cmpflag,frn,grn); free_register(g); jcond(label,cond); @@ -3450,6 +3462,7 @@ lvar_intro(e2); printf("\t%s %s,",fload(1),grn); lvar(e2); + inc_cmpflag(); printf("\tfcmpu cr%d,%s,%s\n",cmpflag,frn,grn); free_register(g); jcond(label,cond); @@ -3485,11 +3498,13 @@ case DMUL: opn="fmul"; break; case FCMP: case DCMP: + inc_cmpflag(); printf("\tfcmpu cr%d,%s,%s\n",cmpflag,frn,grn); if (ox!=-1) free_register(ox); return; case FCMPGE: case DCMPGE: + inc_cmpflag(); printf("\tfcmpu cr%d,%s,%s\n",cmpflag,frn,grn); if (ox!=-1) free_register(ox); return; @@ -3766,9 +3781,8 @@ op1 = lcmp(op,cond); tosop(op1,regv_h(e3),regv_h(reg)); cr0 = cmpflag; - inc_cmpflag(); + tosop(op1,regv_l(e3),regv_l(reg)); cr1 = cmpflag; - tosop(op1,regv_l(e3),regv_l(reg)); l2 = fwdlabel(); // cond==0 jump on false condtion ( if(x) => rexpr(.. cond=0 ...) ) @@ -3835,6 +3849,7 @@ lregister_name_low(reg), lregister_name_low(reg), lregister_name_high(reg)); + inc_cmpflag(); printf("\tcmpwi cr%d,%s,0\n",cmpflag,lregister_name_low(reg)); jcond(label,cond); }