f16cintrin.h revision 245431
1181418Sedwin/*===---- f16cintrin.h - F16C intrinsics ---------------------------------=== 2153761Swollman * 367578Swollman * Permission is hereby granted, free of charge, to any person obtaining a copy 42742Swollman * of this software and associated documentation files (the "Software"), to deal 52742Swollman * in the Software without restriction, including without limitation the rights 62742Swollman * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 72742Swollman * copies of the Software, and to permit persons to whom the Software is 8158421Swollman * furnished to do so, subject to the following conditions: 92742Swollman * 102742Swollman * The above copyright notice and this permission notice shall be included in 11158421Swollman * all copies or substantial portions of the Software. 12158421Swollman * 132742Swollman * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1486222Swollman * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1520094Swollman * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1620094Swollman * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1720094Swollman * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1820094Swollman * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1920094Swollman * THE SOFTWARE. 20158421Swollman * 21158421Swollman *===-----------------------------------------------------------------------=== 2220094Swollman */ 232742Swollman 242742Swollman#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H 252742Swollman#error "Never use <f16cintrin.h> directly; include <x86intrin.h> instead." 262742Swollman#endif 2714343Swollman 2858787Sru#ifndef __F16C__ 2914343Swollman# error "F16C instruction is not enabled" 3030711Swollman#endif /* __F16C__ */ 3130711Swollman 32149514Swollman#ifndef __F16CINTRIN_H 3330711Swollman#define __F16CINTRIN_H 3430711Swollman 3530711Swollmantypedef float __v8sf __attribute__ ((__vector_size__ (32))); 3630711Swollmantypedef float __m256 __attribute__ ((__vector_size__ (32))); 3730711Swollman 382742Swollman#define _mm_cvtps_ph(a, imm) __extension__ ({ \ 3930711Swollman __m128 __a = (a); \ 4030711Swollman (__m128i)__builtin_ia32_vcvtps2ph((__v4sf)__a, (imm)); }) 4130711Swollman 4230711Swollman#define _mm256_cvtps_ph(a, imm) __extension__ ({ \ 4330711Swollman __m256 __a = (a); \ 442742Swollman (__m128i)__builtin_ia32_vcvtps2ph256((__v8sf)__a, (imm)); }) 4530711Swollman 4630711Swollmanstatic __inline __m128 __attribute__((__always_inline__, __nodebug__)) 4730711Swollman_mm_cvtph_ps(__m128i a) 4830711Swollman{ 4930711Swollman return (__m128)__builtin_ia32_vcvtph2ps((__v8hi)a); 5030711Swollman} 5130711Swollman 5230711Swollmanstatic __inline __m256 __attribute__((__always_inline__, __nodebug__)) 5330711Swollman_mm256_cvtph_ps(__m128i a) 5430711Swollman{ 552742Swollman return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)a); 5630711Swollman} 5730711Swollman 5830711Swollman#endif /* __F16CINTRIN_H */ 5986222Swollman