[flang-commits] [PATCH] D132155: [flang] Fold SPACING() correctly when result is subnormal

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Aug 18 14:24:54 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG92afe8021352: [flang] Fold SPACING() correctly when result is subnormal (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132155/new/

https://reviews.llvm.org/D132155

Files:
  flang/lib/Evaluate/real.cpp
  flang/test/Evaluate/fold-spacing.f90


Index: flang/test/Evaluate/fold-spacing.f90
===================================================================
--- flang/test/Evaluate/fold-spacing.f90
+++ flang/test/Evaluate/fold-spacing.f90
@@ -5,6 +5,8 @@
   logical, parameter :: test_2 = spacing(-3.0) == scale(1.0, -22)
   logical, parameter :: test_3 = spacing(3.0d0) == scale(1.0, -51)
   logical, parameter :: test_4 = spacing(0.) == tiny(0.)
+  logical, parameter :: test_5 = spacing(tiny(0.)) == 1.e-45
+  logical, parameter :: test_6 = spacing(8388608.) == 1.
   logical, parameter :: test_11 = rrspacing(3.0) == scale(0.75, 24)
   logical, parameter :: test_12 = rrspacing(-3.0) == scale(0.75, 24)
   logical, parameter :: test_13 = rrspacing(3.0d0) == scale(0.75, 53)
Index: flang/lib/Evaluate/real.cpp
===================================================================
--- flang/lib/Evaluate/real.cpp
+++ flang/lib/Evaluate/real.cpp
@@ -749,8 +749,7 @@
     return TINY();
   } else {
     Real result;
-    result.Normalize(
-        false, Exponent() - binaryPrecision + 1, Fraction::MASKL(1));
+    result.Normalize(false, Exponent(), Fraction::MASKR(1));
     return result;
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132155.453786.patch
Type: text/x-patch
Size: 1154 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220818/2b1890ee/attachment.bin>


More information about the flang-commits mailing list