44 LogicalResult intrinsicRewrite(
Operation *op, StringAttr intrinsic,
50 if (!llvm::all_of(operands, [](
Value value) {
61 rewriter.
create<LLVM::CallIntrinsicOp>(loc, resType, intrinsic, operands);
65 if (numResults <= 1) {
74 results.reserve(numResults);
75 Value intrRes = callIntrOp.getResults();
76 for (
unsigned i = 0; i < numResults; ++i) {
77 results.push_back(rewriter.
create<LLVM::ExtractValueOp>(loc, intrRes, i));
86 struct OneToOneIntrinsicOpConversion
94 typeConverter(typeConverter) {}
96 LogicalResult matchAndRewrite(x86vector::OneToOneIntrinsicOp op,
98 return intrinsicRewrite(op, rewriter.
getStringAttr(op.getIntrinsicName()),
99 op.getIntrinsicOperands(rewriter, typeConverter),
100 typeConverter, rewriter);
112 patterns.add<OneToOneIntrinsicOpConversion>(converter);
118 MaskCompressOp, MaskRndScaleOp, MaskScaleFOp, Vp2IntersectOp, DotBF16Op,
119 CvtPackedF32ToBF16Op, CvtPackedEvenIndexedBF16ToF32Op,
120 CvtPackedOddIndexedBF16ToF32Op, BcstBF16ToPackedF32Op, RsqrtOp, DotOp>();
static MLIRContext * getContext(OpFoldResult val)
StringAttr getStringAttr(const Twine &bytes)
void addIllegalOp(OperationName op)
Register the given operation as illegal, i.e.
Derived class that automatically populates legalization information for different LLVM ops.
Conversion from types to the LLVM IR dialect.
Type packOperationResults(TypeRange types) const
Convert a non-empty list of types of values produced by an operation into an LLVM-compatible type.
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
Operation is the basic unit of execution within MLIR.
DictionaryAttr getAttrDictionary()
Return all of the attributes on this operation as a DictionaryAttr.
void setAttrs(DictionaryAttr newAttrs)
Set the attributes from a dictionary on this operation.
Location getLoc()
The source location the operation was defined or derived from.
result_type_range getResultTypes()
unsigned getNumResults()
Return the number of results held by this operation.
This class represents the benefit of a pattern match in a unitless scheme that ranges from 0 (very li...
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
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,...
virtual void replaceOp(Operation *op, ValueRange newValues)
Replace the results of the given (original) operation with the specified list of values (replacements...
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
This class provides an abstraction over the different types of ranges over Values.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Type getType() const
Return the type of this value.
bool isCompatibleType(Type type)
Returns true if the given type is compatible with the LLVM dialect.
Include the generated interface declarations.
void populateX86VectorLegalizeForLLVMExportPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns)
Collect a set of patterns to lower X86Vector ops to ops that map to LLVM intrinsics.
const FrozenRewritePatternSet & patterns
void configureX86VectorLegalizeForExportTarget(LLVMConversionTarget &target)
Configure the target to support lowering X86Vector ops to ops that map to LLVM intrinsics.
OpInterfaceRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting a...