本文整理汇总了C++中IRBuilder::CreateZExt方法的典型用法代码示例。如果您正苦于以下问题:C++ IRBuilder::CreateZExt方法的具体用法?C++ IRBuilder::CreateZExt怎么用?C++ IRBuilder::CreateZExt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRBuilder
的用法示例。
在下文中一共展示了IRBuilder::CreateZExt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: equalizeTypes
void equalizeTypes(Value* &Op1, Value* &Op2, bool isSigned, IRBuilder<> Builder){
if (Op1->getType() != Op2->getType()) {
if (Op1->getType()->getIntegerBitWidth() > Op2->getType()->getIntegerBitWidth() ) {
//expand op2
if (isSigned) Op2 = Builder.CreateSExt(Op2, Op1->getType(), "");
else Op2 = Builder.CreateZExt(Op2, Op1->getType(), "");
} else {
//expand op1
if (isSigned) Op1 = Builder.CreateSExt(Op1, Op2->getType(), "");
else Op1 = Builder.CreateZExt(Op1, Op2->getType(), "");
}
}
}
示例2: make_pair
static std::pair<Value*, Value*> getMul64(IRBuilder<> &Builder,
Value *LHS, Value *RHS) {
Type *I32Ty = Builder.getInt32Ty();
Type *I64Ty = Builder.getInt64Ty();
Value *LHS_EXT64 = Builder.CreateZExt(LHS, I64Ty);
Value *RHS_EXT64 = Builder.CreateZExt(RHS, I64Ty);
Value *MUL64 = Builder.CreateMul(LHS_EXT64, RHS_EXT64);
Value *Lo = Builder.CreateTrunc(MUL64, I32Ty);
Value *Hi = Builder.CreateLShr(MUL64, Builder.getInt64(32));
Hi = Builder.CreateTrunc(Hi, I32Ty);
return std::make_pair(Lo, Hi);
}