Lines Matching refs:Builder
425 static Value *UpgradeX86PSLLDQIntrinsics(IRBuilder<> &Builder,
431 Type *VecTy = VectorType::get(Builder.getInt8Ty(), NumElts);
432 Op = Builder.CreateBitCast(Op, VecTy, "cast");
450 Res = Builder.CreateShuffleVector(Res, Op, makeArrayRef(Idxs, NumElts));
454 return Builder.CreateBitCast(Res, ResultTy, "cast");
459 static Value *UpgradeX86PSRLDQIntrinsics(IRBuilder<> &Builder, Value *Op,
465 Type *VecTy = VectorType::get(Builder.getInt8Ty(), NumElts);
466 Op = Builder.CreateBitCast(Op, VecTy, "cast");
484 Res = Builder.CreateShuffleVector(Op, Res, makeArrayRef(Idxs, NumElts));
488 return Builder.CreateBitCast(Res, ResultTy, "cast");
491 static Value *getX86MaskVec(IRBuilder<> &Builder, Value *Mask,
493 llvm::VectorType *MaskTy = llvm::VectorType::get(Builder.getInt1Ty(),
495 Mask = Builder.CreateBitCast(Mask, MaskTy);
503 Mask = Builder.CreateShuffleVector(Mask, Mask,
511 static Value *EmitX86Select(IRBuilder<> &Builder, Value *Mask,
518 Mask = getX86MaskVec(Builder, Mask, Op0->getType()->getVectorNumElements());
519 return Builder.CreateSelect(Mask, Op0, Op1);
522 static Value *UpgradeX86PALIGNRIntrinsics(IRBuilder<> &Builder,
554 Value *Align = Builder.CreateShuffleVector(Op1, Op0,
558 return EmitX86Select(Builder, Mask, Align, Passthru);
561 static Value *UpgradeMaskedStore(IRBuilder<> &Builder,
565 Ptr = Builder.CreateBitCast(Ptr,
573 return Builder.CreateAlignedStore(Data, Ptr, Align);
577 Mask = getX86MaskVec(Builder, Mask, NumElts);
578 return Builder.CreateMaskedStore(Data, Ptr, Align, Mask);
581 static Value *UpgradeMaskedLoad(IRBuilder<> &Builder,
585 Ptr = Builder.CreateBitCast(Ptr,
593 return Builder.CreateAlignedLoad(Ptr, Align);
597 Mask = getX86MaskVec(Builder, Mask, NumElts);
598 return Builder.CreateMaskedLoad(Ptr, Align, Mask, Passthru);
601 static Value *upgradeIntMinMax(IRBuilder<> &Builder, CallInst &CI,
605 Value *Cmp = Builder.CreateICmp(Pred, Op0, Op1);
606 return Builder.CreateSelect(Cmp, Op0, Op1);
609 static Value *upgradeMaskedCompare(IRBuilder<> &Builder, CallInst &CI,
613 Value *Cmp = Builder.CreateICmp(Pred, Op0, CI.getArgOperand(1));
618 Cmp = Builder.CreateAnd(Cmp, getX86MaskVec(Builder, Mask, NumElts));
626 Cmp = Builder.CreateShuffleVector(Cmp,
630 return Builder.CreateBitCast(Cmp, IntegerType::get(CI.getContext(),
639 IRBuilder<> Builder(C);
640 Builder.SetInsertPoint(CI->getParent(), CI->getIterator());
659 Rep = Builder.CreateICmpEQ(CI->getArgOperand(0), CI->getArgOperand(1),
661 Rep = Builder.CreateSExt(Rep, CI->getType(), "");
664 Rep = Builder.CreateICmpSGT(CI->getArgOperand(0), CI->getArgOperand(1),
666 Rep = Builder.CreateSExt(Rep, CI->getType(), "");
668 Rep = upgradeMaskedCompare(Builder, *CI, ICmpInst::ICMP_EQ);
670 Rep = upgradeMaskedCompare(Builder, *CI, ICmpInst::ICMP_SGT);
675 Rep = upgradeIntMinMax(Builder, *CI, ICmpInst::ICMP_SGT);
680 Rep = upgradeIntMinMax(Builder, *CI, ICmpInst::ICMP_UGT);
685 Rep = upgradeIntMinMax(Builder, *CI, ICmpInst::ICMP_SLT);
690 Rep = upgradeIntMinMax(Builder, *CI, ICmpInst::ICMP_ULT);
706 Rep = Builder.CreateShuffleVector(Rep, UndefValue::get(SrcTy),
712 Rep = Builder.CreateSIToFP(Rep, DstTy, "cvtdq2pd");
714 Rep = Builder.CreateFPExt(Rep, DstTy, "cvtps2pd");
720 Rep = Builder.CreateFPToSI(Src, DstTy, "cvtt");
735 Value *Addr = Builder.CreateBitCast(Arg0, EltPtrTy, "cast");
737 Builder.CreateExtractElement(Arg1, (uint64_t)0, "extractelement");
739 StoreInst *SI = Builder.CreateAlignedStore(Extract, Addr, 1);
757 Value *BC = Builder.CreateBitCast(Arg0,
761 StoreInst *SI = Builder.CreateAlignedStore(Arg1, BC,
773 Value *BC0 = Builder.CreateBitCast(Arg1, NewVecTy, "cast");
774 Value *Elt = Builder.CreateExtractElement(BC0, (uint64_t)0);
775 Value *BC = Builder.CreateBitCast(Arg0,
778 Builder.CreateAlignedStore(Elt, BC, 1);
789 Arg0 = Builder.CreateBitCast(Arg0,
792 Builder.CreateAlignedStore(Arg1, Arg0, 1);
802 UpgradeMaskedStore(Builder, CI->getArgOperand(0), CI->getArgOperand(1),
813 UpgradeMaskedStore(Builder, CI->getArgOperand(0), CI->getArgOperand(1),
824 Rep = UpgradeMaskedLoad(Builder, CI->getArgOperand(0),
832 Rep = UpgradeMaskedLoad(Builder, CI->getArgOperand(0),
879 Builder.CreateCall(VPCOM, {CI->getArgOperand(0), CI->getArgOperand(1),
880 Builder.getInt8(Imm)});
886 Constant *MinusOne = ConstantVector::getSplat(NumElts, Builder.getInt64(-1));
887 Value *NotSel = Builder.CreateXor(Sel, MinusOne);
888 Value *Sel0 = Builder.CreateAnd(Arg0, Sel);
889 Value *Sel1 = Builder.CreateAnd(Arg1, NotSel);
890 Rep = Builder.CreateOr(Sel0, Sel1);
894 Value *Trunc0 = Builder.CreateTrunc(CI->getArgOperand(0), Type::getInt32Ty(C));
895 Rep = Builder.CreateCall(CRC32, {Trunc0, CI->getArgOperand(1)});
896 Rep = Builder.CreateZExt(Rep, CI->getType(), "");
902 Value *Cast = Builder.CreateBitCast(CI->getArgOperand(0),
904 Value *Load = Builder.CreateLoad(EltTy, Cast);
908 Rep = Builder.CreateInsertElement(Rep, Load,
923 Value *SV = Builder.CreateShuffleVector(
927 Rep = DoSext ? Builder.CreateSExt(SV, DstTy)
928 : Builder.CreateZExt(SV, DstTy);
932 Value *Op = Builder.CreatePointerCast(CI->getArgOperand(0),
934 Value *Load = Builder.CreateLoad(VT, Op);
936 Rep = Builder.CreateShuffleVector(Load, UndefValue::get(Load->getType()),
946 Rep = Builder.CreateShuffleVector(Op, UndefValue::get(Op->getType()),
950 Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep,
953 Rep = UpgradeX86PALIGNRIntrinsics(Builder, CI->getArgOperand(0),
962 Rep = UpgradeX86PSLLDQIntrinsics(Builder, CI->getArgOperand(0),
968 Rep = UpgradeX86PSRLDQIntrinsics(Builder, CI->getArgOperand(0),
975 Rep = UpgradeX86PSLLDQIntrinsics(Builder, CI->getArgOperand(0), Shift);
981 Rep = UpgradeX86PSRLDQIntrinsics(Builder, CI->getArgOperand(0), Shift);
997 Rep = Builder.CreateShuffleVector(Op0, Op1, Idxs);
1014 Rep = Builder.CreateShuffleVector(Op1, UndefV, Idxs);
1035 Rep = Builder.CreateShuffleVector(Op0, Rep, Idxs);
1053 Rep = Builder.CreateShuffleVector(Op0, UndefV, Idxs);
1067 Rep = Builder.CreateShuffleVector(Op0, Op0, Idxs);
1070 Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
1091 Rep = Builder.CreateShuffleVector(Op0, Op0, Idxs);
1094 Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
1110 Rep = Builder.CreateShuffleVector(Op0, Op0, Idxs);
1113 Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
1129 Rep = Builder.CreateShuffleVector(Op0, Op0, Idxs);
1132 Rep = EmitX86Select(Builder
1152 Rep = Builder.CreateShuffleVector(Op0, Op0, Idxs);
1154 Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep,
1168 Rep = Builder.CreateShuffleVector(Op0, Op1, Idxs);
1170 Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
1184 Rep = Builder.CreateShuffleVector(Op0, Op1, Idxs);
1186 Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
1189 Rep = Builder.CreateAnd(CI->getArgOperand(0), CI->getArgOperand(1));
1190 Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
1193 Rep = Builder.CreateAnd(Builder.CreateNot(CI->getArgOperand(0)),
1195 Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
1198 Rep = Builder.CreateOr(CI->getArgOperand(0), CI->getArgOperand(1));
1199 Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
1202 Rep = Builder.CreateXor(CI->getArgOperand(0), CI->getArgOperand(1));
1203 Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
1245 CI->replaceAllUsesWith(Builder.CreateCall(NewFn, Args));
1254 CI->replaceAllUsesWith(Builder.CreateCall(
1255 NewFn, {CI->getArgOperand(0), Builder.getFalse()}, Name));
1260 CI->replaceAllUsesWith(Builder.CreateCall(
1266 CI->replaceAllUsesWith(Builder.CreateCall(NewFn, {CI->getArgOperand(0)}));
1274 Builder.CreateCall(NewFn, {CI->getArgOperand(1)}, Name));
1286 Args[2] = Builder.CreateBitCast(Args[2], IntIdxTy);
1287 CI->replaceAllUsesWith(Builder.CreateCall(NewFn, Args, Name));
1308 Value *BC0 = Builder.CreateBitCast(Arg0, NewVecTy, "cast");
1309 Value *BC1 = Builder.CreateBitCast(Arg1, NewVecTy, "cast");
1311 CallInst *NewCall = Builder.CreateCall(NewFn, {BC0, BC1}, Name);
1329 Args.back() = Builder.CreateTrunc(Args.back(), Type::getInt8Ty(C), "trunc");
1331 CallInst *NewCall = Builder.CreateCall(NewFn, Args);
1338 CI->replaceAllUsesWith(Builder.CreateCall(NewFn, {}));
1347 CI->replaceAllUsesWith(Builder.CreateCall(NewFn, Args));