================
@@ -106,6 +111,57 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
     return baseName + "." + std::to_string(recordNames[baseName]++);
   }
 
+  //
+  // Floating point specific helpers
+  // -------------------------------
+  //
+
+  /// Enable/Disable use of constrained floating point math. When enabled the
+  /// CreateF<op>() calls instead create constrained floating point intrinsic
+  /// calls. Fast math flags are unaffected by this setting.
+  void setIsFPConstrained(bool IsCon) {
+    if (IsCon)
+      llvm_unreachable("Constrained FP NYI");
+    isFPConstrained = IsCon;
+  }
+
+  /// Query for the use of constrained floating point math
+  bool getIsFPConstrained() {
+    if (isFPConstrained)
+      llvm_unreachable("Constrained FP NYI");
+    return isFPConstrained;
+  }
+
+  /// Set the exception handling to be used with constrained floating point
+  void setDefaultConstrainedExcept(cir::fp::ExceptionBehavior NewExcept) {
+#ifndef NDEBUG
+    std::optional<llvm::StringRef> ExceptStr =
+        cir::convertExceptionBehaviorToStr(NewExcept);
+    assert(ExceptStr && "Garbage strict exception behavior!");
+#endif
+    defaultConstrainedExcept = NewExcept;
+  }
+
+  /// Set the rounding mode handling to be used with constrained floating point
+  void setDefaultConstrainedRounding(llvm::RoundingMode NewRounding) {
+#ifndef NDEBUG
+    std::optional<llvm::StringRef> RoundingStr =
+        cir::convertRoundingModeToStr(NewRounding);
+    assert(RoundingStr && "Garbage strict rounding mode!");
+#endif
+    defaultConstrainedRounding = NewRounding;
+  }
+
+  /// Get the exception handling used with constrained floating point
+  cir::fp::ExceptionBehavior getDefaultConstrainedExcept() {
+    return defaultConstrainedExcept;
+  }
+
+  /// Get the rounding mode handling used with constrained floating point
+  llvm::RoundingMode getDefaultConstrainedRounding() {
----------------
ayokunle321 wrote:

OG 
[(IRbuilder.h)](https://github.com/llvm/llvm-project/blob/c4721872af5605e10f06c256aae033ef15053525/llvm/include/llvm/IR/IRBuilder.h)
 does not typically have a `const` on its getters (all getters, not just FP 
helpers) so I'm not sure if we need to have them here.

https://github.com/llvm/llvm-project/pull/179121
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to