[llvm] [mlir] [mlir][x86vector] Simplify intrinsic generation (PR #133692)
Adam Siemieniuk via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 9 08:05:24 PDT 2025
================
@@ -19,47 +18,53 @@
using namespace mlir;
using namespace mlir::x86vector;
-/// Extracts the "main" vector element type from the given X86Vector operation.
-template <typename OpTy>
-static Type getSrcVectorElementType(OpTy op) {
- return cast<VectorType>(op.getSrc().getType()).getElementType();
-}
-template <>
-Type getSrcVectorElementType(Vp2IntersectOp op) {
- return cast<VectorType>(op.getA().getType()).getElementType();
-}
-
namespace {
-/// Base conversion for AVX512 ops that can be lowered to one of the two
-/// intrinsics based on the bitwidth of their "main" vector element type. This
-/// relies on the to-LLVM-dialect conversion helpers to correctly pack the
-/// results of multi-result intrinsic ops.
-template <typename OpTy, typename Intr32OpTy, typename Intr64OpTy>
-struct LowerToIntrinsic : public OpConversionPattern<OpTy> {
- explicit LowerToIntrinsic(const LLVMTypeConverter &converter)
- : OpConversionPattern<OpTy>(converter, &converter.getContext()) {}
-
- const LLVMTypeConverter &getTypeConverter() const {
- return *static_cast<const LLVMTypeConverter *>(
- OpConversionPattern<OpTy>::getTypeConverter());
+// Replaces an operation with a call to an LLVM intrinsic.
----------------
adam-smnk wrote:
Added more descriptions and an example.
https://github.com/llvm/llvm-project/pull/133692
More information about the llvm-commits
mailing list