36 lines · cpp
1//===-- lib/quadmath/norm2.cpp ----------------------------------*- C++ -*-===//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-exception6//7//===----------------------------------------------------------------------===//8 9#include "math-entries.h"10#include "numeric-template-specs.h"11#include "flang-rt/runtime/reduction-templates.h"12 13namespace Fortran::runtime {14extern "C" {15 16#if HAS_LDBL128 || HAS_FLOAT12817CppTypeFor<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 23void 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#endif33 34} // extern "C"35} // namespace Fortran::runtime36