Debian Codegraph @

flang/runtime/Float128Math/norm2.cpp

raw
1 //===-- runtime/Float128Math/norm2.cpp ------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "math-entries.h"
10 #include "numeric-template-specs.h"
11 #include "reduction-templates.h"
12
13 namespace Fortran::runtime {
14 extern "C" {
15
16 #if LDBL_MANT_DIG == 113 || HAS_FLOAT128
17 CppTypeFor<TypeCategory::Real, 16> RTDEF(Norm2_16)(
18 const Descriptor &x, const char *source, int line, int dim) {
19 return GetTotalReduction<TypeCategory::Real, 16>(
20 x, source, line, dim, nullptr, Norm2Accumulator<16>{x}, "NORM2");
21 }
22
23 void RTDEF(Norm2DimReal16)(Descriptor &result, const Descriptor &x, int dim,
24 const char *source, int line) {
25 Terminator terminator{source, line};
26 auto type{x.type().GetCategoryAndKind()};
27 RUNTIME_CHECK(terminator, type);
28 RUNTIME_CHECK(
29 terminator, type->first == TypeCategory::Real && type->second == 16);
30 Norm2Helper<16>{}(result, x, dim, nullptr, terminator);
31 }
32 #endif
33
34 } // extern "C"
35 } // namespace Fortran::runtime