MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / compileVectorShiftOp

Method compileVectorShiftOp

lib/llvm/compiler.cpp:4854–4864  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4852 }
4853 template <typename Func>
4854 void compileVectorShiftOp(LLVM::Type VectorTy, Func &&Op) noexcept {
4855 const bool Trunc = VectorTy.getElementType().getIntegerBitWidth() < 32;
4856 const uint32_t Mask = VectorTy.getElementType().getIntegerBitWidth() - 1;
4857 auto N = Builder.createAnd(stackPop(), LLContext.getInt32(Mask));
4858 auto RHS = Builder.createVectorSplat(
4859 VectorTy.getVectorSize(),
4860 Trunc ? Builder.createTrunc(N, VectorTy.getElementType())
4861 : Builder.createZExtOrTrunc(N, VectorTy.getElementType()));
4862 auto LHS = Builder.createBitCast(stackPop(), VectorTy);
4863 stackPush(Builder.createBitCast(Op(LHS, RHS), Context.Int64x2Ty));
4864 }
4865 void compileVectorShl(LLVM::Type VectorTy) noexcept {
4866 compileVectorShiftOp(VectorTy, [this](auto LHS, auto RHS) noexcept {
4867 return Builder.createShl(LHS, RHS);

Callers

nothing calls this directly

Calls 9

getIntegerBitWidthMethod · 0.80
getElementTypeMethod · 0.80
createAndMethod · 0.80
getInt32Method · 0.80
createVectorSplatMethod · 0.80
getVectorSizeMethod · 0.80
createTruncMethod · 0.80
createZExtOrTruncMethod · 0.80
createBitCastMethod · 0.80

Tested by

no test coverage detected