20
20
#define __DEFAULT_FN_ATTRS256 \
21
21
__attribute__ ((__always_inline__, __nodebug__, __target__(" f16c" ), __min_vector_width__(256 )))
22
22
23
+ #if defined(__cplusplus) && (__cplusplus >= 201103L)
24
+ #define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
25
+ #define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
26
+ #else
27
+ #define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
28
+ #define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
29
+ #endif
30
+
23
31
/* NOTE: Intel documents the 128-bit versions of these as being in emmintrin.h,
24
32
* but that's because icc can emulate these without f16c using a library call.
25
33
* Since we don't do that let's leave these in f16cintrin.h.
35
43
// / \param __a
36
44
// / A 16-bit half-precision float value.
37
45
// / \returns The converted 32-bit float value.
38
- static __inline float __DEFAULT_FN_ATTRS128
46
+ static __inline float __DEFAULT_FN_ATTRS128_CONSTEXPR
39
47
_cvtsh_ss (unsigned short __a)
40
48
{
41
49
return (float )__builtin_bit_cast (__fp16, __a);
@@ -104,7 +112,7 @@ _cvtsh_ss(unsigned short __a)
104
112
// / A 128-bit vector containing 16-bit half-precision float values. The lower
105
113
// / 64 bits are used in the conversion.
106
114
// / \returns A 128-bit vector of [4 x float] containing converted float values.
107
- static __inline __m128 __DEFAULT_FN_ATTRS128
115
+ static __inline __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
108
116
_mm_cvtph_ps (__m128i __a)
109
117
{
110
118
typedef __fp16 __v4fp16 __attribute__ ((__vector_size__ (8 )));
@@ -151,7 +159,7 @@ _mm_cvtph_ps(__m128i __a)
151
159
// / converted to 32-bit single-precision float values.
152
160
// / \returns A vector of [8 x float] containing the converted 32-bit
153
161
// / single-precision float values.
154
- static __inline __m256 __DEFAULT_FN_ATTRS256
162
+ static __inline __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
155
163
_mm256_cvtph_ps (__m128i __a)
156
164
{
157
165
typedef __fp16 __v8fp16 __attribute__ ((__vector_size__ (16 ), __aligned__ (16 )));
@@ -161,5 +169,7 @@ _mm256_cvtph_ps(__m128i __a)
161
169
162
170
#undef __DEFAULT_FN_ATTRS128
163
171
#undef __DEFAULT_FN_ATTRS256
172
+ #undef __DEFAULT_FN_ATTRS128_CONSTEXPR
173
+ #undef __DEFAULT_FN_ATTRS256_CONSTEXPR
164
174
165
175
#endif /* __F16CINTRIN_H */
0 commit comments