PPC: Support NaN in fcmp[o/u]x.

This commit is contained in:
Dr. Chat 2017-05-14 00:24:35 -05:00
parent eff9ba31d2
commit 66dbd86989
1 changed files with 13 additions and 1 deletions

View File

@ -303,7 +303,19 @@ int InstrEmit_fcmpx_(PPCHIRBuilder& f, const InstrData& i, bool ordered) {
// TODO(benvanik): update FPCC for mffsx/etc
// TODO(benvanik): update VXSNAN
const uint32_t crf = i.X.RT >> 2;
f.UpdateCR(crf, f.LoadFPR(i.X.RA), f.LoadFPR(i.X.RB));
Value* ra = f.LoadFPR(i.X.RA);
Value* rb = f.LoadFPR(i.X.RB);
Value* nan = f.Or(f.IsNan(ra), f.IsNan(rb));
f.StoreContext(offsetof(PPCContext, cr0) + (4 * crf) + 3, nan);
Value* not_nan = f.Xor(nan, f.LoadConstantInt8(0x01));
Value* lt = f.And(not_nan, f.CompareSLT(ra, rb));
f.StoreContext(offsetof(PPCContext, cr0) + (4 * crf) + 0, lt);
Value* gt = f.And(not_nan, f.CompareSGT(ra, rb));
f.StoreContext(offsetof(PPCContext, cr0) + (4 * crf) + 1, gt);
Value* eq = f.And(not_nan, f.CompareEQ(ra, rb));
f.StoreContext(offsetof(PPCContext, cr0) + (4 * crf) + 2, eq);
return 0;
}
int InstrEmit_fcmpo(PPCHIRBuilder& f, const InstrData& i) {