fresx and some vec128 constant prop.

This commit is contained in:
Ben Vanik 2015-03-25 19:16:30 -07:00
parent 55ef84bf21
commit 6bf84d832f
2 changed files with 22 additions and 2 deletions

View File

@ -114,8 +114,18 @@ XEEMITTER(fmulsx, 0xEC000032, A)(PPCHIRBuilder& f, InstrData& i) {
} }
XEEMITTER(fresx, 0xEC000030, A)(PPCHIRBuilder& f, InstrData& i) { XEEMITTER(fresx, 0xEC000030, A)(PPCHIRBuilder& f, InstrData& i) {
XEINSTRNOTIMPLEMENTED(); // frD <- 1.0 / (frB)
return 1; Value* v = f.Convert(
f.Div(f.LoadConstant(1.0f), f.Convert(f.LoadFPR(i.A.FRB), FLOAT32_TYPE)),
FLOAT64_TYPE);
f.StoreFPR(i.A.FRT, v);
// f.UpdateFPRF(v);
if (i.A.Rc) {
// e.update_cr_with_cond(1, v);
XEINSTRNOTIMPLEMENTED();
return 1;
}
return 0;
} }
XEEMITTER(frsqrtex, 0xFC000034, A)(PPCHIRBuilder& f, InstrData& i) { XEEMITTER(frsqrtex, 0xFC000034, A)(PPCHIRBuilder& f, InstrData& i) {

View File

@ -357,6 +357,11 @@ void Value::Neg() {
case FLOAT64_TYPE: case FLOAT64_TYPE:
constant.f64 = -constant.f64; constant.f64 = -constant.f64;
break; break;
case VEC128_TYPE:
for (int i = 0; i < 4; ++i) {
constant.v128.f32[i] = -constant.v128.f32[i];
}
break;
default: default:
assert_unhandled_case(type); assert_unhandled_case(type);
break; break;
@ -383,6 +388,11 @@ void Value::Abs() {
case FLOAT64_TYPE: case FLOAT64_TYPE:
constant.f64 = abs(constant.f64); constant.f64 = abs(constant.f64);
break; break;
case VEC128_TYPE:
for (int i = 0; i < 4; ++i) {
constant.v128.f32[i] = std::fabsf(constant.v128.f32[i]);
}
break;
default: default:
assert_unhandled_case(type); assert_unhandled_case(type);
break; break;