32 ScalableMaskedAddIIntrOp>;
35 ScalableMaskedAddFIntrOp>;
38 ScalableMaskedSubIIntrOp>;
41 ScalableMaskedSubFIntrOp>;
44 ScalableMaskedMulIIntrOp>;
47 ScalableMaskedMulFIntrOp>;
50 ScalableMaskedSDivIIntrOp>;
53 ScalableMaskedUDivIIntrOp>;
56 ScalableMaskedDivFIntrOp>;
79 template <
typename Op,
typename IntrOp>
84 matchAndRewrite(
Op convertOp,
typename Op::Adaptor,
86 auto loc = convertOp.
getLoc();
88 auto source = convertOp.getSource();
89 VectorType sourceType = source.getType();
90 VectorType resultType = convertOp.getResult().getType();
99 tileShape.back() = sourceType.getShape().back();
104 auto extractOrInsertPosition =
ArrayRef(index).drop_back();
105 auto sourceVector = rewriter.
create<vector::ExtractOp>(
106 loc, source, extractOrInsertPosition);
107 VectorType convertedType =
109 .
setDim(0, resultType.getShape().back());
110 auto convertedVector =
112 result = rewriter.
create<vector::InsertOp>(loc, convertedVector, result,
113 extractOrInsertPosition);
121 using ConvertToSvboolOpLowering =
122 SvboolConversionOpLowering<ConvertToSvboolOp, ConvertToSvboolIntrOp>;
124 using ConvertFromSvboolOpLowering =
125 SvboolConversionOpLowering<ConvertFromSvboolOp, ConvertFromSvboolIntrOp>;
136 matchAndRewrite(PselOp pselOp, PselOp::Adaptor adaptor,
139 auto loc = pselOp.getLoc();
140 auto svboolP1 = rewriter.
create<ConvertToSvboolIntrOp>(loc, svboolType,
142 auto indexI32 = rewriter.
create<arith::IndexCastOp>(
143 loc, rewriter.
getI32Type(), pselOp.getIndex());
144 auto pselIntr = rewriter.
create<PselIntrOp>(loc, svboolType, svboolP1,
145 pselOp.getP2(), indexI32);
147 pselOp, adaptor.getP1().getType(), pselIntr);
159 struct CreateMaskOpLowering
164 matchAndRewrite(vector::CreateMaskOp createMaskOp,
165 vector::CreateMaskOp::Adaptor adaptor,
167 auto maskType = createMaskOp.getVectorType();
168 if (maskType.getRank() != 1 || !maskType.isScalable())
172 auto maskBaseSize = maskType.getDimSize(0);
173 if (maskBaseSize < 2 || maskBaseSize > 16 ||
174 !llvm::isPowerOf2_32(uint32_t(maskBaseSize)))
176 "not SVE predicate-sized");
178 auto loc = createMaskOp.getLoc();
181 adaptor.getOperands()[0]);
194 patterns.add<ConvertFromSvboolOpLowering,
195 ConvertToSvboolOpLowering,
216 patterns.add<CreateMaskOpLowering>(converter, 4096);
224 ConvertToSvboolIntrOp,
227 ScalableMaskedAddFIntrOp,
228 ScalableMaskedAddIIntrOp,
229 ScalableMaskedDivFIntrOp,
230 ScalableMaskedMulFIntrOp,
231 ScalableMaskedMulIIntrOp,
232 ScalableMaskedSDivIIntrOp,
233 ScalableMaskedSubFIntrOp,
234 ScalableMaskedSubIIntrOp,
235 ScalableMaskedUDivIIntrOp,
248 ScalableMaskedAddFOp,
249 ScalableMaskedAddIOp,
250 ScalableMaskedDivFOp,
251 ScalableMaskedMulFOp,
252 ScalableMaskedMulIOp,
253 ScalableMaskedSDivIOp,
254 ScalableMaskedSubFOp,
255 ScalableMaskedSubIOp,
256 ScalableMaskedUDivIOp,
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.