4 #if defined(__apple_build_version__) && ((__clang_major__ < 8) || ((__clang_major__ == 8) && (__clang_minor__ < 1))) 5 #define __APPLE_NEED_FIX 1 9 #if defined(__clang__) && (__clang_major__ < 4) && (__clang_minor__ < 9) 10 #define __CLANG_NEED_FIX 1 13 #if __APPLE_NEED_FIX || __CLANG_NEED_FIX 15 #include <c10/util/Half.h> 16 #include <emmintrin.h> 21 __attribute__((__always_inline__, __nodebug__, __target__(
"f16c")))
22 _cvtsh_ss(
unsigned short a)
24 __v8hi v = {(short)a, 0, 0, 0, 0, 0, 0, 0};
25 __v4sf r = __builtin_ia32_vcvtph2ps(v);
29 static __inline
unsigned short 30 __attribute__((__always_inline__, __nodebug__, __target__(
"f16c")))
31 _cvtss_sh(
float a,
int imm8) {
33 *
reinterpret_cast<at::Half*
>(&ret) = a;
37 #endif // __APPLE_NEED_FIX || __CLANG_NEED_FIX 39 #undef __APPLE_NEED_FIX 40 #undef __CLANG_NEED_FIX 44 #include <c10/util/Half.h> 50 static inline float _cvtsh_ss(
unsigned short x) {
56 t1.intval = x & 0x7fff;
61 t1.intval += 0x38000000;
62 t1.intval = (t3 == 0 ? 0 : t1.intval);
67 static inline unsigned short _cvtss_sh(
float x,
int imm8) {
69 *
reinterpret_cast<at::Half*
>(&ret) = x;