History log of /llvm-project/flang/runtime/numeric.cpp (Results 1 – 25 of 40)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7
# fc97d2e6 18-Dec-2024 Peter Klausler <pklausler@nvidia.com>

[flang] Add UNSIGNED (#113504)

Implement the UNSIGNED extension type and operations under control of a
language feature flag (-funsigned).

This is nearly identical to the UNSIGNED feature that h

[flang] Add UNSIGNED (#113504)

Implement the UNSIGNED extension type and operations under control of a
language feature flag (-funsigned).

This is nearly identical to the UNSIGNED feature that has been available
in Sun Fortran for years, and now implemented in GNU Fortran for
gfortran 15, and proposed for ISO standardization in J3/24-116.txt.

See the new documentation for details; but in short, this is C's
unsigned type, with guaranteed modular arithmetic for +, -, and *, and
the related transformational intrinsic functions SUM & al.

show more ...


Revision tags: llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1
# fc51c7f0 19-Sep-2024 Slava Zakharin <szakharin@nvidia.com>

[flang][runtime] Disable LDBL_MANT_DIG == 113 for the offload builds. (#109339)

When compiling on aarch64 some `LDBL_MANT_DIG == 113` entries
end up trying to use `complex<long double>` for which t

[flang][runtime] Disable LDBL_MANT_DIG == 113 for the offload builds. (#109339)

When compiling on aarch64 some `LDBL_MANT_DIG == 113` entries
end up trying to use `complex<long double>` for which there are
no certain specializations in `libcudacxx`. This change-set
includes a clean-up for `LDBL_MANT_DIG == 113` usage, which is replaced
with `HAS_LDBL128` that is set in `float128.h`.

show more ...


# 104f3c18 19-Sep-2024 Slava Zakharin <szakharin@nvidia.com>

Reland "[flang][runtime] Use cuda::std::complex in F18 runtime CUDA build. (#109078)" (#109207)

`std::complex` operators do not work for the CUDA device compilation
of F18 runtime. This change make

Reland "[flang][runtime] Use cuda::std::complex in F18 runtime CUDA build. (#109078)" (#109207)

`std::complex` operators do not work for the CUDA device compilation
of F18 runtime. This change makes use of `cuda::std::complex` from
`libcudacxx`.
`cuda::std::complex` does not have specializations for `long double`,
so the change is accompanied with a clean-up for `long double` usage.

Additional change on top of #109078 is to use `cuda::std::complex`
only for the device compilation, otherwise the host compilation
fails because `libcudacxx` may not support `long double` specialization
at all (depending on the compiler).

show more ...


# 36192fdf 18-Sep-2024 Slava Zakharin <szakharin@nvidia.com>

Revert "[flang][runtime] Use cuda::std::complex in F18 runtime CUDA build." (#109173)

Reverts llvm/llvm-project#109078


# be187a68 18-Sep-2024 Slava Zakharin <szakharin@nvidia.com>

[flang][runtime] Use cuda::std::complex in F18 runtime CUDA build. (#109078)

`std::complex` operators do not work for the CUDA device compilation
of F18 runtime. This change makes use of `cuda::std

[flang][runtime] Use cuda::std::complex in F18 runtime CUDA build. (#109078)

`std::complex` operators do not work for the CUDA device compilation
of F18 runtime. This change makes use of `cuda::std::complex` from
`libcudacxx`.
`cuda::std::complex` does not have specializations for `long double`,
so the change is accompanied with a clean-up for `long double` usage.

show more ...


Revision tags: llvmorg-19.1.0
# 500f6cc2 04-Sep-2024 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang][runtime] Support SPACING for REAL(2 & 3) (#106575)

Add runtime APIs for the intrinsic function SPACING for REAL kinds 2 & 3
in two ways: Spacing2 (& 3) for build environments with std::floa

[flang][runtime] Support SPACING for REAL(2 & 3) (#106575)

Add runtime APIs for the intrinsic function SPACING for REAL kinds 2 & 3
in two ways: Spacing2 (& 3) for build environments with std::float16_t,
and Spacing2By4 (& 3By4) variants (for any build environment) which
compute SPACING for those types but accept and return their values as
32-bit floats.

SPACING for REAL(2) is needed by HDF5.

show more ...


Revision tags: llvmorg-19.1.0-rc4
# f428f5fc 26-Aug-2024 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang][runtime] Add alternate SELECTED_(INT|REAL)_KIND APIs (#105887)

Add extended versions of SELECTED_INT_KIND and SELECTED_REAL_KIND
runtime APIs that permit lowering to pass along a bit mask o

[flang][runtime] Add alternate SELECTED_(INT|REAL)_KIND APIs (#105887)

Add extended versions of SELECTED_INT_KIND and SELECTED_REAL_KIND
runtime APIs that permit lowering to pass along a bit mask of acceptable
kinds. The existing APIs call the new ones with a full bit mask. If
lowering transitions to always use the new APIs the old ones can then be
deleted.

show more ...


# 57b89fdd 23-Aug-2024 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang][runtime] Add FLANG_RUNTIME_NO_REAL_3 flag to build (#105856)

Allow a runtime build to disable SELECTED_REAL_KIND from returning kind
3 (16-bit truncated form of 32-bit IEEE-754 floating poi

[flang][runtime] Add FLANG_RUNTIME_NO_REAL_3 flag to build (#105856)

Allow a runtime build to disable SELECTED_REAL_KIND from returning kind
3 (16-bit truncated form of 32-bit IEEE-754 floating point, a/k/a "brain
float" or bfloat16).

show more ...


# c557d852 21-Aug-2024 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang][runtime] Add build-time flags to runtime to adjust SELECTED_x_KIND() (#105575)

Add FLANG_RUNTIME_NO_INTEGER_16 and FLANG_RUNTIME_NO_REAL_{2,10,16} to
allow one to disable those kinds from b

[flang][runtime] Add build-time flags to runtime to adjust SELECTED_x_KIND() (#105575)

Add FLANG_RUNTIME_NO_INTEGER_16 and FLANG_RUNTIME_NO_REAL_{2,10,16} to
allow one to disable those kinds from being returned from
SELECTED_INT_KIND and SELECTED_REAL_KIND even if they are actually
available in the C++ build compiler.

show more ...


Revision tags: llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8
# a03e93e1 11-Jun-2024 David Parks <code.optimizer@gmail.com>

[flang] Add runtime support for Fortran intrinsic ERFC_SCALED (#95040)

Co-authored-by: David Parks <dparks@nvidia.com>


Revision tags: llvmorg-18.1.7
# 79c2a1e4 23-May-2024 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang][runtime] Correct SELECTED_LOGICAL_KIND() (#93108)

The implementation of the runtime version of this intrinsic function in
https://github.com/llvm/llvm-project/pull/89691 was incorrect. Fix

[flang][runtime] Correct SELECTED_LOGICAL_KIND() (#93108)

The implementation of the runtime version of this intrinsic function in
https://github.com/llvm/llvm-project/pull/89691 was incorrect. Fix it to
interpret its argument as a bit count.

show more ...


Revision tags: llvmorg-18.1.6, llvmorg-18.1.5
# 82a8c1cf 24-Apr-2024 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang][runtime] Support SELECTED_CHAR_KIND, SELECTED_LOGICAL_KIND (#89691)

Add code to the runtime support library for the SELECTED_CHAR_KIND and
SELECTED_LOGICAL_KIND intrinsic functions. These a

[flang][runtime] Support SELECTED_CHAR_KIND, SELECTED_LOGICAL_KIND (#89691)

Add code to the runtime support library for the SELECTED_CHAR_KIND and
SELECTED_LOGICAL_KIND intrinsic functions. These are usually used with
constant folding in constant expressions, but the are available for use
with dynamic arguments as well.

Lowering support remains to be implemented.

show more ...


Revision tags: llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1
# 50d848d0 05-Mar-2024 Slava Zakharin <szakharin@nvidia.com>

[flang] Added lowering and runtime for COMPLEX(16) intrinsics. (#83874)

For `LDBL_MANT_DIG == 113` targets the FortranFloat128Math library
is just an interface library that provides sources and com

[flang] Added lowering and runtime for COMPLEX(16) intrinsics. (#83874)

For `LDBL_MANT_DIG == 113` targets the FortranFloat128Math library
is just an interface library that provides sources and compilation
options to be used for building FortranRuntime - there are not extra
dependencies on other libraries, so it can be a part of FortranRuntime,
which helps to avoid extra linking steps in the compiler driver.
Targets with __float128 support in libc will also use this path.
Other targets, where the math support comes from
FLANG_RUNTIME_F128_MATH_LIB,
FortranFloat128Math is built as a standalone static library,
and the compiler driver needs to conduct the linking.

Flang APIs for COMPLEX(16) are just thin C wrappers around
the C math functions. Flang uses C _Complex ABI for passing/returning
COMPLEX values, so the runtime is aligned to this.

show more ...


# c5cdf343 29-Feb-2024 Slava Zakharin <szakharin@nvidia.com>

[flang][runtime] Partial revert of #83383. (#83478)

For `LDBL_MANT_DIG == 113` targets the REAL(16) versions of F18
runtime APIs can stay and should better stay in FortranRuntime.
This way, no add

[flang][runtime] Partial revert of #83383. (#83478)

For `LDBL_MANT_DIG == 113` targets the REAL(16) versions of F18
runtime APIs can stay and should better stay in FortranRuntime.
This way, no additional linking actions are required, because
glibc provides all that is needed.
I thought I would isolate all REAL(16) implementations (both
via `__float128` and `long double`) into Float128Math library,
but that was a bad idea.

This should fix aarch64 buildbots failing gfortran tests.

show more ...


# 0699749c 29-Feb-2024 Slava Zakharin <szakharin@nvidia.com>

[flang][runtime] Moved support for some REAL(16) intrinsics to Float128Math. (#83383)

This adds support for 128-bit float versions of SCALE, NEAREST, MOD,
MODULO, SET_EXPONENT, EXPONENT, FRACTION,

[flang][runtime] Moved support for some REAL(16) intrinsics to Float128Math. (#83383)

This adds support for 128-bit float versions of SCALE, NEAREST, MOD,
MODULO, SET_EXPONENT, EXPONENT, FRACTION, SPACING and RRSPACING.

show more ...


Revision tags: llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2
# dbf547f8 31-Jan-2024 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang][runtime] Add limit check to MOD/MODULO (#80026)

When testing the arguments to see whether they are integers, check first
that they are within the maximum range of a 64-bit integer; otherwis

[flang][runtime] Add limit check to MOD/MODULO (#80026)

When testing the arguments to see whether they are integers, check first
that they are within the maximum range of a 64-bit integer; otherwise, a
value of larger magnitude will set an invalid operand exception flag.

show more ...


Revision tags: llvmorg-18.1.0-rc1
# e6fdbd17 29-Jan-2024 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang][runtime] Add special-case faster path to real MOD/MODULO (#79625)

When a real-valued reference to the MOD/MODULO intrinsic functions has
operands that are exact integers, use the fast exact

[flang][runtime] Add special-case faster path to real MOD/MODULO (#79625)

When a real-valued reference to the MOD/MODULO intrinsic functions has
operands that are exact integers, use the fast exact integer algorithm
rather than calling std::fmod.

show more ...


# e8a5010c 25-Jan-2024 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang][runtime] Use std::fmod for most MOD/MODULO (#78745)

The new accurate algorithm for real MOD and MODULO in the runtime is not
as fast as std::fmod(), which is also accurate. So use std::fmod

[flang][runtime] Use std::fmod for most MOD/MODULO (#78745)

The new accurate algorithm for real MOD and MODULO in the runtime is not
as fast as std::fmod(), which is also accurate. So use std::fmod() for
those floating-point types that it supports.

Fixes https://github.com/llvm/llvm-project/issues/78641.

show more ...


Revision tags: llvmorg-19-init
# f0896911 15-Jan-2024 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang][runtime] Better real MOD/MODULO results (#77167)

The Fortran standard defines real MOD and MODULO with expressions like
MOD(a,p) = a - AINT(a/p)*p. Unfortunately, these definitions have poo

[flang][runtime] Better real MOD/MODULO results (#77167)

The Fortran standard defines real MOD and MODULO with expressions like
MOD(a,p) = a - AINT(a/p)*p. Unfortunately, these definitions have poor
accuracy when a is much larger in magnitude than p, and every Fortran
compiler uses better algorithms instead.

Fixes llvm-test-suite/Fortran/gfortran/regression/mod_large_1.f90.

show more ...


# 76facde3 28-Dec-2023 Slava Zakharin <szakharin@nvidia.com>

[flang][runtime] Enable more APIs in the offload build. (#76486)


# 39c2f597 26-Dec-2023 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang][runtime] Fix NEAREST() when exponent decreases (#75368)

When the result of NEAREST() has an exponent less than that of the
argument (e.g., NEAREST(1.,-1.) and NEAREST(-1.,1.)), the result w

[flang][runtime] Fix NEAREST() when exponent decreases (#75368)

When the result of NEAREST() has an exponent less than that of the
argument (e.g., NEAREST(1.,-1.) and NEAREST(-1.,1.)), the result was
wrong, because the increment value uses the result of SPACING() in terms
of the argument. Fix by just calling into the C runtime routine
std::nextafter().

show more ...


# b4b23ff7 20-Dec-2023 Slava Zakharin <szakharin@nvidia.com>

[flang][runtime] Enable more APIs in the offload build. (#75996)

This patch enables more numeric (mod, sum, matmul, etc.) APIs,
and some others.

I added new macros to disable warnings about usin

[flang][runtime] Enable more APIs in the offload build. (#75996)

This patch enables more numeric (mod, sum, matmul, etc.) APIs,
and some others.

I added new macros to disable warnings about using C++ STD methods
like operators of std::complex, which do not have __device__ attribute.
This may probably result in unresolved references, if the header files
implementation relies on libstdc++. I will need to follow up on this.

show more ...


Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init
# 1c35c1a7 06-Jul-2023 Peter Klausler <pklausler@nvidia.com>

[flang] Allow runtime build with AVOID_NATIVE_INT128_T=1

This patch enables the Fortran runtime support library to be
built without native 128-bit integer support in the C++ compiler.

Experimental:

[flang] Allow runtime build with AVOID_NATIVE_INT128_T=1

This patch enables the Fortran runtime support library to be
built without native 128-bit integer support in the C++ compiler.

Experimental: do not merge yet.

Differential Revision: https://reviews.llvm.org/D154660

show more ...


# 478e0b58 17-Jul-2023 Peter Steinfeld <psteinfeld@nvidia.com>

[flang] Quadmath 128 bit floating point intrinsics

This update allows constant folding for many 128 bit floating point intrinsics
through the library quadmath, which is only available on some platfo

[flang] Quadmath 128 bit floating point intrinsics

This update allows constant folding for many 128 bit floating point intrinsics
through the library quadmath, which is only available on some platforms.

Differential Revision: https://reviews.llvm.org/D156435

show more ...


Revision tags: llvmorg-16.0.6, llvmorg-16.0.5
# 6c9c69bd 25-May-2023 V Donaldson <vdonaldson@nvidia.com>

[flang] Retain the sign of the argument for the result of fraction(0)

The f18 clause 16.9.80 description of the FRACTION(X) intrinsic states:

Result Value. The result has the value ....
If

[flang] Retain the sign of the argument for the result of fraction(0)

The f18 clause 16.9.80 description of the FRACTION(X) intrinsic states:

Result Value. The result has the value ....
If X has the value zero, the result is zero.
If X is an IEEE NaN, the result is that NaN.
If X is an IEEE infinity, the result is an IEEE NaN.

This clause does not specify whether fraction(-0.0) should be -0.0 or +0.0.
However, a folded result and a runtime result should be consistent, and
returning -0.0 is more in line with the result for fraction(NaN).

For this test:

print '(2f6.1)', 0.0, fraction(0.0)
call f(0.0)
print '(2f6.1)', -0.0, fraction(-0.0)
call f(-0.0)
end

subroutine f(x)
print '(2f6.1)', x, fraction(x)
end

Current output is:

0.0 0.0
0.0 0.0
-0.0 -0.0
-0.0 0.0

Change that to:

0.0 0.0
0.0 0.0
-0.0 -0.0
-0.0 -0.0

show more ...


12