[Mlir-commits] [mlir] Fix the description of the semantics of math.clampf (PR #175012)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Jan 8 08:20:59 PST 2026


https://github.com/jack-slingsby created https://github.com/llvm/llvm-project/pull/175012

The semantics of `math.clampf` as described in the op definition are incorrect. This fixes that. There isn't a folder (yet) for clamp so only the description needs updating.

>From d68252258c0b8a6dc93bfd1c4c1bc2254730d6db Mon Sep 17 00:00:00 2001
From: Jack Slingsby <jack.slingsby at imgtec.com>
Date: Thu, 8 Jan 2026 16:02:40 +0000
Subject: [PATCH] Fix the description of the semantics of math.clampf

---
 mlir/include/mlir/Dialect/Math/IR/MathOps.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/include/mlir/Dialect/Math/IR/MathOps.td b/mlir/include/mlir/Dialect/Math/IR/MathOps.td
index af65af6fedec6..432f08b14a989 100644
--- a/mlir/include/mlir/Dialect/Math/IR/MathOps.td
+++ b/mlir/include/mlir/Dialect/Math/IR/MathOps.td
@@ -365,7 +365,7 @@ def Math_ClampFOp : Math_FloatTernaryOp<"clampf"> {
 
     The semantics of the operation are described by:
     ```
-      clampf(value, min, max) = maxf(minf(value, min), max)
+      clampf(value, min, max) = minf(maxf(value, min), max)
     ```
 
     Example:



More information about the Mlir-commits mailing list