[Mlir-commits] [mlir] [MLIR][Arith] Add rounding mode attribute to `truncf` (PR #86152)
Jakub Kuderski
llvmlistbot at llvm.org
Fri Mar 29 08:17:59 PDT 2024
================
@@ -156,4 +156,29 @@ def Arith_IntegerOverflowAttr :
let assemblyFormat = "`<` $value `>`";
}
+//===----------------------------------------------------------------------===//
+// Arith_RoundingMode
+//===----------------------------------------------------------------------===//
+
+// These correspond to LLVM's values defined in:
+// llvm/include/llvm/ADT/FloatingPointMode.h
+
+def Arith_RToNearestTiesToEven // Round to nearest, ties to even
+ : I32EnumAttrCase<"tonearesteven", 0>;
+def Arith_RDownward // Round toward -inf
+ : I32EnumAttrCase<"downward", 1>;
+def Arith_RUpward // Round toward +inf
+ : I32EnumAttrCase<"upward", 2>;
+def Arith_RTowardZero // Round toward 0
+ : I32EnumAttrCase<"towardzero", 3>;
+def Arith_RToNearestTiesAwayFromZero // Round to nearest, ties away from zero
+ : I32EnumAttrCase<"tonearestaway", 4>;
----------------
kuhar wrote:
If I can have one request, could you add some snake case to make this more readable? I'd strongly prefer `to_nearest_away` over `tonearestaway`
https://github.com/llvm/llvm-project/pull/86152
More information about the Mlir-commits
mailing list