66//
77// ===----------------------------------------------------------------------===//
88
9+ #include " flang/Common/api-attrs.h"
910#include " flang/Common/float128.h"
1011#include " flang/Runtime/cpp-type.h"
1112#include " flang/Runtime/entry-names.h"
@@ -18,7 +19,7 @@ namespace Fortran::runtime {
1819#pragma clang diagnostic ignored "-Wc99-extensions"
1920#endif
2021
21- template <typename C, typename I> C tgpowi (C base, I exp) {
22+ template <typename C, typename I> inline RT_API_ATTRS C tgpowi (C base, I exp) {
2223 if (exp == 0 ) {
2324 return C{1 };
2425 }
@@ -65,21 +66,23 @@ template <typename C, typename I> C tgpowi(C base, I exp) {
6566#ifndef _MSC_VER
6667// With most compilers, C complex is implemented as a builtin type that may have
6768// specific ABI requirements
68- extern " C" float _Complex RTNAME (cpowi)(float _Complex base, std::int32_t exp) {
69+ extern " C" RT_API_ATTRS CppTypeFor<TypeCategory::Complex, 4 > RTNAME (cpowi)(
70+ CppTypeFor<TypeCategory::Complex, 4 > base, std::int32_t exp) {
6971 return tgpowi (base, exp);
7072}
7173
72- extern " C" double _Complex RTNAME (zpowi)(
73- double _Complex base, std::int32_t exp) {
74+ extern " C" RT_API_ATTRS CppTypeFor<TypeCategory::Complex, 8 > RTNAME (zpowi)(
75+ CppTypeFor<TypeCategory::Complex, 8 > base, std::int32_t exp) {
7476 return tgpowi (base, exp);
7577}
7678
77- extern " C" float _Complex RTNAME (cpowk)(float _Complex base, std::int64_t exp) {
79+ extern " C" RT_API_ATTRS CppTypeFor<TypeCategory::Complex, 4 > RTNAME (cpowk)(
80+ CppTypeFor<TypeCategory::Complex, 4 > base, std::int64_t exp) {
7881 return tgpowi (base, exp);
7982}
8083
81- extern " C" double _Complex RTNAME (zpowk)(
82- double _Complex base, std::int64_t exp) {
84+ extern " C" RT_API_ATTRS CppTypeFor<TypeCategory::Complex, 8 > RTNAME (zpowk)(
85+ CppTypeFor<TypeCategory::Complex, 8 > base, std::int64_t exp) {
8386 return tgpowi (base, exp);
8487}
8588
0 commit comments