[Mlir-commits] [mlir] [MLIR][Arith] Add denormal attribute to binary/unary operations (PR #112700)
lorenzo chelini
llvmlistbot at llvm.org
Thu Nov 21 12:50:05 PST 2024
================
@@ -181,4 +181,38 @@ def Arith_RoundingModeAttr : I32EnumAttr<
let cppNamespace = "::mlir::arith";
}
+//===----------------------------------------------------------------------===//
+// Arith_DenormalMode
+//===----------------------------------------------------------------------===//
+
+// Denormal mode is applied on operands and results. For example, if denormal =
+// preserve_sign, operands and results will be flushed to sign preserving zero.
+// We do not distinguish between operands and results.
+
+// The default mode. Denormals are preserved and processed as defined
+// by IEEE 754 rules.
+def Arith_DenormalModeIEEE : I32BitEnumAttrCaseNone<"ieee">;
+
+// A mode where denormal numbers are flushed to zero, but the sign of the zero
+// (+0 or -0) is preserved.
+def Arith_DenormalModePreserveSign : I32BitEnumAttrCase<"preserve_sign", 1>;
+
+// A mode where all denormal numbers are flushed to positive zero (+0),
+// ignoring the sign of the original number.
+def Arith_DenormalModePositiveZero : I32BitEnumAttrCase<"positive_zero", 2>;
+
+def Arith_DenormalMode : I32BitEnumAttr<
+ "DenormalMode", "denormal mode arith",
+ [Arith_DenormalModeIEEE, Arith_DenormalModePreserveSign,
+ Arith_DenormalModePositiveZero]> {
+ let cppNamespace = "::mlir::arith";
+ let genSpecializedAttr = 0;
+}
+
+def Arith_DenormalModeAttr :
+ EnumAttr<Arith_Dialect, Arith_DenormalMode, "denormal"> {
+ let assemblyFormat = "`<` $value `>`";
----------------
chelini wrote:
(just to be consistent with the fast math ones).
https://github.com/llvm/llvm-project/pull/112700
More information about the Mlir-commits
mailing list