mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Masked Vector Load and Store Intrinsics.
Introduced new target-independent intrinsics in order to support masked vector loads and stores. The loop vectorizer optimizes loops containing conditional memory accesses by generating these intrinsics for existing targets AVX2 and AVX-512. The vectorizer asks the target about availability of masked vector loads and stores. Added SDNodes for masked operations and lowering patterns for X86 code generator. Examples: <16 x i32> @llvm.masked.load.v16i32(i8* %addr, <16 x i32> %passthru, i32 4 /* align */, <16 x i1> %mask) declare void @llvm.masked.store.v8f64(i8* %addr, <8 x double> %value, i32 4, <8 x i1> %mask) Scalarizer for other targets (not AVX2/AVX-512) will be done in a separate patch. http://reviews.llvm.org/D6191 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222632 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user