[Mlir-commits] [mlir] [mlir] Add narrow type emulation conversions (PR #72181)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Nov 13 16:52:10 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 45a92acfd945bef2dca391bccd08a09348c35c67 9901854b3419b7b47c8cbaec8ccf0acf14012556 -- mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp b/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp
index 078df55e35..89f20f90ca 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp
@@ -338,24 +338,37 @@ struct ConvertMemrefStore final : OpConversionPattern<memref::StoreOp> {
}
Location loc = op.getLoc();
- Value extendedInput = rewriter.create<arith::ExtUIOp>(loc, dstIntegerType, adaptor.getValue());
+ Value extendedInput = rewriter.create<arith::ExtUIOp>(loc, dstIntegerType,
+ adaptor.getValue());
// Special case 0-rank memref stores. We can compute the mask at compile
// time.
if (convertedType.getRank() == 0) {
// Shift extended value to be left aligned
- auto shiftValAttr = rewriter.getIntegerAttr(dstIntegerType, dstBits - srcBits);
- Value shiftVal = rewriter.create<arith::ConstantOp>(loc, dstIntegerType, shiftValAttr).getResult();
- Value alignedVal = rewriter.create<arith::ShLIOp>(loc, extendedInput, shiftVal).getResult();
+ auto shiftValAttr =
+ rewriter.getIntegerAttr(dstIntegerType, dstBits - srcBits);
+ Value shiftVal =
+ rewriter.create<arith::ConstantOp>(loc, dstIntegerType, shiftValAttr)
+ .getResult();
+ Value alignedVal =
+ rewriter.create<arith::ShLIOp>(loc, extendedInput, shiftVal)
+ .getResult();
// Create mask to clear destination bits
auto writeMaskValAttr = rewriter.getIntegerAttr(
dstIntegerType, (1 << (dstBits - srcBits)) - 1);
- Value writeMask = rewriter.create<arith::ConstantOp>(loc, dstIntegerType, writeMaskValAttr).getResult();
+ Value writeMask =
+ rewriter
+ .create<arith::ConstantOp>(loc, dstIntegerType, writeMaskValAttr)
+ .getResult();
// Clear destination bits
- rewriter.create<memref::AtomicRMWOp>(loc, arith::AtomicRMWKind::andi, writeMask, adaptor.getMemref(), ValueRange{});
+ rewriter.create<memref::AtomicRMWOp>(loc, arith::AtomicRMWKind::andi,
+ writeMask, adaptor.getMemref(),
+ ValueRange{});
// Write srcs bits to destination
- rewriter.create<memref::AtomicRMWOp>(loc, arith::AtomicRMWKind::ori, alignedVal, adaptor.getMemref(), ValueRange{});
+ rewriter.create<memref::AtomicRMWOp>(loc, arith::AtomicRMWKind::ori,
+ alignedVal, adaptor.getMemref(),
+ ValueRange{});
rewriter.eraseOp(op);
return success();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/72181
More information about the Mlir-commits
mailing list