Fix inverted TEST

Remove sign extend when loading int32
This commit is contained in:
Magnus Norddahl 2020-06-08 04:29:16 +02:00
parent 5112f5ae80
commit 31a603bd56
2 changed files with 4 additions and 4 deletions

View file

@ -6,7 +6,7 @@ void JitCompiler::EmitTEST()
int i = (int)(ptrdiff_t)(pc - sfunc->Code);
auto continuebb = irfunc->createBasicBlock({});
cc.CreateCondBr(cc.CreateICmpEQ(LoadD(A), ConstValueD(BC)), GetLabel(i + 2), continuebb);
cc.CreateCondBr(cc.CreateICmpNE(LoadD(A), ConstValueD(BC)), GetLabel(i + 2), continuebb);
cc.SetInsertPoint(continuebb);
}
@ -16,7 +16,7 @@ void JitCompiler::EmitTESTN()
int i = (int)(ptrdiff_t)(pc - sfunc->Code);
auto continuebb = irfunc->createBasicBlock({});
cc.CreateCondBr(cc.CreateICmpEQ(LoadD(A), ConstValueD(-bc)), GetLabel(i + 2), continuebb);
cc.CreateCondBr(cc.CreateICmpNE(LoadD(A), ConstValueD(-bc)), GetLabel(i + 2), continuebb);
cc.SetInsertPoint(continuebb);
}

View file

@ -114,13 +114,13 @@ void JitCompiler::EmitLH_R()
void JitCompiler::EmitLW()
{
EmitNullPointerThrow(B, X_READ_NIL);
StoreD(SExt(Load(ToInt32Ptr(LoadA(B), ConstD(C)))), A);
StoreD(Load(ToInt32Ptr(LoadA(B), ConstD(C))), A);
}
void JitCompiler::EmitLW_R()
{
EmitNullPointerThrow(B, X_READ_NIL);
StoreD(SExt(Load(ToInt32Ptr(LoadA(B), LoadD(C)))), A);
StoreD(Load(ToInt32Ptr(LoadA(B), LoadD(C))), A);
}
void JitCompiler::EmitLBU()