[Mlir-commits] [mlir] [mlir][llvmir] Add new support for strict fp handling (PR #205158)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Jun 22 13:51:25 PDT 2026
================
@@ -545,6 +545,60 @@ def LLVM_FastmathFlagsAttr :
let assemblyFormat = "`<` $value `>`";
}
+//===----------------------------------------------------------------------===//
+// Floating-point environment enums (used by the `#llvm.fenv` attribute)
+//===----------------------------------------------------------------------===//
+
+def FPRoundingMode : I32EnumAttr<
+ "FPRoundingMode", "floating-point rounding mode", [
+ I32EnumAttrCase<"Dynamic", 0, "dynamic">,
+ I32EnumAttrCase<"ToNearest", 1, "tonearest">,
+ I32EnumAttrCase<"Downward", 2, "downward">,
+ I32EnumAttrCase<"Upward", 3, "upward">,
+ I32EnumAttrCase<"UpwardZero", 4, "upwardzero">,
+ I32EnumAttrCase<"ToNearestAway", 5, "tonearestaway">
+]> {
+ let description = [{
+ The rounding mode to use for a floating-point operation. Every value other
+ than `dynamic` specifies a static rounding mode.
+ }];
+ let cppNamespace = "::mlir::LLVM";
+ let genSpecializedAttr = 0;
+}
+
+def FPDynamicRoundingMode : I32EnumAttr<
+ "FPDynamicRoundingMode", "floating-point dynamic rounding mode", [
+ I32EnumAttrCase<"Unknown", 0, "unknown">,
+ I32EnumAttrCase<"ToNearest", 1, "tonearest">,
+ I32EnumAttrCase<"Downward", 2, "downward">,
+ I32EnumAttrCase<"Upward", 3, "upward">,
+ I32EnumAttrCase<"UpwardZero", 4, "upwardzero">,
+ I32EnumAttrCase<"ToNearestAway", 5, "tonearestaway">
+]> {
+ let description = [{
+ The known dynamic rounding mode at the point the instruction is executed.
----------------
adams381 wrote:
"Otherwise the behavior is undefined" (here and on `FPExceptionMode` below) is carried over from the LLVM IR wording, but MLIR doesn't have a single cross-dialect UB notion. "Unspecified result", or a pointer to the IR semantics this lowers to, would be clearer.
https://github.com/llvm/llvm-project/pull/205158
More information about the Mlir-commits
mailing list