Skip to content

Commit

Permalink
Clean up EmitSBIT slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
dpjudas committed Jun 11, 2020
1 parent 1e82cf8 commit 4ed578e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/common/scripting/jit/jit_store.cpp
Expand Up @@ -139,19 +139,21 @@ void JitCompiler::EmitSBIT()
{
EmitNullPointerThrow(A, X_WRITE_NIL);

IRValue* ptr = LoadA(A);
IRValue* value = cc.CreateLoad(ptr);

IRBasicBlock* ifbb = irfunc->createBasicBlock({});
IRBasicBlock* elsebb = irfunc->createBasicBlock({});
IRBasicBlock* endbb = irfunc->createBasicBlock({});

cc.CreateCondBr(cc.CreateICmpNE(LoadD(B), ConstValueD(0)), ifbb, elsebb);

cc.SetInsertPoint(ifbb);
cc.CreateStore(cc.CreateOr(value, ircontext->getConstantInt(int8Ty, (int)C)), ptr);
IRValue* ptr = LoadA(A);
Store(cc.CreateOr(Load(ptr), ircontext->getConstantInt(int8Ty, (int)C)), ptr);
cc.CreateBr(endbb);

cc.SetInsertPoint(elsebb);
cc.CreateStore(cc.CreateAnd(value, ircontext->getConstantInt(int8Ty, ~(int)C)), ptr);
ptr = LoadA(A);
Store(cc.CreateAnd(Load(ptr), ircontext->getConstantInt(int8Ty, ~(int)C)), ptr);
cc.CreateBr(endbb);

cc.SetInsertPoint(endbb);
}

0 comments on commit 4ed578e

Please sign in to comment.