[Mlir-commits] [mlir] [mlir][math] Preserve signed zero when expanding round below half (PR #237039)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Oct 29 18:11:46 PDT 2026
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 origin/main HEAD --extensions cpp -- mlir/lib/Dialect/Math/Transforms/ExpandOps.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Dialect/Math/Transforms/ExpandOps.cpp b/mlir/lib/Dialect/Math/Transforms/ExpandOps.cpp
index e05aea47b..3ee424d65 100644
--- a/mlir/lib/Dialect/Math/Transforms/ExpandOps.cpp
+++ b/mlir/lib/Dialect/Math/Transforms/ExpandOps.cpp
@@ -578,8 +578,8 @@ static LogicalResult convertRoundOp(math::RoundOp op,
// Values with |x| < 0.5 round to signed zero. Adding 0.5 to the predecessor
// of 0.5 can round to 1.0 before the integer truncation.
Value minusOne = createIntConst(loc, i32Ty, -1, b, operand);
- Value isBelowHalf = arith::CmpIOp::create(
- b, arith::CmpIPredicate::slt, operandBiasedExp, minusOne);
+ Value isBelowHalf = arith::CmpIOp::create(b, arith::CmpIPredicate::slt,
+ operandBiasedExp, minusOne);
Value zero = createFloatConst(loc, opType, 0.0, b, operand);
Value signedZero = math::CopySignOp::create(b, zero, operand);
result = arith::SelectOp::create(b, isBelowHalf, signedZero, result);
``````````
</details>
https://github.com/llvm/llvm-project/pull/237039
More information about the Mlir-commits
mailing list