tcg/ppc32: proper setcond implementation

Signed-off-by: malc <av1474@comtv.ru>
This commit is contained in:
malc 2010-02-07 02:48:48 +03:00
parent b0809bf7ca
commit 27a7797b09

View File

@ -1147,7 +1147,7 @@ static void tcg_out_setcond (TCGContext *s, int cond, TCGArg arg0,
| ME (31) | ME (31)
) )
); );
return; break;
case TCG_COND_NE: case TCG_COND_NE:
if (const_arg2) { if (const_arg2) {
@ -1178,36 +1178,31 @@ static void tcg_out_setcond (TCGContext *s, int cond, TCGArg arg0,
tcg_out32 (s, ADDIC | RT (arg0) | RA (arg) | 0xffff); tcg_out32 (s, ADDIC | RT (arg0) | RA (arg) | 0xffff);
tcg_out32 (s, SUBFE | TAB (arg0, arg0, arg)); tcg_out32 (s, SUBFE | TAB (arg0, arg0, arg));
} }
return;
case TCG_COND_LTU:
case TCG_COND_LT:
sh = 29;
crop = 0;
break; break;
case TCG_COND_GEU:
case TCG_COND_GE:
sh = 31;
crop = CRNOR | BT (7, CR_EQ) | BA (7, CR_LT) | BB (7, CR_LT);
break;
case TCG_COND_LEU:
case TCG_COND_LE:
sh = 31;
crop = CRNOR | BT (7, CR_EQ) | BA (7, CR_GT) | BB (7, CR_GT);
break;
case TCG_COND_GTU:
case TCG_COND_GT: case TCG_COND_GT:
case TCG_COND_GTU:
sh = 30; sh = 30;
crop = 0; crop = 0;
break; goto crtest;
default: case TCG_COND_LT:
tcg_abort (); case TCG_COND_LTU:
} sh = 29;
crop = 0;
goto crtest;
case TCG_COND_GE:
case TCG_COND_GEU:
sh = 31;
crop = CRNOR | BT (7, CR_EQ) | BA (7, CR_LT) | BB (7, CR_LT);
goto crtest;
case TCG_COND_LE:
case TCG_COND_LEU:
sh = 31;
crop = CRNOR | BT (7, CR_EQ) | BA (7, CR_GT) | BB (7, CR_GT);
crtest:
tcg_out_cmp (s, cond, arg1, arg2, const_arg2, 7); tcg_out_cmp (s, cond, arg1, arg2, const_arg2, 7);
if (crop) tcg_out32 (s, crop); if (crop) tcg_out32 (s, crop);
tcg_out32 (s, MFCR | RT (0)); tcg_out32 (s, MFCR | RT (0));
@ -1219,6 +1214,11 @@ static void tcg_out_setcond (TCGContext *s, int cond, TCGArg arg0,
| ME (31) | ME (31)
) )
); );
break;
default:
tcg_abort ();
}
} }
static void tcg_out_setcond2 (TCGContext *s, const TCGArg *args, static void tcg_out_setcond2 (TCGContext *s, const TCGArg *args,