[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
//===-- runtime/reduction.h -------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// Defines the API for the reduction transformational intrinsic functions.
|
|
|
|
// (Except the complex-valued total reduction forms of SUM and PRODUCT;
|
|
|
|
// the API for those is in complex-reduction.h so that C's _Complex can
|
|
|
|
// be used for their return types.)
|
|
|
|
|
|
|
|
#ifndef FORTRAN_RUNTIME_REDUCTION_H_
|
|
|
|
#define FORTRAN_RUNTIME_REDUCTION_H_
|
|
|
|
|
|
|
|
#include "descriptor.h"
|
|
|
|
#include "entry-names.h"
|
|
|
|
#include "flang/Common/uint128.h"
|
|
|
|
#include <complex>
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
namespace Fortran::runtime {
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
// Reductions that are known to return scalars have per-type entry
|
2021-04-21 00:19:21 +08:00
|
|
|
// points. These cover the cases that either have no DIM=
|
|
|
|
// argument or have an argument rank of 1. Pass 0 for no DIM=
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
// or the value of the DIM= argument so that it may be checked.
|
|
|
|
// The data type in the descriptor is checked against the expected
|
|
|
|
// return type.
|
|
|
|
//
|
|
|
|
// Reductions that return arrays are the remaining cases in which
|
|
|
|
// the argument rank is greater than one and there is a DIM=
|
|
|
|
// argument present. These cases establish and allocate their
|
|
|
|
// results in a caller-supplied descriptor, which is assumed to
|
|
|
|
// be large enough.
|
|
|
|
//
|
|
|
|
// Complex-valued SUM and PRODUCT reductions have their API
|
|
|
|
// entry points defined in complex-reduction.h; these are C wrappers
|
|
|
|
// around C++ implementations so as to keep usage of C's _Complex
|
|
|
|
// types out of C++ code.
|
|
|
|
|
|
|
|
// SUM()
|
|
|
|
|
|
|
|
std::int8_t RTNAME(SumInteger1)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int16_t RTNAME(SumInteger2)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int32_t RTNAME(SumInteger4)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int64_t RTNAME(SumInteger8)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
2021-04-03 02:02:26 +08:00
|
|
|
#ifdef __SIZEOF_INT128__
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
common::int128_t RTNAME(SumInteger16)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
2021-04-03 02:02:26 +08:00
|
|
|
#endif
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
|
|
|
|
// REAL/COMPLEX(2 & 3) return 32-bit float results for the caller to downconvert
|
|
|
|
float RTNAME(SumReal2)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
float RTNAME(SumReal3)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
float RTNAME(SumReal4)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
double RTNAME(SumReal8)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
long double RTNAME(SumReal10)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
long double RTNAME(SumReal16)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
|
|
|
|
void RTNAME(CppSumComplex2)(std::complex<float> &, const Descriptor &,
|
|
|
|
const char *source, int line, int dim = 0,
|
|
|
|
const Descriptor *mask = nullptr);
|
|
|
|
void RTNAME(CppSumComplex3)(std::complex<float> &, const Descriptor &,
|
|
|
|
const char *source, int line, int dim = 0,
|
|
|
|
const Descriptor *mask = nullptr);
|
|
|
|
void RTNAME(CppSumComplex4)(std::complex<float> &, const Descriptor &,
|
|
|
|
const char *source, int line, int dim = 0,
|
|
|
|
const Descriptor *mask = nullptr);
|
|
|
|
void RTNAME(CppSumComplex8)(std::complex<double> &, const Descriptor &,
|
|
|
|
const char *source, int line, int dim = 0,
|
|
|
|
const Descriptor *mask = nullptr);
|
|
|
|
void RTNAME(CppSumComplex10)(std::complex<long double> &, const Descriptor &,
|
|
|
|
const char *source, int line, int dim = 0,
|
|
|
|
const Descriptor *mask = nullptr);
|
|
|
|
void RTNAME(CppSumComplex16)(std::complex<long double> &, const Descriptor &,
|
|
|
|
const char *source, int line, int dim = 0,
|
|
|
|
const Descriptor *mask = nullptr);
|
|
|
|
|
|
|
|
void RTNAME(SumDim)(Descriptor &result, const Descriptor &array, int dim,
|
|
|
|
const char *source, int line, const Descriptor *mask = nullptr);
|
|
|
|
|
|
|
|
// PRODUCT()
|
|
|
|
|
|
|
|
std::int8_t RTNAME(ProductInteger1)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int16_t RTNAME(ProductInteger2)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int32_t RTNAME(ProductInteger4)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int64_t RTNAME(ProductInteger8)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
2021-04-03 02:02:26 +08:00
|
|
|
#ifdef __SIZEOF_INT128__
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
common::int128_t RTNAME(ProductInteger16)(const Descriptor &,
|
|
|
|
const char *source, int line, int dim = 0,
|
|
|
|
const Descriptor *mask = nullptr);
|
2021-04-03 02:02:26 +08:00
|
|
|
#endif
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
|
|
|
|
// REAL/COMPLEX(2 & 3) return 32-bit float results for the caller to downconvert
|
|
|
|
float RTNAME(ProductReal2)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
float RTNAME(ProductReal3)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
float RTNAME(ProductReal4)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
double RTNAME(ProductReal8)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
long double RTNAME(ProductReal10)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
long double RTNAME(ProductReal16)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
|
|
|
|
void RTNAME(CppProductComplex2)(std::complex<float> &, const Descriptor &,
|
|
|
|
const char *source, int line, int dim = 0,
|
|
|
|
const Descriptor *mask = nullptr);
|
|
|
|
void RTNAME(CppProductComplex3)(std::complex<float> &, const Descriptor &,
|
|
|
|
const char *source, int line, int dim = 0,
|
|
|
|
const Descriptor *mask = nullptr);
|
|
|
|
void RTNAME(CppProductComplex4)(std::complex<float> &, const Descriptor &,
|
|
|
|
const char *source, int line, int dim = 0,
|
|
|
|
const Descriptor *mask = nullptr);
|
|
|
|
void RTNAME(CppProductComplex8)(std::complex<double> &, const Descriptor &,
|
|
|
|
const char *source, int line, int dim = 0,
|
|
|
|
const Descriptor *mask = nullptr);
|
|
|
|
void RTNAME(CppProductComplex10)(std::complex<long double> &,
|
|
|
|
const Descriptor &, const char *source, int line, int dim = 0,
|
|
|
|
const Descriptor *mask = nullptr);
|
|
|
|
void RTNAME(CppProductComplex16)(std::complex<long double> &,
|
|
|
|
const Descriptor &, const char *source, int line, int dim = 0,
|
|
|
|
const Descriptor *mask = nullptr);
|
|
|
|
|
|
|
|
void RTNAME(ProductDim)(Descriptor &result, const Descriptor &array, int dim,
|
|
|
|
const char *source, int line, const Descriptor *mask = nullptr);
|
|
|
|
|
2021-04-21 00:19:21 +08:00
|
|
|
// IPARITY()
|
|
|
|
std::int8_t RTNAME(IParity1)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int16_t RTNAME(IParity2)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int32_t RTNAME(IParity4)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int64_t RTNAME(IParity8)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
#ifdef __SIZEOF_INT128__
|
|
|
|
common::int128_t RTNAME(IParity16)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
#endif
|
|
|
|
void RTNAME(IParityDim)(Descriptor &result, const Descriptor &array, int dim,
|
|
|
|
const char *source, int line, const Descriptor *mask = nullptr);
|
|
|
|
|
|
|
|
// FINDLOC, MAXLOC, & MINLOC
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
// These return allocated arrays in the supplied descriptor.
|
|
|
|
// The default value for KIND= should be the default INTEGER in effect at
|
|
|
|
// compilation time.
|
2021-04-21 00:19:21 +08:00
|
|
|
void RTNAME(Findloc)(Descriptor &, const Descriptor &x,
|
|
|
|
const Descriptor &target, int kind, const char *source, int line,
|
|
|
|
const Descriptor *mask = nullptr, bool back = false);
|
|
|
|
void RTNAME(FindlocDim)(Descriptor &, const Descriptor &x,
|
|
|
|
const Descriptor &target, int kind, int dim, const char *source, int line,
|
|
|
|
const Descriptor *mask = nullptr, bool back = false);
|
|
|
|
void RTNAME(Maxloc)(Descriptor &, const Descriptor &x, int kind,
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
const char *source, int line, const Descriptor *mask = nullptr,
|
|
|
|
bool back = false);
|
2021-04-21 00:19:21 +08:00
|
|
|
void RTNAME(MaxlocDim)(Descriptor &, const Descriptor &x, int kind, int dim,
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
const char *source, int line, const Descriptor *mask = nullptr,
|
|
|
|
bool back = false);
|
2021-04-21 00:19:21 +08:00
|
|
|
void RTNAME(Minloc)(Descriptor &, const Descriptor &x, int kind,
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
const char *source, int line, const Descriptor *mask = nullptr,
|
|
|
|
bool back = false);
|
2021-04-21 00:19:21 +08:00
|
|
|
void RTNAME(MinlocDim)(Descriptor &, const Descriptor &x, int kind, int dim,
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
const char *source, int line, const Descriptor *mask = nullptr,
|
|
|
|
bool back = false);
|
|
|
|
|
|
|
|
// MAXVAL and MINVAL
|
|
|
|
std::int8_t RTNAME(MaxvalInteger1)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int16_t RTNAME(MaxvalInteger2)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int32_t RTNAME(MaxvalInteger4)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int64_t RTNAME(MaxvalInteger8)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
2021-04-03 02:02:26 +08:00
|
|
|
#ifdef __SIZEOF_INT128__
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
common::int128_t RTNAME(MaxvalInteger16)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
2021-04-03 02:02:26 +08:00
|
|
|
#endif
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
float RTNAME(MaxvalReal2)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
float RTNAME(MaxvalReal3)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
float RTNAME(MaxvalReal4)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
double RTNAME(MaxvalReal8)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
long double RTNAME(MaxvalReal10)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
long double RTNAME(MaxvalReal16)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
void RTNAME(MaxvalCharacter)(Descriptor &, const Descriptor &,
|
|
|
|
const char *source, int line, const Descriptor *mask = nullptr);
|
|
|
|
|
|
|
|
std::int8_t RTNAME(MinvalInteger1)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int16_t RTNAME(MinvalInteger2)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int32_t RTNAME(MinvalInteger4)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
std::int64_t RTNAME(MivalInteger8)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
2021-04-03 02:02:26 +08:00
|
|
|
#ifdef __SIZEOF_INT128__
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
common::int128_t RTNAME(MivalInteger16)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
2021-04-03 02:02:26 +08:00
|
|
|
#endif
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
float RTNAME(MinvalReal2)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
float RTNAME(MinvalReal3)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
float RTNAME(MinvalReal4)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
double RTNAME(MinvalReal8)(const Descriptor &, const char *source, int line,
|
|
|
|
int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
long double RTNAME(MinvalReal10)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
long double RTNAME(MinvalReal16)(const Descriptor &, const char *source,
|
|
|
|
int line, int dim = 0, const Descriptor *mask = nullptr);
|
|
|
|
void RTNAME(MinvalCharacter)(Descriptor &, const Descriptor &,
|
|
|
|
const char *source, int line, const Descriptor *mask = nullptr);
|
|
|
|
|
|
|
|
void RTNAME(MaxvalDim)(Descriptor &, const Descriptor &, int dim,
|
|
|
|
const char *source, int line, const Descriptor *mask = nullptr);
|
|
|
|
void RTNAME(MinvalDim)(Descriptor &, const Descriptor &, int dim,
|
|
|
|
const char *source, int line, const Descriptor *mask = nullptr);
|
|
|
|
|
2021-04-21 00:19:21 +08:00
|
|
|
// ALL, ANY, COUNT, & PARITY logical reductions
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
bool RTNAME(All)(const Descriptor &, const char *source, int line, int dim = 0);
|
|
|
|
void RTNAME(AllDim)(Descriptor &result, const Descriptor &, int dim,
|
|
|
|
const char *source, int line);
|
|
|
|
bool RTNAME(Any)(const Descriptor &, const char *source, int line, int dim = 0);
|
|
|
|
void RTNAME(AnyDim)(Descriptor &result, const Descriptor &, int dim,
|
|
|
|
const char *source, int line);
|
|
|
|
std::int64_t RTNAME(Count)(
|
|
|
|
const Descriptor &, const char *source, int line, int dim = 0);
|
|
|
|
void RTNAME(CountDim)(Descriptor &result, const Descriptor &, int dim, int kind,
|
|
|
|
const char *source, int line);
|
2021-04-21 00:19:21 +08:00
|
|
|
bool RTNAME(Parity)(
|
|
|
|
const Descriptor &, const char *source, int line, int dim = 0);
|
|
|
|
void RTNAME(ParityDim)(Descriptor &result, const Descriptor &, int dim,
|
|
|
|
const char *source, int line);
|
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
2021-04-01 00:14:08 +08:00
|
|
|
|
|
|
|
} // extern "C"
|
|
|
|
} // namespace Fortran::runtime
|
|
|
|
#endif // FORTRAN_RUNTIME_REDUCTION_H_
|