clang API Documentation
00001 /*===---- fma4intrin.h - FMA4 intrinsics -----------------------------------=== 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy 00004 * of this software and associated documentation files (the "Software"), to deal 00005 * in the Software without restriction, including without limitation the rights 00006 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00007 * copies of the Software, and to permit persons to whom the Software is 00008 * furnished to do so, subject to the following conditions: 00009 * 00010 * The above copyright notice and this permission notice shall be included in 00011 * all copies or substantial portions of the Software. 00012 * 00013 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00014 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00015 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00016 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00017 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00018 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00019 * THE SOFTWARE. 00020 * 00021 *===-----------------------------------------------------------------------=== 00022 */ 00023 00024 #ifndef __IMMINTRIN_H 00025 #error "Never use <fmaintrin.h> directly; include <immintrin.h> instead." 00026 #endif 00027 00028 #ifndef __FMAINTRIN_H 00029 #define __FMAINTRIN_H 00030 00031 #ifndef __FMA__ 00032 # error "FMA instruction set is not enabled" 00033 #else 00034 00035 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) 00036 _mm_fmadd_ps(__m128 __A, __m128 __B, __m128 __C) 00037 { 00038 return (__m128)__builtin_ia32_vfmaddps(__A, __B, __C); 00039 } 00040 00041 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) 00042 _mm_fmadd_pd(__m128d __A, __m128d __B, __m128d __C) 00043 { 00044 return (__m128d)__builtin_ia32_vfmaddpd(__A, __B, __C); 00045 } 00046 00047 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) 00048 _mm_fmadd_ss(__m128 __A, __m128 __B, __m128 __C) 00049 { 00050 return (__m128)__builtin_ia32_vfmaddss(__A, __B, __C); 00051 } 00052 00053 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) 00054 _mm_fmadd_sd(__m128d __A, __m128d __B, __m128d __C) 00055 { 00056 return (__m128d)__builtin_ia32_vfmaddsd(__A, __B, __C); 00057 } 00058 00059 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) 00060 _mm_fmsub_ps(__m128 __A, __m128 __B, __m128 __C) 00061 { 00062 return (__m128)__builtin_ia32_vfmsubps(__A, __B, __C); 00063 } 00064 00065 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) 00066 _mm_fmsub_pd(__m128d __A, __m128d __B, __m128d __C) 00067 { 00068 return (__m128d)__builtin_ia32_vfmsubpd(__A, __B, __C); 00069 } 00070 00071 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) 00072 _mm_fmsub_ss(__m128 __A, __m128 __B, __m128 __C) 00073 { 00074 return (__m128)__builtin_ia32_vfmsubss(__A, __B, __C); 00075 } 00076 00077 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) 00078 _mm_fmsub_sd(__m128d __A, __m128d __B, __m128d __C) 00079 { 00080 return (__m128d)__builtin_ia32_vfmsubsd(__A, __B, __C); 00081 } 00082 00083 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) 00084 _mm_fnmadd_ps(__m128 __A, __m128 __B, __m128 __C) 00085 { 00086 return (__m128)__builtin_ia32_vfnmaddps(__A, __B, __C); 00087 } 00088 00089 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) 00090 _mm_fnmadd_pd(__m128d __A, __m128d __B, __m128d __C) 00091 { 00092 return (__m128d)__builtin_ia32_vfnmaddpd(__A, __B, __C); 00093 } 00094 00095 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) 00096 _mm_fnmadd_ss(__m128 __A, __m128 __B, __m128 __C) 00097 { 00098 return (__m128)__builtin_ia32_vfnmaddss(__A, __B, __C); 00099 } 00100 00101 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) 00102 _mm_fnmadd_sd(__m128d __A, __m128d __B, __m128d __C) 00103 { 00104 return (__m128d)__builtin_ia32_vfnmaddsd(__A, __B, __C); 00105 } 00106 00107 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) 00108 _mm_fnmsub_ps(__m128 __A, __m128 __B, __m128 __C) 00109 { 00110 return (__m128)__builtin_ia32_vfnmsubps(__A, __B, __C); 00111 } 00112 00113 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) 00114 _mm_fnmsub_pd(__m128d __A, __m128d __B, __m128d __C) 00115 { 00116 return (__m128d)__builtin_ia32_vfnmsubpd(__A, __B, __C); 00117 } 00118 00119 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) 00120 _mm_fnmsub_ss(__m128 __A, __m128 __B, __m128 __C) 00121 { 00122 return (__m128)__builtin_ia32_vfnmsubss(__A, __B, __C); 00123 } 00124 00125 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) 00126 _mm_fnmsub_sd(__m128d __A, __m128d __B, __m128d __C) 00127 { 00128 return (__m128d)__builtin_ia32_vfnmsubsd(__A, __B, __C); 00129 } 00130 00131 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) 00132 _mm_fmaddsub_ps(__m128 __A, __m128 __B, __m128 __C) 00133 { 00134 return (__m128)__builtin_ia32_vfmaddsubps(__A, __B, __C); 00135 } 00136 00137 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) 00138 _mm_fmaddsub_pd(__m128d __A, __m128d __B, __m128d __C) 00139 { 00140 return (__m128d)__builtin_ia32_vfmaddsubpd(__A, __B, __C); 00141 } 00142 00143 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) 00144 _mm_fmsubadd_ps(__m128 __A, __m128 __B, __m128 __C) 00145 { 00146 return (__m128)__builtin_ia32_vfmsubaddps(__A, __B, __C); 00147 } 00148 00149 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) 00150 _mm_fmsubadd_pd(__m128d __A, __m128d __B, __m128d __C) 00151 { 00152 return (__m128d)__builtin_ia32_vfmsubaddpd(__A, __B, __C); 00153 } 00154 00155 static __inline__ __m256 __attribute__((__always_inline__, __nodebug__)) 00156 _mm256_fmadd_ps(__m256 __A, __m256 __B, __m256 __C) 00157 { 00158 return (__m256)__builtin_ia32_vfmaddps256(__A, __B, __C); 00159 } 00160 00161 static __inline__ __m256d __attribute__((__always_inline__, __nodebug__)) 00162 _mm256_fmadd_pd(__m256d __A, __m256d __B, __m256d __C) 00163 { 00164 return (__m256d)__builtin_ia32_vfmaddpd256(__A, __B, __C); 00165 } 00166 00167 static __inline__ __m256 __attribute__((__always_inline__, __nodebug__)) 00168 _mm256_fmsub_ps(__m256 __A, __m256 __B, __m256 __C) 00169 { 00170 return (__m256)__builtin_ia32_vfmsubps256(__A, __B, __C); 00171 } 00172 00173 static __inline__ __m256d __attribute__((__always_inline__, __nodebug__)) 00174 _mm256_fmsub_pd(__m256d __A, __m256d __B, __m256d __C) 00175 { 00176 return (__m256d)__builtin_ia32_vfmsubpd256(__A, __B, __C); 00177 } 00178 00179 static __inline__ __m256 __attribute__((__always_inline__, __nodebug__)) 00180 _mm256_fnmadd_ps(__m256 __A, __m256 __B, __m256 __C) 00181 { 00182 return (__m256)__builtin_ia32_vfnmaddps256(__A, __B, __C); 00183 } 00184 00185 static __inline__ __m256d __attribute__((__always_inline__, __nodebug__)) 00186 _mm256_fnmadd_pd(__m256d __A, __m256d __B, __m256d __C) 00187 { 00188 return (__m256d)__builtin_ia32_vfnmaddpd256(__A, __B, __C); 00189 } 00190 00191 static __inline__ __m256 __attribute__((__always_inline__, __nodebug__)) 00192 _mm256_fnmsub_ps(__m256 __A, __m256 __B, __m256 __C) 00193 { 00194 return (__m256)__builtin_ia32_vfnmsubps256(__A, __B, __C); 00195 } 00196 00197 static __inline__ __m256d __attribute__((__always_inline__, __nodebug__)) 00198 _mm256_fnmsub_pd(__m256d __A, __m256d __B, __m256d __C) 00199 { 00200 return (__m256d)__builtin_ia32_vfnmsubpd256(__A, __B, __C); 00201 } 00202 00203 static __inline__ __m256 __attribute__((__always_inline__, __nodebug__)) 00204 _mm256_fmaddsub_ps(__m256 __A, __m256 __B, __m256 __C) 00205 { 00206 return (__m256)__builtin_ia32_vfmaddsubps256(__A, __B, __C); 00207 } 00208 00209 static __inline__ __m256d __attribute__((__always_inline__, __nodebug__)) 00210 _mm256_fmaddsub_pd(__m256d __A, __m256d __B, __m256d __C) 00211 { 00212 return (__m256d)__builtin_ia32_vfmaddsubpd256(__A, __B, __C); 00213 } 00214 00215 static __inline__ __m256 __attribute__((__always_inline__, __nodebug__)) 00216 _mm256_fmsubadd_ps(__m256 __A, __m256 __B, __m256 __C) 00217 { 00218 return (__m256)__builtin_ia32_vfmsubaddps256(__A, __B, __C); 00219 } 00220 00221 static __inline__ __m256d __attribute__((__always_inline__, __nodebug__)) 00222 _mm256_fmsubadd_pd(__m256d __A, __m256d __B, __m256d __C) 00223 { 00224 return (__m256d)__builtin_ia32_vfmsubaddpd256(__A, __B, __C); 00225 } 00226 00227 #endif /* __FMA__ */ 00228 00229 #endif /* __FMAINTRIN_H */