diff options
Diffstat (limited to 'lib/IR/IRBuilder.cpp')
-rw-r--r-- | lib/IR/IRBuilder.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/IR/IRBuilder.cpp b/lib/IR/IRBuilder.cpp index a4c5d9766a2..5f63ded48fe 100644 --- a/lib/IR/IRBuilder.cpp +++ b/lib/IR/IRBuilder.cpp @@ -183,3 +183,29 @@ CallInst *IRBuilderBase::CreateAssumption(Value *Cond) { return createCallHelper(FnAssume, Ops, this); } +/// Create a call to a Masked Load intrinsic. +/// Ops - an array of operands. +CallInst *IRBuilderBase::CreateMaskedLoad(ArrayRef<Value *> Ops) { + // The only one overloaded type - the type of passthru value in this case + Type *DataTy = Ops[1]->getType(); + return CreateMaskedIntrinsic(Intrinsic::masked_load, Ops, DataTy); +} + +/// Create a call to a Masked Store intrinsic. +/// Ops - an array of operands. +CallInst *IRBuilderBase::CreateMaskedStore(ArrayRef<Value *> Ops) { + // DataTy - type of the data to be stored - the only one overloaded type + Type *DataTy = Ops[1]->getType(); + return CreateMaskedIntrinsic(Intrinsic::masked_store, Ops, DataTy); +} + +/// Create a call to a Masked intrinsic, with given intrinsic Id, +/// an array of operands - Ops, and one overloaded type - DataTy +CallInst *IRBuilderBase::CreateMaskedIntrinsic(unsigned Id, + ArrayRef<Value *> Ops, + Type *DataTy) { + Module *M = BB->getParent()->getParent(); + Type *OverloadedTypes[] = { DataTy }; + Value *TheFn = Intrinsic::getDeclaration(M, (Intrinsic::ID)Id, OverloadedTypes); + return createCallHelper(TheFn, Ops, this); +} |