diff --git a/libevmjit/Compiler.cpp b/libevmjit/Compiler.cpp index dd9224216..1ce63d8ec 100644 --- a/libevmjit/Compiler.cpp +++ b/libevmjit/Compiler.cpp @@ -456,14 +456,15 @@ void Compiler::compileBasicBlock(BasicBlock& _basicBlock, bytes const& _bytecode // test for word >> (k * 8 + 7) auto bitpos = m_builder.CreateAdd(k32x8, m_builder.getInt64(7), "bitpos"); - auto bittester = m_builder.CreateShl(Constant::get(1), bitpos); + auto bitposEx = m_builder.CreateZExt(bitpos, Type::Word); + auto bittester = m_builder.CreateShl(Constant::get(1), bitposEx); auto bitresult = m_builder.CreateAnd(word, bittester); auto bittest = m_builder.CreateICmpUGT(bitresult, Constant::get(0)); // FIXME: The following does not work - LLVM bug, report! //auto bitval = m_builder.CreateLShr(word, bitpos, "bitval"); //auto bittest = m_builder.CreateTrunc(bitval, Type::Bool, "bittest"); - auto mask_ = m_builder.CreateShl(Constant::get(1), bitpos); + auto mask_ = m_builder.CreateShl(Constant::get(1), bitposEx); auto mask = m_builder.CreateSub(mask_, Constant::get(1), "mask"); auto negmask = m_builder.CreateXor(mask, llvm::ConstantInt::getAllOnesValue(Type::Word), "negmask");