ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
f16cintrin.h
Go to the documentation of this file.
1 /*===---- f16cintrin.h - F16C intrinsics -----------------------------------===
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 
10 #if !defined __IMMINTRIN_H
11 #error "Never use <f16cintrin.h> directly; include <immintrin.h> instead."
12 #endif
13 
14 #ifndef __F16CINTRIN_H
15 #define __F16CINTRIN_H
16 
17 /* Define the default attributes for the functions in this file. */
18 #define __DEFAULT_FN_ATTRS128 \
19  __attribute__((__always_inline__, __nodebug__, __target__("f16c"), __min_vector_width__(128)))
20 #define __DEFAULT_FN_ATTRS256 \
21  __attribute__((__always_inline__, __nodebug__, __target__("f16c"), __min_vector_width__(256)))
22 
23 /* NOTE: Intel documents the 128-bit versions of these as being in emmintrin.h,
24  * but that's because icc can emulate these without f16c using a library call.
25  * Since we don't do that let's leave these in f16cintrin.h.
26  */
27 
38 static __inline float __DEFAULT_FN_ATTRS128
39 _cvtsh_ss(unsigned short __a)
40 {
41  __v8hi __v = {(short)__a, 0, 0, 0, 0, 0, 0, 0};
42  __v4sf __r = __builtin_ia32_vcvtph2ps(__v);
43  return __r[0];
44 }
45 
68 #define _cvtss_sh(a, imm) \
69  (unsigned short)(((__v8hi)__builtin_ia32_vcvtps2ph((__v4sf){a, 0, 0, 0}, \
70  (imm)))[0])
71 
95 #define _mm_cvtps_ph(a, imm) \
96  (__m128i)__builtin_ia32_vcvtps2ph((__v4sf)(__m128)(a), (imm))
97 
109 static __inline __m128 __DEFAULT_FN_ATTRS128
111 {
112  return (__m128)__builtin_ia32_vcvtph2ps((__v8hi)__a);
113 }
114 
138 #define _mm256_cvtps_ph(a, imm) \
139  (__m128i)__builtin_ia32_vcvtps2ph256((__v8sf)(__m256)(a), (imm))
140 
153 static __inline __m256 __DEFAULT_FN_ATTRS256
155 {
156  return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)__a);
157 }
158 
159 #undef __DEFAULT_FN_ATTRS128
160 #undef __DEFAULT_FN_ATTRS256
161 
162 #endif /* __F16CINTRIN_H */
static __inline__ void int __a
Definition: emmintrin.h:4185
#define __DEFAULT_FN_ATTRS256
Definition: f16cintrin.h:20
#define __DEFAULT_FN_ATTRS128
Definition: f16cintrin.h:18
static __inline __m128 __DEFAULT_FN_ATTRS128 _mm_cvtph_ps(__m128i __a)
Converts a 128-bit vector containing 16-bit half-precision float values into a 128-bit vector contain...
Definition: f16cintrin.h:110
static __inline __m256 __DEFAULT_FN_ATTRS256 _mm256_cvtph_ps(__m128i __a)
Converts a 128-bit vector containing 16-bit half-precision float values into a 256-bit vector of [8 x...
Definition: f16cintrin.h:154
static __inline float __DEFAULT_FN_ATTRS128 _cvtsh_ss(unsigned short __a)
Converts a 16-bit half-precision float value into a 32-bit float value.
Definition: f16cintrin.h:39
struct __storeu_i16 *__P __v
Definition: immintrin.h:348