[flang-commits] [PATCH] D111253: [flang] Define IEEE_SCALB, IEEE_NEXT_AFTER, IEEE_NEXT_DOWN, IEEE_NEXT_UP

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Oct 6 12:10:31 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf5ab4bfb5bbb: [flang] Define IEEE_SCALB, IEEE_NEXT_AFTER, IEEE_NEXT_DOWN, IEEE_NEXT_UP (authored by klausler).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111253

Files:
  flang/lib/Evaluate/fold-real.cpp
  flang/lib/Evaluate/intrinsics.cpp
  flang/module/__fortran_builtins.f90
  flang/module/ieee_arithmetic.f90


Index: flang/module/ieee_arithmetic.f90
===================================================================
--- flang/module/ieee_arithmetic.f90
+++ flang/module/ieee_arithmetic.f90
@@ -11,6 +11,10 @@
 
   use __Fortran_builtins, only: &
     ieee_is_nan => __builtin_ieee_is_nan, &
+    ieee_next_after => __builtin_ieee_next_after, &
+    ieee_next_down => __builtin_ieee_next_down, &
+    ieee_next_up => __builtin_ieee_next_up, &
+    ieee_scalb => scale, &
     ieee_selected_real_kind => __builtin_ieee_selected_real_kind, &
     ieee_support_datatype => __builtin_ieee_support_datatype, &
     ieee_support_denormal => __builtin_ieee_support_denormal, &
Index: flang/module/__fortran_builtins.f90
===================================================================
--- flang/module/__fortran_builtins.f90
+++ flang/module/__fortran_builtins.f90
@@ -42,6 +42,9 @@
   procedure(type(__builtin_c_ptr)) :: __builtin_c_loc
 
   intrinsic :: __builtin_ieee_is_nan
+  intrinsic :: __builtin_ieee_next_after, __builtin_ieee_next_down, &
+    __builtin_ieee_next_up
+  intrinsic :: scale ! for ieee_scalb
   intrinsic :: __builtin_ieee_selected_real_kind
   intrinsic :: __builtin_ieee_support_datatype, &
     __builtin_ieee_support_denormal, __builtin_ieee_support_divide, &
Index: flang/lib/Evaluate/intrinsics.cpp
===================================================================
--- flang/lib/Evaluate/intrinsics.cpp
+++ flang/lib/Evaluate/intrinsics.cpp
@@ -690,7 +690,7 @@
         {{"a", ExtensibleDerived, Rank::anyOrAssumedRank},
             {"b", ExtensibleDerived, Rank::anyOrAssumedRank}},
         DefaultLogical, Rank::scalar, IntrinsicClass::inquiryFunction},
-    {"scale", {{"x", SameReal}, {"i", AnyInt}}, SameReal},
+    {"scale", {{"x", SameReal}, {"i", AnyInt}}, SameReal}, // == IEEE_SCALB()
     {"scan",
         {{"string", SameChar}, {"set", SameChar},
             {"back", AnyLogical, Rank::elemental, Optionality::optional},
@@ -791,6 +791,9 @@
             DefaultingKIND},
         KINDInt},
     {"__builtin_ieee_is_nan", {{"a", AnyFloating}}, DefaultLogical},
+    {"__builtin_ieee_next_after", {{"x", SameReal}, {"y", AnyReal}}, SameReal},
+    {"__builtin_ieee_next_down", {{"x", SameReal}}, SameReal},
+    {"__builtin_ieee_next_up", {{"x", SameReal}}, SameReal},
     {"__builtin_ieee_selected_real_kind", // alias for selected_real_kind
         {{"p", AnyInt, Rank::scalar},
             {"r", AnyInt, Rank::scalar, Optionality::optional},
Index: flang/lib/Evaluate/fold-real.cpp
===================================================================
--- flang/lib/Evaluate/fold-real.cpp
+++ flang/lib/Evaluate/fold-real.cpp
@@ -144,6 +144,7 @@
   }
   // TODO: dim, dot_product, fraction, matmul,
   // modulo, nearest, norm2, rrspacing, scale,
+  // __builtin_next_after/down/up,
   // set_exponent, spacing, transfer,
   // bessel_jn (transformational) and bessel_yn (transformational)
   return Expr<T>{std::move(funcRef)};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111253.377635.patch
Type: text/x-patch
Size: 2966 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20211006/be9b2f68/attachment.bin>


More information about the flang-commits mailing list