[llvm] [llubi] Initial support for floating-point numbers (PR #188453)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 28 06:39:03 PDT 2026


================
@@ -503,6 +503,39 @@ uint64_t Context::getEffectiveTypeStoreSize(Type *Ty) {
   return getEffectiveTypeSize(DL.getTypeStoreSize(Ty));
 }
 
+RoundingMode Context::getCurrentRoundingMode() const {
+  return CurrentRoundingMode;
+}
+
+fp::ExceptionBehavior Context::getCurrentExceptionBehavior() const {
+  return CurrentExceptionBehavior;
+}
+
+void Context::setCurrentRoundingMode(RoundingMode RM) {
+  CurrentRoundingMode = RM;
+}
+
+void Context::setCurrentExceptionBehavior(fp::ExceptionBehavior EB) {
+  CurrentExceptionBehavior = EB;
+}
+
+bool Context::isDefaultFPEnv() const {
+  return isDefaultFPEnvironment(CurrentExceptionBehavior, CurrentRoundingMode);
+}
+
+bool Context::getRandomBool() {
+  // We use the lowest bit of the raw bits from RNG as the result:
+  if (UndefBehavior == UndefValueBehavior::NonDeterministic)
----------------
nikic wrote:

It seems odd to couple a general getRandomBool() API to UndefValueBehavior?

https://github.com/llvm/llvm-project/pull/188453


More information about the llvm-commits mailing list