Dont constant evaluate MAX with V128!
Fix signed zeroes behavior for vmaxfp emulation, was causing a block in sonic to move perpetually, very slowly
This commit is contained in:
parent
457296850e
commit
d85bfc1894
|
@ -549,12 +549,12 @@ struct MAX_F64 : Sequence<MAX_F64, I<OPCODE_MAX, F64Op, F64Op, F64Op>> {
|
||||||
struct MAX_V128 : Sequence<MAX_V128, I<OPCODE_MAX, V128Op, V128Op, V128Op>> {
|
struct MAX_V128 : Sequence<MAX_V128, I<OPCODE_MAX, V128Op, V128Op, V128Op>> {
|
||||||
static void Emit(X64Emitter& e, const EmitArgType& i) {
|
static void Emit(X64Emitter& e, const EmitArgType& i) {
|
||||||
e.ChangeMxcsrMode(MXCSRMode::Vmx);
|
e.ChangeMxcsrMode(MXCSRMode::Vmx);
|
||||||
|
//if 0 and -0, return 0! opposite of minfp
|
||||||
auto src1 = GetInputRegOrConstant(e, i.src1, e.xmm0);
|
auto src1 = GetInputRegOrConstant(e, i.src1, e.xmm0);
|
||||||
auto src2 = GetInputRegOrConstant(e, i.src2, e.xmm1);
|
auto src2 = GetInputRegOrConstant(e, i.src2, e.xmm1);
|
||||||
e.vmaxps(e.xmm2, src1, src2);
|
e.vmaxps(e.xmm2, src1, src2);
|
||||||
e.vmaxps(e.xmm3, src2, src1);
|
e.vmaxps(e.xmm3, src2, src1);
|
||||||
e.vorps(i.dest, e.xmm2, e.xmm3);
|
e.vandps(i.dest, e.xmm2, e.xmm3);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
EMITTER_OPCODE_TABLE(OPCODE_MAX, MAX_F32, MAX_F64, MAX_V128);
|
EMITTER_OPCODE_TABLE(OPCODE_MAX, MAX_F32, MAX_F64, MAX_V128);
|
||||||
|
|
|
@ -600,6 +600,9 @@ bool ConstantPropagationPass::Run(HIRBuilder* builder, bool& result) {
|
||||||
break;
|
break;
|
||||||
case OPCODE_MAX:
|
case OPCODE_MAX:
|
||||||
if (i->src1.value->IsConstant() && i->src2.value->IsConstant()) {
|
if (i->src1.value->IsConstant() && i->src2.value->IsConstant()) {
|
||||||
|
if (should_skip_because_of_float) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
v->set_from(i->src1.value);
|
v->set_from(i->src1.value);
|
||||||
v->Max(i->src2.value);
|
v->Max(i->src2.value);
|
||||||
i->Remove();
|
i->Remove();
|
||||||
|
|
Loading…
Reference in New Issue