//===- ShuffleRewriter.cpp - Implementation of shuffle rewriting ---------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements in-dialect rewriting of the shuffle op for types i64 and // f64, rewriting 64bit shuffles into two 32bit shuffles. This particular // implementation using shifts and truncations can be obtained using clang: by // emitting IR for shuffle operations with `-O3`. // //===----------------------------------------------------------------------===// #include "mlir/Dialect/Arith/IR/Arith.h" #include "mlir/Dialect/GPU/IR/GPUDialect.h" #include "mlir/Dialect/GPU/Transforms/Passes.h" #include "mlir/IR/Builders.h" #include "mlir/IR/PatternMatch.h" #include "mlir/Pass/Pass.h" usingnamespacemlir; namespace { struct GpuShuffleRewriter : public OpRewritePattern<gpu::ShuffleOp> { … }; } // namespace void mlir::populateGpuShufflePatterns(RewritePatternSet &patterns) { … }