| 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); |
nothing calls this directly
no test coverage detected