29 ScalableMaskedAddIIntrOp>;
32 ScalableMaskedAddFIntrOp>;
35 ScalableMaskedSubIIntrOp>;
38 ScalableMaskedSubFIntrOp>;
41 ScalableMaskedMulIIntrOp>;
44 ScalableMaskedMulFIntrOp>;
47 ScalableMaskedSDivIIntrOp>;
50 ScalableMaskedUDivIIntrOp>;
53 ScalableMaskedDivFIntrOp>;
76 template <
typename Op,
typename IntrOp>
81 matchAndRewrite(
Op convertOp,
typename Op::Adaptor,
83 auto loc = convertOp.
getLoc();
85 auto source = convertOp.getSource();
86 VectorType sourceType = source.getType();
87 VectorType resultType = convertOp.getResult().getType();
96 tileShape.back() = sourceType.getShape().back();
101 auto extractOrInsertPosition =
ArrayRef(index).drop_back();
102 auto sourceVector = rewriter.
create<vector::ExtractOp>(
103 loc, source, extractOrInsertPosition);
104 VectorType convertedType =
106 .
setDim(0, resultType.getShape().back());
107 auto convertedVector =
109 result = rewriter.
create<vector::InsertOp>(loc, convertedVector, result,
110 extractOrInsertPosition);
118 using ConvertToSvboolOpLowering =
119 SvboolConversionOpLowering<ConvertToSvboolOp, ConvertToSvboolIntrOp>;
121 using ConvertFromSvboolOpLowering =
122 SvboolConversionOpLowering<ConvertFromSvboolOp, ConvertFromSvboolIntrOp>;
133 matchAndRewrite(PselOp pselOp, PselOp::Adaptor adaptor,
136 auto loc = pselOp.getLoc();
137 auto svboolP1 = rewriter.
create<ConvertToSvboolIntrOp>(loc, svboolType,
139 auto indexI32 = rewriter.
create<arith::IndexCastOp>(
140 loc, rewriter.
getI32Type(), pselOp.getIndex());
141 auto pselIntr = rewriter.
create<PselIntrOp>(loc, svboolType, svboolP1,
142 pselOp.getP2(), indexI32);
144 pselOp, adaptor.getP1().getType(), pselIntr);
156 struct CreateMaskOpLowering
161 matchAndRewrite(vector::CreateMaskOp createMaskOp,
162 vector::CreateMaskOp::Adaptor adaptor,
164 auto maskType = createMaskOp.getVectorType();
165 if (maskType.getRank() != 1 || !maskType.isScalable())
169 auto maskBaseSize = maskType.getDimSize(0);
170 if (maskBaseSize < 2 || maskBaseSize > 16 ||
171 !llvm::isPowerOf2_32(uint32_t(maskBaseSize)))
173 "not SVE predicate-sized");
175 auto loc = createMaskOp.getLoc();
178 adaptor.getOperands()[0]);
204 ConvertToSvboolOpLowering,
205 ConvertFromSvboolOpLowering,
208 PselOpLowering>(converter);
211 patterns.add<CreateMaskOpLowering>(converter, 4096);
222 ScalableMaskedAddIIntrOp,
223 ScalableMaskedAddFIntrOp,
224 ScalableMaskedSubIIntrOp,
225 ScalableMaskedSubFIntrOp,
226 ScalableMaskedMulIIntrOp,
227 ScalableMaskedMulFIntrOp,
228 ScalableMaskedSDivIIntrOp,
229 ScalableMaskedUDivIIntrOp,
230 ScalableMaskedDivFIntrOp,
231 ConvertToSvboolIntrOp,
232 ConvertFromSvboolIntrOp,
241 ScalableMaskedAddIOp,
242 ScalableMaskedAddFOp,
243 ScalableMaskedSubIOp,
244 ScalableMaskedSubFOp,
245 ScalableMaskedMulIOp,
246 ScalableMaskedMulFOp,
247 ScalableMaskedSDivIOp,
248 ScalableMaskedUDivIOp,
249 ScalableMaskedDivFOp,
TypedAttr getZeroAttr(Type type)
This class implements a pattern rewriter for use with ConversionPatterns.
void replaceOp(Operation *op, ValueRange newValues) override
Replace the given operation with the new values.
void addLegalOp(OperationName op)
Register the given operations as legal.
void addIllegalOp(OperationName op)
Register the given operation as illegal, i.e.
Utility class for operation conversions targeting the LLVM dialect that match exactly one source oper...
ConvertOpToLLVMPattern(const LLVMTypeConverter &typeConverter, PatternBenefit benefit=1)
Derived class that automatically populates legalization information for different LLVM ops.
Conversion from types to the LLVM IR dialect.
Generic implementation of one-to-one conversion from "SourceOp" to "TargetOp" where the latter belong...
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
Location getLoc()
The source location the operation was defined or derived from.
This provides public APIs that all operations should have.
std::enable_if_t<!std::is_convertible< CallbackT, Twine >::value, LogicalResult > notifyMatchFailure(Location loc, CallbackT &&reasonCallback)
Used to notify the listener that the IR failed to be rewritten because of a match failure,...
OpTy replaceOpWithNewOp(Operation *op, Args &&...args)
Replace the results of the given (original) op with a new op that is created without verification (re...
A range-style iterator that allows for iterating over the offsets of all potential tiles of size tile...
This class provides an abstraction over the various different ranges of value types.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
This is a builder type that keeps local references to arguments.
Builder & setDim(unsigned pos, int64_t val)
Set a dim in shape @pos to val.
Include the generated interface declarations.
void configureArmSVELegalizeForExportTarget(LLVMConversionTarget &target)
Configure the target to support lowering ArmSVE ops to ops that map to LLVM intrinsics.
const FrozenRewritePatternSet & patterns
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
void populateArmSVELegalizeForLLVMExportPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns)
Collect a set of patterns to lower ArmSVE ops to ops that map to LLVM intrinsics.